<?php
require("../class/connect.php");
include("../class/db_sql.php");
include("../class/config.php");
include("../class/class.php");
include("../class/functions.php");
$link=db_connect();
$empire=new mysqlquery();
$logininid=getcvar('loginuserid');
$loginin=getcvar('loginusername');
$loginrnd=getcvar('loginrnd');
$loginlevel=getcvar('loginlevel');
is_login($logininid,$loginin,$loginrnd);
$classid=(int)$_GET['classid'];
$id=(int)$_GET['id'];
$enews=$_GET['enews'];
//验证权限
CheckLevel($logininid,$loginin,$classid,"cj");
//节点名称
$cr=$empire->fetch1("select classname,newsclassid,classid,tbname from {$dbtbpre}enewsinfoclass where classid='$classid'");
if(!$cr[classid])
{
	printerror("ErrorUrl","history.go(-1)");
}
$r=$empire->fetch1("select * from {$dbtbpre}ecms_infotmp_".$cr[tbname]." where id='$id'");
if(empty($r[id]))
{printerror("ErrorUrl","history.go(-1)");}
//----------会员组
$sql1=$empire->query("select * from {$dbtbpre}enewsmembergroup order by level");
while($l_r=$empire->fetch($sql1))
{
	$ygroup.="<option value=".$l_r[groupid].">".$l_r[groupname]."</option>";
}
//----------图片系统模型
$morepicpath="";
if($r[morepic])
{
	$morepicnum=0;
    $r[morepic]=stripSlashes($r[morepic]);
    //下载地址
    $j=0;
    $pd_record=explode("\r\n",$r[morepic]);
    for($i=0;$i<count($pd_record);$i++)
    {
		$j=$i+1;
    	$pd_field=explode("::::::",$pd_record[$i]);
		$morepicpath.="<tr> 
    <td width=7%><div align=center>".$j."</div></td>
    <td width=33%><div align=center>
        <input name=msmallpic[] type=text value='".$pd_field[0]."' size=28>
		<br><input type=file name=msmallpfile[] size=15>
      </div></td>
    <td width=30%><div align=center>
        <input name=mbigpic[] type=text value='".$pd_field[1]."' size=28>
		<br><input type=file name=mbigpfile[] size=15>
      </div></td>
    <td width=30%><div align=center>
        <input name=mpicname[] type=text value='".$pd_field[2]."'><input type=hidden name=mpicid[] value=".$j."><input type=checkbox name=mdelpicid[] value=".$j.">删
      </div></td>
  </tr>";
    }
    $morepicnum=$j;
    $morepicpath="<table width=100% border=0 cellspacing=1 cellpadding=3>".$morepicpath."</table>";
}
//下载地址前缀
if($r[onlinepath]||$r[downpath])
{
	$downurlqz="";
	$newdownqz="";
	$downsql=$empire->query("select urlname,url,urlid from {$dbtbpre}enewsdownurlqz order by urlid");
	while($downr=$empire->fetch($downsql))
	{
		$downurlqz.="<option value='".$downr[url]."'>".$downr[urlname]."</option>";
		$newdownqz.="<option value='".$downr[urlid]."'>".$downr[urlname]."</option>";
	}
}
//----------下载系统模型
$downloadpath="";
$editnum=0;
if($r[downpath])
{
	$r[downpath]=stripSlashes($r[downpath]);
	//下载地址
	$j=0;
	$d_record=explode("\r\n",$r[downpath]);
	for($i=0;$i<count($d_record);$i++)
	{
		$j=$i+1;
		$d_field=explode("::::::",$d_record[$i]);
		//权限
		$tgroup=str_replace(" value=".$d_field[2].">"," value=".$d_field[2]." selected>",$ygroup);
		//地址前缀
		$tnewdownqz=str_replace(" value='".$d_field[4]."'>"," value='".$d_field[4]."' selected>",$newdownqz);
		$downloadpath.="<tr><td width=7%><div align=center>".$j."</div></td><td width=19%><div align=left><input name=downname[] type=text id=downname[] value='".$d_field[0]."' size=17></div></td><td width=40%><input name=downpath[] type=text id=downpath[] value='".$d_field[1]."' size=30><select name=thedownqz[]><option value=''>--地址前缀--</option>".$tnewdownqz."</select><input type=hidden name=pathid[] value=".$j."><input type=checkbox name=delpathid[] value=".$j.">删</td><td width=21%><div align=center><select name=downuser[] id=select><option value=0>游客</option>".$tgroup."</select></div></td><td width=13%><div align=center><input name=fen[] type=text id=fen[] value='".$d_field[3]."' size=6></div></td></tr>";
	}
	$editnum=$j;
	$downloadpath="<table width=100% border=0 cellspacing=1 cellpadding=3>".$downloadpath."</table>";
}
//-----------在线电影模型
$onlinemoviepath="";
$oeditnum=0;
if($r[onlinepath])
{
	$j=0;
	$od_record=explode("\r\n",$r[onlinepath]);
	for($i=0;$i<count($od_record);$i++)
	{
		$j=$i+1;
		$od_field=explode("::::::",$od_record[$i]);
		//权限
		$tgroup=str_replace(" value=".$od_field[2].">"," value=".$od_field[2]." selected>",$ygroup);
		//地址前缀
		$tnewdownqz=str_replace(" value='".$od_field[4]."'>"," value='".$od_field[4]."' selected>",$newdownqz);

		$onlinemoviepath.="<tr><td width=7%><div align=center>".$j."</div></td><td width=19%><div align=left><input name=odownname[] type=text value='".$od_field[0]."' size=17></div></td><td width=40%><input name=odownpath[] type=text value='".$od_field[1]."' size=30><select name=othedownqz[]><option value=''>--地址前缀--</option>".$tnewdownqz."</select><input type=hidden name=opathid[] value=".$j."><input type=checkbox name=odelpathid[] value=".$j.">删</td><td width=21%><div align=center><select name=odownuser[] id=select><option value=0>游客</option>".$tgroup."</select></div></td><td width=13%><div align=center><input name=ofen[] type=text value='".$od_field[3]."' size=6></div></td></tr>";
	}
	$oeditnum=$j;
	$onlinemoviepath="<table width=100% border=0 cellspacing=1 cellpadding=3>".$onlinemoviepath."</table>";
}
if($r[wplay])
{
	$wplay0="";
	$wplay1=" checked";
}
//-----------新闻系统模型
if($r[newstext])
{
	$newstext=htmlspecialchars($r[newstext]);
	$htmlareacode="<script type=\"text/javascript\">
      _editor_url = \"editor\";
      _editor_lang = \"en\";
    </script>

<script type=\"text/javascript\" src=\"editor/htmlarea.php?userid=$logininid&username=$loginin&rnd=$loginrnd&classid=$classid\"></script>
<script type=\"text/javascript\" src=\"editor/plugins/FullPage/full-page.js\"></script>
<script type=\"text/javascript\" src=\"editor/plugins/FullPage/lang/en.js\"></script>

<script type=\"text/javascript\">
//HTMLArea.loadPlugin(\"FullPage\");

var editor = null;
function initEditor() {
editor = new HTMLArea(\"newstext\");
editor.registerPlugin(FullPage);

editor.generate();
return false;
}

function DoFile(html) {
	editor.insertHTML(html);
}
    </script>";

	$onload=" onload=\"initEditor()\"";
}
$r[smalltext]=htmlspecialchars($r[smalltext]);
//栏目名称
$newsclassid=$cr[newsclassid];
$newsclassname=$class_r[$newsclassid][classname];
$newsbclassname=$class_r[$class_r[$newsclassid][bclassid]][classname];
$newsclass="<font color=red>".$newsbclassname."&nbsp;->&nbsp;".$newsclassname."</font>";
db_close();
$empire=null;
$cjfile="../data/html/editcj".$class_r[$newsclassid][modid].".php";
//风格
$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">
<?=$htmlareacode?>
<script>
function on()
{
var f=document.add
f.HTML.value=f.newstext.value;
}
function writer(tag){
var f=document.add.writer
f.value=tag+f.value
f.focus()
}
function tj(tag){
var f=document.add.writer
f.value=f.value+tag
f.focus()
}
function clear(){
if(confirm("是否复位作者信息？")){
document.add.writer.value=""
document.add.writer.focus()
}
}
function bs(){
var f=document.add
if(f.title.value.length==0){alert("标题还没写");f.title.focus();return false}
}
function br(){
if(!confirm("是否复位？")){return false;}
document.add.title.select()
}

function foreColor()
{
  if (!Error())	return;
  var arr = showModalDialog("editor/selcolor.html", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0");
  if (arr != null) document.add.titlecolor.value=arr;
  else document.add.titlecolor.focus();
}
</script>
</head>

<body<?=$onload?>>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="0">
  <tr> 
    <td>位置：采集 -&gt; <a href="ListInfoClass.php">管理节点</a> -&gt; <a href="CheckCj.php?classid=<?=$classid?>">审核采集</a> 
      -&gt; 节点名称： 
      <?=$cr[classname]?>
      -&gt; 修改采集信息</td>
  </tr>
  <tr>
    <td>入库栏目： 
      <?=$newsclass?>
    </td>
  </tr>
</table>
<form name="add" method="post" onsubmit="return bs()" onreset="return br()" enctype="multipart/form-data" action=enews.php>
  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
    <tr class="header"> 
      <td width="17%" height="25">修改采集信息</td>
      <td width="83%" height="25"><input name="id" type="hidden" id="id" value="<?=$id?>"> 
        <input name="classid" type="hidden" id="classid" value="<?=$classid?>">
		<input name="editnum" type="hidden" id="editnum" value="<?=$editnum?>">
        <input name="enews" type="hidden" id="enews" value="<?=$enews?>"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25">采集地址：</td>
      <td height="25"><a href="<?=$r[oldurl]?>" target=_blank>
        <?=$r[oldurl]?>
        </a></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25">采集时间：</td>
      <td height="25">
        <?=$r[tmptime]?>
      </td>
    </tr>
    <?
	@include($cjfile);
	?>
    <tr bgcolor="#FFFFFF"> 
      <td height="25">&nbsp;</td>
      <td height="25"><input type="submit" name="Submit" value="修改"> <input type="reset" name="Submit2" value="重置"></td>
    </tr>
  </table>
</form>
</body>
</html>
