<?php
require("../../class/connect.php");
include("../../class/db_sql.php");
include("../../class/config.php");
include("../../class/functions.php");
include "../".LoadLang("pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
$logininid=getcvar('loginuserid');
$loginin=getcvar('loginusername');
$loginrnd=getcvar('loginrnd');
$loginlevel=getcvar('loginlevel');
$editor=1;
is_login($logininid,$loginin,$loginrnd);
//验证权限
CheckLevel($logininid,$loginin,$classid,"picnews");
$start=(int)$_GET['start'];
$page=(int)$_GET['page'];
$add="";
$search="";
$classid=(int)$_GET['classid'];
if($classid)
{
	$add=" where classid='$classid'";
    $search="&classid=$classid";
}
$line=10;//每行显示
$page_line=15;
$offset=$start+$page*$line;
$totalquery="select count(*) as total from {$dbtbpre}enewspic".$add;
$num=$empire->gettotal($totalquery);//取得总条数
$query="select picid,title,pic_url,url,pic_width,pic_height,open_pic,border,pictext from {$dbtbpre}enewspic".$add;
$query.=" order by picid desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page1($num,$line,$page_line,$start,$page,$search);
//图片类别
$csql=$empire->query("select classid,classname from {$dbtbpre}enewspicclass order by classid");
while($cr=$empire->fetch($csql))
{
	if($classid==$cr[classid])
	{$select=" selected";}
	else
	{$select="";}
	$class.="<option value=".$cr[classid].$select.">".$cr[classname]."</option>";
}
//风格
$loginadminstyleid=(int)getcvar('loginadminstyleid');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理图片信息</title>
<link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr>
    <td>位置：<a href="ListPicNews.php">管理图片信息</a>&nbsp;&nbsp;(<a href=AddPicNews.php?enews=AddPicNews>增加图片信息</a>)</td>
  </tr>
</table>
<br>
<table width="98%" border="0" cellspacing="1" cellpadding="3">
  <tr>
    <td>分类：
      <select name="classid" id="classid" onchange=window.location='ListPicNews.php?classid='+this.options[this.selectedIndex].value>
        <option value="0">所有类别</option>
		<?=$class?>
      </select></td>
  </tr>
</table>
<form name="form1" method="post" action="../enews.php" onsubmit="return confirm('确认要删除?');">
<input type=hidden name=enews value=DelPicNews_all>
  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
    <tr class="header"> 
      <td width="10%" height="25"><div align="center">ID</div></td>
      <td width="64%" height="25"><div align="center">预览</div></td>
      <td width="26%" height="25"><div align="center">操作</div></td>
    </tr>
    <?
	while($r=$empire->fetch($sql))
	{
	?>
    <tr bgcolor="#FFFFFF" id=pic<?=$r[picid]?>> 
      <td height="25"><div align="center">
          <?=$r[picid]?>
        </div></td>
      <td height="25"><div align="center"><a href="<?=$r[url]?>" target="<?=$r[open_pic]?>" title="<?=$r[title]?>"><img src="<?=$r[pic_url]?>" height="<?=$r[pic_height]?>" width="<?=$r[pic_width]?>" border="<?=$r[border]?>"></a><br>
          <?=$r[title]?>
        </div></td>
      <td height="25"><div align="center">[<a href="AddPicNews.php?enews=EditPicNews&picid=<?=$r[picid]?>">修改</a>] 
          [<a href="../enews.php?enews=DelPicNews&picid=<?=$r[picid]?>" onclick="return confirm('确认要删除?');">删除</a> 
          <input name="picid[]" type="checkbox" id="picid[]" value="<?=$r[picid]?>" onclick="if(this.checked){pic<?=$r[picid]?>.style.backgroundColor='#DBEAF5';}else{pic<?=$r[picid]?>.style.backgroundColor='#ffffff';}">
          ]</div></td>
    </tr>
    <?
	}
	?>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" colspan="3">&nbsp;
        <?=$returnpage?>
        &nbsp;&nbsp;
        <input type="submit" name="Submit" value="批量删除"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td height="25" colspan="3">JS调用方式：&lt;script src=
        <?=$public_r[newsurl]?>
        d/js/pic/pic_图片信息ID.js&gt;&lt;/script&gt;</td>
    </tr>
  </table>
</form>
</body>
</html>
<?
db_close();
$empire=null;
?>
