<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link  href="skin/css/style.css" rel="stylesheet" type="text/css" />
<title>幻灯片管理</title>
<link href="skin/css/admin.css" rel="stylesheet" type="text/css" />
<script src="skin/js/common.js" type="text/javascript"></script>
<script src="skin/js/main.js" type="text/javascript"></script>
</head>
<body>
<div class="container" id="cpcontainer">
<?php
$numPerPage=5;
$whereStr='';
if(!empty($keyword)) $whereStr=" where url like '%".$keyword."%' or webname like '%".$keyword."%' or msg like '%".$keyword."%' ";
$page = isset($page) ? intval($page) : 1;
if($page==0) $page=1;
$csqlStr="select count(*) as dd from `duomi_slide`$whereStr";
$row = $dsql->GetOne($csqlStr);
if(is_array($row)){
$TotalResult = $row['dd'];
}else{
$TotalResult = 0;
}
$TotalPage = ceil($TotalResult/$numPerPage);
if ($page>$TotalPage) $page=$TotalPage;
$limitstart = ($page-1) * $numPerPage;
if($limitstart<0) $limitstart=0;
$sqlStr="select id,sortrank,url,webname,v_pic from `duomi_slide`$whereStr order by sortrank asc limit $limitstart,$numPerPage";
?>
<form action="" method="post" name="linkform">
<table border="0" cellpadding="0" cellspacing="0" align="center" class="tb">
<tr class="thead"><th colspan="7"><em style="font-weight:bold">幻灯片管理</em></th></tr>
    <TR align="center">
	  <TD>&nbsp;</TD>
      <TD width="30" align="left">ID</TD>
      <TD>标题</TD>
      <TD>链接</TD>
      <TD>图片</TD>
      <TD width="5%">排序</TD>
      <TD>操作</TD>
    </TR>
<?php
$dsql->SetQuery($sqlStr);
$dsql->Execute('flink_list');
while($row=$dsql->GetObject('flink_list'))
{
$aid=$row->id;
?>
     <TR align="center"<?php if($id==$aid) echo " class=\"editlast\"";?>>
	  <TD>&nbsp;</TD>
      <TD align="left"><input type="checkbox" value="<?php echo $aid;?>" name="e_id[]"  class="checkbox" /> <?php echo $aid;?></TD>
      <TD><input type="text" name="webname<?php echo $aid;?>" value="<?php echo $row->webname;?>"/></TD>
      <TD><input name="url<?php echo $aid;?>" type="text" value="<?php echo $row->url;?>"/></TD>
      <td><input name="v_pic<?php echo $aid;?>" type="text" value="<?php echo $row->v_pic;?>"/></td>
      <TD><input name="sortrank<?php echo $aid;?>" type="text" value="<?php echo $row->sortrank;?>" style="width:30px"/></TD>
      <TD><a  href="?action=last&id=<?php echo $aid;?>">上移</a> <a href="?action=next&id=<?php echo $aid;?>">下移</a> <a href="?action=edit&id=<?php echo $aid;?>">编辑</a> <a  onclick="if(confirm('确定要删除吗')){return true;}else{return false;}" href="?action=del&id=<?php echo $aid;?>">删除</a></TD>
    </TR>
<?php
}
?>
    <tr><td  colspan="8"><input type="submit" value="批量修改选中数据" name="Submit"  class="rb1"  onclick="linkform.action='?action=editall';"/>&nbsp;&nbsp; <input type="submit" value="批量删除选中数据" onclick="if(confirm('确定要删除吗')){linkform.action='?action=delall';}else{return false}" class="rb1"  />&nbsp;&nbsp;每页显示<?php echo $numPerPage;?>条幻灯片，当前有<?php echo $TotalResult;?>条幻灯片 <a href="?page=1">首页</a> <a href="?page=<?php echo ($page-1);?>">上一页</a> <?php echo makePageNumber($page, 8, $TotalPage, "adslist");?> <a href="?page=<?php echo ($page+1);?>">下一页</a> <a href="?page=<?php echo $TotalPage;?>">尾页</a></td></tr>
</TABLE>
</form> 
<?php
if($action=="edit"){
$row = $dsql->GetOne("Select webname,url,sortrank,msg,v_pic From `duomi_slide` where id='$id'");
?>
<form action="?action=save&id=<?php echo $id;?>" method="post" name="editlink" id="addform">
<table border="0" cellpadding="0" cellspacing="0" align="center" class="tb mt20">
<tr class="thead"><th colspan="2">编辑幻灯片</th></tr>
    <TR>
      <TD >排序：</TD>
      <TD ><input type="text" size="20" name="sortrank" value="<?php echo $row['sortrank'];?>"/></TD>
    </TR>
    <TR>
      <TD vAlign=left width="20%" >标题：</TD>
      <TD ><input type="text" size="50" name="webname" value="<?php echo $row['webname'];?>"/><font color="red">＊</font></TD>
    </TR>
    <TR>
      <TD >链接：</TD>
      <TD ><input type="text" size="50" name="url" value="<?php echo $row['url'];?>"/><font color="red">＊</font></TD>
    </TR>
    <TR>
      <TD >图片：</TD>
      <TD ><input type="text" size="50" name="v_pic" value="<?php echo $row['v_pic'];?>"/><font color="red">＊</font>
              <iframe src="upload.htm" scrolling="No" topmargin="0" width="320" height="30" marginwidth="0" marginheight="0" frameborder="0" align="center"></iframe></TD>
    </TR>
    <TR>
      <TD >描述：</TD>
      <TD ><textarea type="text" name="msg" cols="50" rows="4" ><?php echo $row['msg'];?></textarea></TD>
    </TR>
    <TR >
      <td></td><TD><input type="submit" value="修改幻灯片" class="rb1" name="m_eidtlinksubmit" />
      &nbsp;<input type="button" value="返   回"  class="rb1" onClick="javascript:history.go(-1)" /></TD>
    </TR>
</td></tr></table>
</form>
<script>editlink.m_eidtlinksubmit.focus()</script>
<?php
}else{
?>
<form action="?action=add" method="post" id="addform">
<table border="0" cellpadding="0" cellspacing="0" align="center" class="tb mt20">
<tr class="thead"><th colspan="2">添加幻灯片</th></tr>
    <TR>
      <TD >排序：</TD>
      <TD ><input type="text" size="20" name="sortrank"/></TD>
    </TR>
    <TR>
      <TD vAlign=left width="12%" >标题：</TD>
      <TD ><input type="text" size="50" name="webname" /><font color="red">＊</font></TD>
    </TR>
    <TR>
      <TD >链接：</TD>
      <TD ><input type="text" size="50" name="url" /><font color="red">＊</font></TD>
    </TR>
    <TR>
      <TD >图片：</TD>
      <TD ><input type="text" size="50" name="v_pic" id="v_pic" /><font color="red">＊</font>
              <iframe src="upload.htm" scrolling="No" topmargin="0" width="320" height="30" marginwidth="0" marginheight="0" frameborder="0" align="center"></iframe></TD>
    </TR>

    <TR>
      <TD>描述：</TD>
      <TD ><textarea name="msg" cols="50" rows="4" ></textarea></TD>
    </TR>
    <TR  >
      <TD></TD> <TD><input type="submit" value="添加幻灯片" class="rb1" />
      &nbsp;<input type="button" value="返   回"  class="rb1" onClick="javascript:history.go(-1)" /></TD>
    </TR>
</td></tr></table>
</form>
<?php
}
?>
</div>

<?php
viewFoot();
?>
</body>
</html>
