{include file="header.tpl" page_name=$page_name sys_name=$sys_name}
<div align="center">
	{$admin_nav}
    {literal}
        <script type="text/javascript">
            function submit_form(self){
                $("#slide_form").attr("action", $(self).attr("id"));
				$("#slide_form").submit();
            }
			$(document).ready(function(){
				$(".slide_id").click(function(){
					var key  = $.trim($(this).attr("href"));
					if(isNaN(key)){
						alert("请正确选择");
						return false;
					}
					key = parseInt(key);
					var description = $(this).parent().prev();
					var link_url = description.prev();
					var image_src = link_url.prev();
					var image_title = image_src.prev();
					var slide_sort = image_title.prev();
					$("#slide_title").val(image_title.attr("title"));
					$("#slide_image_src").val(image_src.attr("title"));
					$("#slide_link_url").val(link_url.text());
					$("#slide_sort").val(slide_sort.text());
					$("#slide_description").val(description.attr("title"));
					$("#slide_id").val(key);
					return false;
				});
			});
        </script>
    {/literal}
    <table width="98%" border="0" cellpadding="0" cellspacing="0" id="slide_table" class="tableborder tableborder_line">
        {if $result}
            <tr class="header">
				<td style="width:40px;">顺序</td>
                <td>标题</td>
                <td nowrap="nowrap">图片地址</td>
                <td nowrap="nowrap">连接地址</td>
                <td nowrap="nowrap">说明</td>
                <td nowrap="nowrap">操作</td>
            </tr>
            {foreach from=$result item=slide key=key}
                <tr>
				  <td style="text-align:center;">{$slide.sort}</td>
                  <td align="center" valign="middle" nowrap="nowrap"  title="{$slide.title}" >{$slide.title|truncate:14:''}</td>
                  <td align="center" valign="middle" nowrap="nowrap" title="{$slide.image_src}">{$slide.image_file_name}</td>
                  <td align="center" valign="middle">{$slide.link_url}</td>
                  <td align="center" valign="middle" nowrap="nowrap" title="{$slide.title}">{$slide.description|truncate:14:''}</td>
                    <td align="center" valign="middle" nowrap="nowrap">
                        <a href="{$slide.image_src}" target="_blank">查看图片</a>
                        |
                        <a href="{$key}" class="slide_id">修改</a>
                        |
                        <a href="?action=slide&do=delete&id={$key}">删除</a>
                    </td>
                </tr>
            {/foreach}
        {else}
            <tr>
                <td><div class="showNotice">没有幻灯片图片，请您添加。</div></td>
            </tr>
        {/if}
    </table>
<hr  style="margin-top:30px"/>
    <form action="" id="slide_form" method="post" autocomplete="off">
        <table width="98%" border="0" cellpadding="0" cellspacing="0" class="tableborder" style="margin-top:10px">
        	<tr>
                <td class="one">图片地址</td>
                <td>
                    <input class="form_text" value="{$ads.ads_text.image_src}" type="text" name="image_src" id="slide_image_src" maxlength="200"  /><input type="button"  onclick="window.parent.show_window(document.getElementById('slide_image_src'),'admincp.php?action=file&a=default&type=pic');" value="选择"/>
                </td>
            </tr>
            <tr>
            	<td class="one">链接地址</td>
                <td>
                	<input type="text" class="form_text" maxlength="100" id="slide_link_url" name="link_url"  />
                </td>
            </tr>
            <tr>
            	<td class="one">
                	标题:
                </td>
                <td><input  type="text" value="" id="slide_title" class="form_text"  name="title" /></td>
            </tr>
            <tr>
            	<td class="one">排序</td>
                <td>
                	<input type="text" class="form_text" name="sort" id="slide_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>
                	<input type="text" class="form_text" id="slide_description" maxlength="50" name="description"  />
                </td>
            </tr>
            <tr>
            	<td colspan="2"  style="text-align:center">
                	<input type="button" value="添加" onclick="submit_form(this)" id="?action=slide&do=add"  />
                    <input type="button" value="修改" onclick="submit_form(this)" id="?action=slide&do=edit"/>
                </td>
            </tr>
        </table>
        <input type="hidden" name="id" id="slide_id"  />
    </form>
</div>
{include file="footer.tpl"}