{include file="header.tpl" page_name=$page_name sys_name=$sys_name}
<div align="center">
	{$admin_nav}
    <table class="adminMenu g-margin" width="98%" cellspacing="0" cellpadding="0" border="0" align="center">
        <tr>
            <td>
            <b>管理菜单：</b>
                <a href="?action=place&do=show">广告位列表</a>
                  |  
                <a href="?action=place&do=add">添加广告位</a>
            </td>
        </tr>
    </table>
    <form id="phpwms_from" method="post" autocomplete="off">
        <table width="98%" border="0" cellpadding="0" cellspacing="0" class="tableborder tableborder_line">
            {if $do =='show' || $do == ''}
                {if $result.data}
                    <tr class="header">
                        <td>广告位名称</td>
                        <td>广告位描述</td>
                        <td>宽度</th>
                        <td>高度</td>
                        <td>操作</td>
                    </tr>
                    {foreach from=$result.data item=place}
                        <tr>
                            <td>{$place.place_name}</td>
                            <td>{$place.place_desc}</td>
                            <td>{$place.place_width}px</td>
                            <td>{$place.place_height}px</td>
                            <td align="center" style="text-align:center">
                                <a href="?action=place&do=edit&placeid={$place.place_id}&page={$result.curpage}">修改</a>
                                |
                                <a href="?action=place&do=delete&placeid={$place.place_id}&page={$result.curpage}">删除</a>
                            </td>
                        </tr>
                    {/foreach}
                    {if $result.page}
                    	<tr>
                        	<td align="right" style="text-align:right" colspan="5">{$result.page}</td>
                        </tr>
                    {/if}
                {else}
                    <tr>
                        <td><div class="showNotice">没有数据，请您添加广告位。</div></td>
                    </tr>
                {/if}
                  {/if}
            </table>    
            {if $do == 'add' || $do == 'edit'}
             <table width="98%" border="0" cellpadding="0" cellspacing="0" class="tableborder">
                <tr>
                    <td class="one">广告位名称：</td>
                    <td>
                        <input type="text" name="name" value="{$place.place_name}" class="form_text" id="placename" maxlength="50" />
                        <span class="red">*</span>
                    </td>
                </tr>
                <tr>
                    <td class="one">广告位描述：</td>
                    <td>
                        <input  type="text" value="{$place.place_desc}" class="form_text" id="placedesc" name="desc" maxlength="200" />
                    </td>
                </tr>
                <tr>
                    <td class="one">广告位宽度：</td>
                    <td>
                        <input type="text" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="4" value="{$place.place_width}" id="placewidth" class="form_text" name="width" />
                        <span class="red">px *</span>
                    </td>
                </tr>
                <tr>
                    <td class="one">广告位高度：</td>
                    <td>
                        <input type="text" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="4" value="{$place.place_height}" id="placeheight" class="form_text" name="height" />
                        <span class="red">px *</span>
                    </td>
                </tr>
            </table>
            	<div align="center" style="padding: 5px;"><input type="button" class="btn_submit" id="?action=place&do=oper&page={$curpage}" value="保存" /></div>
                {if $do == 'edit'}
                	<input type="hidden" value="{$place.place_id}" name="placeid"  />
                    <input type="hidden" value="{$place.place_name}" name="oldname" />
                {/if}
            <script type="text/javascript">
				{literal}
					$(document).ready(function(){
						$(".btn_submit").click(function(){
							var value = $.trim($("#placename").val());
							if(value == ''){
								alert("广告位名称不能为空");
								return false;
							}
							value = $.trim($("#placewidth").val());
							if(value == ''){
								alert("宽度不能空");
								return false;
							}
							if(isNaN(value) || value < 1){
								alert("宽度只能是大于0的数字");
								return false;
							}
							value = $.trim($("#placeheight").val());
							if(value == ''){
								alert("高度不能空");
								return false;
							}
							if(isNaN(value) || value < 1){
								alert("高度只能是大于0的数字");
								return false;
							}
							$("#phpwms_from").attr("action", $(this).attr("id"));
							$("#phpwms_from").submit();
						});
					});
				{/literal}
            </script>  
            {/if}
    </form>
</div>
{include file="footer.tpl"}