<?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);
$enews=$_GET['enews'];
$classid=(int)$_GET['classid'];
$bclassid=(int)$_GET['bclassid'];
if(empty($class_r[$classid][classid]))
{
	printerror("ErrorUrl","history.go(-1)");
}
//验证权限
$doselfinfo=CheckLevel($logininid,$loginin,$classid,"news");
if(!$class_r[$classid][tbname]||!$class_r[$classid][classid])
{
	printerror("ErrorUrl","history.go(-1)");
}
//非终极栏目
if(!$class_r[$classid]['islast'])
{
	printerror("AddInfoErrorClassid","history.go(-1)");
}
if(empty($bclassid))
{
	$bclassid=$class_r[$classid][bclassid];
}
$id=(int)$_GET['id'];
//附件验证码
if($enews=="AddNews")
{
	if(!$doselfinfo['doaddinfo'])//增加权限
	{
		printerror("NotAddInfoLevel","history.go(-1)");
	}
	$filepass=time();
	$word='增加信息';
	$ecmsfirstpost=1;
}
else
{
	if(!$doselfinfo['doeditinfo'])//编辑权限
	{
		printerror("NotEditInfoLevel","history.go(-1)");
	}
	$filepass=$id;
	$word='修改信息';
	$ecmsfirstpost=0;
}
//模型
$modid=$class_r[$classid][modid];
$modr=$empire->fetch1("select enter from {$dbtbpre}enewsmod where mid='$modid'");
//导航
$addurldh='';
if($bclassid)
{
	$addurldh="<a href=ListAllInfo.php?tbname=".$class_r[$classid][tbname].">管理信息</a>&nbsp;>&nbsp;";
}
else
{
	$addurldh="<a href=ListAllInfo.php?tbname=".$class_r[$classid][tbname].">管理信息</a>";
}
$url=$addurldh."<a href=ListNews.php?bclassid=".$bclassid."&classid=".$classid.">".$class_r[$bclassid][classname]."</a>&nbsp;>&nbsp;<a href=ListNews.php?bclassid=".$bclassid."&classid=".$classid.">".$class_r[$classid][classname]."</a>&nbsp;>&nbsp;增加信息";
//会员组
$sql1=$empire->query("select groupid,groupname from {$dbtbpre}enewsmembergroup order by level");
while($l_r=$empire->fetch($sql1))
{
	$ygroup.="<option value=".$l_r[groupid].">".$l_r[groupname]."</option>";
}
if($enews=="AddNews")
{
	$group=str_replace(" value=".$class_r[$classid][groupid].">"," value=".$class_r[$classid][groupid]." selected>",$ygroup);
}
//初始化数据
$r[newstime]=date("Y-m-d H:i:s");
$todaytime=$r[newstime];
$r[checked]=$class_r[$classid][checked];
$dokey=" checked";
$r[onclick]=0;
$r[userfen]=0;
$titlefontb="";
$titlefonti="";
$titlefonts="";
$qfr[checkuser]=$class_r[$classid][checkuser];
$voteeditnum=8;
$voter[width]=500;
$voter[height]=300;
$voter[dotime]='0000-00-00';
//----------- 特殊模型初始化 -----------
//图片集模型
if(strstr($modr[enter],"morepic<"))
{
	$morepicnum=3;
	$morepicpath="<table width='100%' border=0 align=center cellpadding=3 cellspacing=1>
  <tr> 
    <td width='7%'><div align=center>1</div></td>
    <td width='33%'><div align=center>
        <input name=msmallpic[] type=text id=msmallpic[] size=28>
		<br><input type=file name=msmallpfile[] size=15>
      </div></td>
    <td width='30%'><div align=center>
        <input name=mbigpic[] type=text id=mbigpic[] size=28>
		<br><input type=file name=mbigpfile[] size=15>
      </div></td>
    <td width='30%'><div align=center>
        <input name=mpicname[] type=text id=mpicname[]>
      </div></td>
  </tr>
  <tr> 
    <td><div align=center>2</div></td>
    <td><div align=center>
        <input name=msmallpic[] type=text id=msmallpic[] size=28>
		<br><input type=file name=msmallpfile[] size=15>
      </div></td>
    <td><div align=center>
        <input name=mbigpic[] type=text id=mbigpic[] size=28>
		<br><input type=file name=mbigpfile[] size=15>
      </div></td>
    <td><div align=center>
        <input name=mpicname[] type=text id=mpicname[]>
      </div></td>
  </tr>
  <tr> 
    <td><div align=center>3</div></td>
    <td><div align=center>
        <input name=msmallpic[] type=text id=msmallpic[] size=28>
		<br><input type=file name=msmallpfile[] size=15>
      </div></td>
    <td><div align=center>
        <input name=mbigpic[] type=text id=mbigpic[] size=28>
		<br><input type=file name=mbigpfile[] size=15>
      </div></td>
    <td><div align=center>
        <input name=mpicname[] type=text id=mpicname[]>
      </div></td>
  </tr>
</table>";
}
//下载地址前缀
if(strstr($modr[enter],"downpath<")||strstr($modr[enter],"onlinepath<"))
{
	$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>";
	}
}
//下载模型
if(strstr($modr[enter],"downpath<"))
{
	$editnum=3;
	$downloadpath="<table width='100%' border=0 cellspacing=1 cellpadding=3>
                <tr> 
                  <td width='7%'> <div align=center>1</div></td>
                  <td width='19%'> <div align=left> 
                      <input name=downname[] type=text value=下载地址1 size=17>
                    </div></td>
                  <td width='40%'> <input name=downpath[] type=text size=36><select name=thedownqz[]><option value=''>--地址前缀--</option>".$newdownqz."</select> 
                  </td>
                  <td width='21%'><div align=center> 
                      <select name=downuser[]>
                        <option value=0>游客</option>
                        ".$ygroup."
                      </select>
                    </div></td>
                  <td width='13%'> <div align=center> 
                      <input name=fen[] type=text value=0 size=6>
                    </div></td>
                </tr>
                <tr> 
                  <td><div align=center>2</div></td>
                  <td><input name=downname[] type=text value=下载地址2 size=17></td>
                  <td><input name=downpath[] type=text size=36><select name=thedownqz[]><option value=''>--地址前缀--</option>".$newdownqz."</select></td>
                  <td><div align=center> 
                      <select name=downuser[]>
                        <option value=0>游客</option>
                        ".$ygroup."
                      </select>
                    </div></td>
                  <td><div align=center> 
                      <input name=fen[] type=text value=0 size=6>
                    </div></td>
                </tr>
                <tr> 
                  <td><div align=center>3</div></td>
                  <td><input name=downname[] type=text value=下载地址3 size=17></td>
                  <td><input name=downpath[] type=text size=36><select name=thedownqz[]><option value=''>--地址前缀--</option>".$newdownqz."</select></td>
                  <td><div align=center> 
                      <select name=downuser[]>
                        <option value=0>游客</option>
                        ".$ygroup."
                      </select>
                    </div></td>
                  <td><div align=center> 
                      <input name=fen[] type=text value=0 size=6>
                    </div></td>
                </tr>
              </table>";
}
//在线电影模型
if(strstr($modr[enter],"onlinepath<"))
{
	$oeditnum=3;
	$onlinemoviepath="<table width='100%' border=0 cellspacing=1 cellpadding=3>
                <tr> 
                  <td width='7%'> <div align=center>1</div></td>
                  <td width='19%'> <div align=left> 
                      <input name=odownname[] type=text value=1 size=17>
                    </div></td>
                  <td width='40%'> <input name=odownpath[] type=text id=odownpath[] size=36><select name=othedownqz[]><option value=''>--地址前缀--</option>".$newdownqz."</select> 
                  </td>
                  <td width='21%'><div align=center> 
                      <select name=odownuser[] id=select>
                        <option value=0>游客</option>
                        ".$ygroup."
                      </select>
                    </div></td>
                  <td width='13%'> <div align=center> 
                      <input name=ofen[] type=text id=ofen[] value=0 size=6>
                    </div></td>
                </tr>
                <tr> 
                  <td><div align=center>2</div></td>
                  <td><input name=odownname[] type=text id=odownname[] value=2 size=17></td>
                  <td><input name=odownpath[] type=text id=odownpath[] size=36><select name=othedownqz[]><option value=''>--地址前缀--</option>".$newdownqz."</select>
				  </td>
                  <td><div align=center> 
                      <select name=odownuser[] id=select2>
                        <option value=0>游客</option>
                        ".$ygroup."
                      </select>
                    </div></td>
                  <td><div align=center> 
                      <input name=ofen[] type=text id=ofen[] value=0 size=6>
                    </div></td>
                </tr>
                <tr> 
                  <td><div align=center>3</div></td>
                  <td><input name=odownname[] type=text id=odownname[] value=3 size=17></td>
                  <td><input name=odownpath[] type=text id=odownpath[] size=36><select name=othedownqz[]><option value=''>--地址前缀--</option>".$newdownqz."</select>	  
					  </td>
                  <td><div align=center> 
                      <select name=odownuser[] id=odownuser[]>
                        <option value=0>游客</option>
                        ".$ygroup."
                      </select>
                    </div></td>
                  <td><div align=center> 
                      <input name=ofen[] type=text id=ofen[] value=0 size=6>
                    </div></td>
                </tr>
              </table>";
}
//html编辑器
if(strstr($modr[enter],"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&filepass=$filepass\"></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();
document.all['title'].focus();
return false;
}

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

	$onload=" onload=\"initEditor()\"";
}

//强制签发权限
$changeuser="<input type='button' name='Submit' value='选择用户' onclick=\"window.open('ChangeUser.php?field=checkuser&form=add','','width=300,height=520,scrollbars=yes');\">";
if($class_r[$classid][docheckuser])
{
	$checkuserreadonly=" readonly";
	$changeuser="";
}

//-----------------------------------------修改信息
if($enews=="EditNews")
{
	$r=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where id='$id' and classid='$classid'");
	if(!$r[id])
	{
		printerror("ErrorUrl","history.go(-1)");
	}
	//签发表
	$qfr=$empire->fetch1("select * from {$dbtbpre}enewsqf where id='$id' and classid='$classid' limit 1");
	//只能编辑自己的信息
	if($doselfinfo['doselfinfo']&&($r[userid]<>$logininid||$r[ismember]))
	{
		printerror("NotDoSelfinfo","history.go(-1)");
	}
	$url=$addurldh."<a href=ListNews.php?bclassid=".$bclassid."&classid=".$classid.">".$class_r[$bclassid][classname]."</a>&nbsp;>&nbsp;<a href=ListNews.php?bclassid=".$bclassid."&classid=".$classid.">".$class_r[$classid][classname]."</a>&nbsp;>&nbsp;修改信息";
	//会员组
	$group=str_replace(" value=".$r[groupid].">"," value=".$r[groupid]." selected>",$ygroup);
	//新闻内容
	if(strstr($modr[enter],"newstext<"))
	{
		$newstext_url="";
		if(strstr($public_r['savetxtf'],",".$class_r[$classid][tbname].".newstext,"))//存放文本
		{
			$newstext_url=$r[newstext];
			$r[newstext]=GetTxtFieldText($r[newstext]);
		}
		$newstext=htmlspecialchars($r[newstext]);
    }
	$dokey="";
	if($r[dokey])
	{
		$dokey=" checked";
	}
	//签发
	$userlen=strlen($qfr[checkuser])-1;
	$qfr[checkuser]=substr($qfr[checkuser],1,$userlen-1);
	//标题属性
	if(strstr($r[titlefont],','))
	{
		$tfontr=explode(',',$r[titlefont]);
		$r[titlecolor]=$tfontr[0];
		$r[titlefont]=$tfontr[1];
	}
	if(strstr($r[titlefont],"b|"))
	{
		$titlefontb=" checked";
	}
	if(strstr($r[titlefont],"i|"))
	{
		$titlefonti=" checked";
	}
	if(strstr($r[titlefont],"s|"))
	{
		$titlefonts=" checked";
	}
	//图片集系统模型
	$morepicpath="";
	if(strstr($modr[enter],"morepic<"))
	{
		$morepicnum=0;
		if($r[morepic])
    	{
    		$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>";
    	}
	}
	//下载系统模型
	$downloadpath="";
	if(strstr($modr[enter],"downpath<"))
	{
		$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>";
		}
	}
	//在线电影模型
	if(strstr($modr[enter],"onlinepath<"))
	{
		$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>";
		}
	}
	//投票
	$voter=$empire->fetch1("select * from {$dbtbpre}enewsinfovote where classid='$classid' and id='$id' limit 1");
	if($voter['id']&&$voter[votetext])
	{
		$d_record=explode("\r\n",$voter[votetext]);
		for($i=0;$i<count($d_record);$i++)
		{
			$j=$i+1;
			$d_field=explode("::::::",$d_record[$i]);
			$allvote.="<tr><td width='9%'><div align=center>".$j."</div></td><td width='65%'><input name=vote_name[] type=text value='".$d_field[0]."' size=30></td><td width='26%'><input name=vote_num[] type=text value='".$d_field[1]."' size=6><input type=hidden name=vote_id[] value=".$j."><input type=checkbox name=delvote_id[] value=".$j.">删除</td></tr>";
		}
		$voteeditnum=$j;
		$allvote="<table width='100%' border=0 cellspacing=1 cellpadding=3>".$allvote."</table>";
	}
}
//取得专题类别
$ztwhere=ReturnClass($class_r[$classid][featherclass]);
$z_sql=$empire->query("select ztname,ztid,tbname from {$dbtbpre}enewszt where classid=0 or classid='$classid' or (".$ztwhere.") order by ztid");
$j=0;
$br="";
while($z_r=$empire->fetch($z_sql))
{
	//不同表
	if($class_r[$classid][tbname]!=$z_r[tbname])
	{continue;}
	$j++;
	if($j%8==0)
	{
		$br="<br>";
	}
	else
	{
		$br="";
	}
	$c_zr=explode("|".$z_r[ztid]."|",$r[ztid]);
	if(count($c_zr)<>1)
	{$z_s=" checked";}
	else
	{$z_s="";}
	$z_class.="<input type=checkbox name=ztid[] value='".$z_r[ztid]."'".$z_s.">".$z_r[ztname]."&nbsp;".$br;
}
//信息来源
if(strstr($modr[enter],"befrom<"))
{
	$befrom_sql=$empire->query("select sitename from {$dbtbpre}enewsbefrom");
	while($b_r=$empire->fetch($befrom_sql))
	{
		$b_class.="<option value='".$b_r[sitename]."'>".$b_r[sitename]."</option>";
	}
}
//作者
if(strstr($modr[enter],"writer<"))
{
	$writer_sql=$empire->query("select writer from {$dbtbpre}enewswriter");
	while($w_r=$empire->fetch($writer_sql))
	{
		$w_class.="<option value='".$w_r[writer]."'>".$w_r[writer]."</option>";
	}
}
//内容模板
$t_sql=$empire->query("select tempid,tempname from ".GetTemptb("enewsnewstemp")." where modid='$modid' order by tempid");
while($nt=$empire->fetch($t_sql))
{
	if($enews=="EditNews")
	{
		if($nt[tempid]==$r[newstempid])
		{
			$select=" selected";
		}
		else
		{
			$select="";
		}
	}
	else
	{
		if($nt[tempid]==$class_r[$classid][newstempid])
		{
			$select=" selected";
		}
		else
		{
			$select="";
		}
	}
	$newstemp.="<option value=".$nt[tempid].$select.">".$nt[tempname]."</option>";
}
//模板
$votetemp="";
$vtsql=$empire->query("select tempid,tempname from ".GetTemptb("enewsvotetemp")." order by tempid");
while($vtr=$empire->fetch($vtsql))
{
	if($voter[tempid]==$vtr[tempid])
	{
		$select=" selected";
	}
	else
	{
		$select="";
	}
	$votetemp.="<option value='".$vtr[tempid]."'".$select.">".$vtr[tempname]."</option>";
}
//操作的栏目
$fcjsfile='../data/fc/cmsclass.js';
$do_class=GetFcfiletext($fcjsfile);
$do_class=str_replace("<option value='$classid'","<option value='$classid' selected",$do_class);
//表单文件
$modfile="../data/html/".$modid.".php";
//栏目链接
$getcurlr['classid']=$classid;
$classurl=sys_ReturnBqClassname($getcurlr,9);
//当前使用的模板组
$thegid=GetDoTempGid();
//风格
$loginadminstyleid=(int)getcvar('loginadminstyleid');
?>
<html>
<head>
<title><?=$word?></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="adminstyle/<?=$loginadminstyleid?>/adminstyle.css" type="text/css">
<link id="luna-tab-style-sheet" type="text/css" rel="stylesheet" href="adminstyle/<?=$loginadminstyleid?>/tab.winclassic.css" disabled="disabled" /> 
<?=$htmlareacode?>
<!-- the id is not needed. It is used here to be able to change css file at runtime -->
<style type="text/css"> 
   .dynamic-tab-pane-control .tab-page { 
         height:                100px; 
 } 
  .dynamic-tab-pane-control .tab-page .dynamic-tab-pane-control .tab-page { 
         height:                150px; 
 } 
  form { 
         margin:        0; 
         padding:        0; 
 } 
  /* over ride styles from webfxlayout */ 
  .dynamic-tab-pane-control h2 { 
         text-align:        center; 
         width:                auto;
		 height:            20; 
 } 
   .dynamic-tab-pane-control h2 a { 
         display:        inline; 
         width:                auto; 
 } 
  .dynamic-tab-pane-control a:hover { 
         background: transparent; 
 } 
  </style>
 <script type="text/javascript" src="../data/images/tabpane.js"></script> <script type="text/javascript"> 
  function setLinkSrc( sStyle ) { 
         document.getElementById( "luna-tab-style-sheet" ).disabled = sStyle != "luna"; 
  
         //document.documentElement.style.background = "";
         //document.body.style.background = sStyle == "webfx" ? "white" : "ThreeDFace"; 
 } 
function chgBg(obj,color){
 if (document.all || document.getElementById)
   obj.style.backgroundColor=color;
 else if (document.layers)
   obj.bgColor=color;
}
  setLinkSrc( "luna" ); 
</script>
<script>
function dovoteadd(){
	var i;
	var str="";
	var oldi=0;
	var j=0;
	oldi=parseInt(document.add.v_editnum.value);
	for(i=1;i<=document.add.v_vote_num.value;i++)
	{
		j=i+oldi;
		str=str+"<tr><td width='9%' height=20> <div align=center>"+j+"</div></td><td width='65%'> <div align=center><input type=text name=v_votename[] size=30></div></td><td width='26%'> <div align=center><input type=text name=v_votenum[] value=0 size=6></div></td></tr>";
	}
	document.getElementById('addvote').innerHTML="<table width='100%' border=0 cellspacing=1 cellpadding=3>"+str+"</table>";
}
</script>
<script src="editor/setday.js"></script>
<script>
function bs(){
	var f=document.add;
	if(f.title.value.length==0){alert("标题还没写");f.title.focus();return false;}
}
function foreColor(){
  if(!Error())	return;
  var arr = showModalDialog("../data/html/selcolor.html", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0");
  if (arr != null) document.add.titlecolor.value=arr;
  else document.add.titlecolor.focus();
}
function FieldChangeColor(obj){
  if(!Error())	return;
  var arr = showModalDialog("../data/html/selcolor.html", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0");
  if (arr != null) obj.value=arr;
  else obj.focus();
}
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000"<?=$onload?>>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr> 
    <td width="62%" height="25">位置： 
      <?=$url?>
    </td>
    <td width="38%"><div align="right">增加信息： 
        <select name="select" onchange="if(this.options[this.selectedIndex].value!=0){self.location.href='AddNews.php?bclassid=&classid='+this.options[this.selectedIndex].value+'&enews=AddNews';}">
          <option value=0>选择增加信息的栏目</option>
          <?=$do_class?>
        </select>
      </div></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="3" class="tableborder">
  <form name="searchinfo" method="GET" action="ListNews.php">
  <tr>
      <td width="42%">
<select name="dore">
        <option value="1">生成当前栏目</option>
        <option value="2">生成首页</option>
        <option value="3">生成父栏目</option>
        <option value="4">生成当前栏目与父栏目</option>
        <option value="5">生成父栏目与首页</option>
        <option value="6" selected>生成当前栏目、父栏目与首页</option>
      </select> <input type="button" name="Submit12" value="提交" onclick="self.location.href='enews.php?enews=AddInfoToReHtml&classid=<?=$classid?>&dore='+document.searchinfo.dore.value;">
      </td>
      <td width="58%"><div align="right">[<font color="#ffffff"><a href=../../ target=_blank>预览首页</a></font>] 
          [<font color="#ffffff"><a href="<?=$classurl?>" target=_blank>预览栏目</a></font>] 
          [<font color="#ffffff"><a href="file/ListFile.php?type=9&classid=<?=$classid?>">附件管理</a></font>] 
          [<a href="AddClass.php?enews=EditClass&classid=<?=$classid?>">栏目设置</a>] 
          [<a href="enews.php?enews=ReAllNewsJs&from=<?=$phpmyself?>">刷新所有信息JS</a>] 
        </div></td>
  </tr>
</form>
</table><br>
<form name="add" method="post" enctype="multipart/form-data" action="enews.php">
<div class="tab-pane" id="TabPane1"> <script type="text/javascript">
tb1 = new WebFXTabPane( document.getElementById( "TabPane1" ) );
</script>
	<div class="tab-page" id="baseinfo"> 
                    
      <h2 class="tab">&nbsp;<font class=tabcolor>基本属性</font>&nbsp;</h2>
                    <script type="text/javascript">tb1.addTabPage( document.getElementById( "baseinfo" ) );</script>

  <table width="100%" align="center" cellpadding="3" cellspacing="1" class="tableborder">
    <tr class="header"> 
      <td width="16%" height="25">
<div align="left"><?=$word?></div></td>
      <td><input type="submit" name="addnews2" value="提交"> <input type="reset" name="Submit23" value="重置">
        <input type=hidden value=<?=$enews?> name=enews> <input type=hidden value=<?=$classid?> name=classid> 
        <input type=hidden value=<?=$bclassid?> name=bclassid> <input name=id type=hidden value=<?=$id?>> 
        <input type=hidden value="<?=$r[newspath]?>" name=newspath> <input type=hidden value="<?=$r[ztid]?>" name=oldztid> 
        <input type=hidden value="<?=$filepass?>" name=filepass> <input type=hidden value="<?=$r[username]?>" name=username> 
        <input name="filename" type="hidden" value="<?=$r[filename]?>"> 
        <input name="oldfilenameqz" type="hidden" value="<?=$r[filenameqz]?>"> 
        <input name="oldgroupid" type="hidden" value="<?=$r[groupid]?>"> 
        <input name="oldchecked" type="hidden" value="<?=$r[checked]?>"> 
        <input name="oldcheckuser" type="hidden" value="<?=$qfr[checkuser]?>"> 
        <input name="oldnotdocheckuser" type="hidden" value="<?=$qfr[notdocheckuser]?>"> 
        <input name="oldviewcheckuser" type="hidden" value="<?=$qfr[viewcheckuser]?>"> 
        <input name="newstext_url" type="hidden" value="<?=$newstext_url?>"> 
      </td>
    </tr>
  </table>
  <?
@include($modfile);
?>
	</div>
	<div class="tab-page" id="spsetting"> 
                    
      <h2 class="tab">&nbsp;<font class=tabcolor>特殊属性</font>&nbsp;</h2>
                    <script type="text/javascript">tb1.addTabPage( document.getElementById( "spsetting" ) );</script>
<table width=100% align=center cellpadding=3 cellspacing=1 class="tableborder"><tr><td class=header>特殊属性</td></tr><tr>
          <td bgcolor=ffffff> 
		   <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#DBEAF5">
  <tr> 
    <td height="25" bgcolor="#FFFFFF"> 置顶级别: 
      <select name="istop">
        <option value="0"<?=$r[istop]==0?' selected':''?>>0级置顶</option>
        <option value="1"<?=$r[istop]==1?' selected':''?>>1级置顶</option>
        <option value="2"<?=$r[istop]==2?' selected':''?>>2级置顶</option>
        <option value="3"<?=$r[istop]==3?' selected':''?>>3级置顶</option>
        <option value="4"<?=$r[istop]==4?' selected':''?>>4级置顶</option>
        <option value="5"<?=$r[istop]==5?' selected':''?>>5级置顶</option>
        <option value="6"<?=$r[istop]==6?' selected':''?>>6级置顶</option>
      </select>
      内容模板: 
      <select name="newstempid">
        <?=$newstemp?>
      </select> <input type="button" name="Submit62222" value="管理内容模板" onclick="window.open('template/ListNewstemp.php?gid=<?=$thegid?>');"></td>
  </tr>
  <tr> 
    <td height="25" bgcolor="#FFFFFF">权限设置: 
      <select name="fh">
        <option value="0"<?=$r[fh]==0?' selected':''?>>&gt;=</option>
        <option value="1"<?=$r[fh]==1?' selected':''?>>=</option>
      </select> <select name="groupid">
        <option value="0">游客</option>
        <?=$group?>
      </select>
      查看扣除点数: 
      <input name="userfen" type="text" value="<?=$r[userfen]?>" size="6">
      <font color="#333333">(&quot;=&quot;：本级别的用户才能查看[对游客无效])</font></td>
  </tr>
  <tr> 
    <td height="25" bgcolor="#FFFFFF">文件前缀: 
      <input name="filenameqz" type="text" value="<?=stripSlashes($r[filenameqz])?>">
      , 
      <input type=checkbox name=closepl value=1<?=$r[closepl]==1?" checked":""?>>关闭评论</td>
  </tr>
</table>
        
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#DBEAF5">
  <tr> 
    <td>所属专题:</td>
  </tr>
  <tr> 
    <td height="25" bgcolor="#FFFFFF"> 
      <?=$z_class?>
    </td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#DBEAF5">
          <tr> 
            
    <td>签发<font color="#333333">(多个签发人员，请用&quot;,&quot;格开．不想使用签发，请留空) </font></td>
          </tr>
          <tr> 
            <td height="25" bgcolor="#FFFFFF"> <input name="checkuser" type="text" value="<?=stripSlashes($qfr[checkuser])?>" size="66"<?=$checkuserreadonly?>> 
              <?=$changeuser?> 
            </td>
          </tr>
          <tr>
            <td height="25" bgcolor="#FFFFFF"><input name="recheckuser" type="checkbox" value="1">
      重新签发<font color="#333333">（稿件被退下来后重新提交给未签发的人员的操作，如修改签发人员，所有人员需重新签发）</font></td>
          </tr>
        </table>
        
		  </td>
        </tr></table>
	</div>
	<div class="tab-page" id="votesetting"> 
                    
      <h2 class="tab">&nbsp;<font class=tabcolor>投票设置</font>&nbsp;</h2>
                    <script type="text/javascript">tb1.addTabPage( document.getElementById( "votesetting" ) );</script>
	  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
        <tr class="header"> 
          <td height="25" colspan="2">投票设置</td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td width="21%" height="25">主题标题</td>
          <td width="79%" height="25"> <input name="vote_title" type="text" size="60" value="<?=$voter[title]?>"> 
          </td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td height="25" valign="top">投票项目</td>
          <td height="25"> <table width="100%" border="0" cellspacing="1" cellpadding="3">
              <tr> 
                <td> <table width="100%" border="0" cellspacing="1" cellpadding="3">
                    <tr bgcolor="#DBEAF5"> 
                      <td width="9%" height="20"> <div align="center">编号</div></td>
                      <td width="65%"> <div align="center">项目名称</div></td>
                      <td width="26%"> <div align="center">投票数</div></td>
                    </tr>
                  </table>
                  <?php
		if($voter['id']&&$voter[votetext])
		{
			echo"$allvote";
		}
		else
		{
		?>
                  <table width="100%" border="0" cellspacing="1" cellpadding="3">
                    <tr> 
                      <td height="24" width="9%"> <div align="center">1</div></td>
                      <td height="24" width="65%"> <div align="center"> 
                          <input name="vote_name[]" type="text" size="30">
                        </div></td>
                      <td height="24" width="26%"> <div align="center"> 
                          <input name="vote_num[]" type="text" value="0" size="6">
                        </div></td>
                    </tr>
                    <tr> 
                      <td height="24"> <div align="center">2</div></td>
                      <td height="24"> <div align="center"> 
                          <input name="vote_name[]" type="text" size="30">
                        </div></td>
                      <td height="24"> <div align="center"> 
                          <input name="vote_num[]" type="text" value="0" size="6">
                        </div></td>
                    </tr>
                    <tr> 
                      <td height="24"> <div align="center">3</div></td>
                      <td height="24"> <div align="center"> 
                          <input name="vote_name[]" type="text" size="30">
                        </div></td>
                      <td height="24"> <div align="center"> 
                          <input name="vote_num[]" type="text" value="0" size="6">
                        </div></td>
                    </tr>
                    <tr> 
                      <td height="24"> <div align="center">4</div></td>
                      <td height="24"> <div align="center"> 
                          <input name="vote_name[]" type="text" size="30">
                        </div></td>
                      <td height="24"> <div align="center"> 
                          <input name="vote_num[]" type="text" value="0" size="6">
                        </div></td>
                    </tr>
                    <tr> 
                      <td height="24"> <div align="center">5</div></td>
                      <td height="24"> <div align="center"> 
                          <input name="vote_name[]" type="text" size="30">
                        </div></td>
                      <td height="24"> <div align="center"> 
                          <input name="vote_num[]" type="text" value="0" size="6">
                        </div></td>
                    </tr>
                    <tr> 
                      <td height="24"> <div align="center">6</div></td>
                      <td height="24"> <div align="center"> 
                          <input name="vote_name[]" type="text" size="30">
                        </div></td>
                      <td height="24"> <div align="center"> 
                          <input name="vote_num[]" type="text" value="0" size="6">
                        </div></td>
                    </tr>
                    <tr> 
                      <td height="24"> <div align="center">7</div></td>
                      <td height="24"> <div align="center"> 
                          <input name="vote_name[]" type="text" size="30">
                        </div></td>
                      <td height="24"> <div align="center"> 
                          <input name="vote_num[]" type="text" value="0" size="6">
                        </div></td>
                    </tr>
                    <tr> 
                      <td height="24"> <div align="center">8</div></td>
                      <td height="24"> <div align="center"> 
                          <input name="vote_name[]" type="text" size="30">
                        </div></td>
                      <td height="24"> <div align="center"> 
                          <input name="vote_num[]" type="text" value="0" size="6">
                        </div></td>
                    </tr>
                  </table>
                  <?php
			  }
			  ?>
                </td>
              </tr>
              <tr> 
                <td>投票扩展数量: 
                  <input name="v_vote_num" type="text" value="1" size="6"> <input type="button" name="Submit52" value="输出地址" onclick="javascript:dovoteadd();"> 
                  <input name="v_editnum" type="hidden" value="<?=$voteeditnum?>"> 
                </td>
              </tr>
              <tr> 
                <td id="addvote"></td>
              </tr>
            </table></td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td height="25">投票类型</td>
          <td height="25"><input name="vote_class" type="radio" value="0"<?=$voter['voteclass']==0?' checked':''?>>
            单选 
            <input type="radio" name="vote_class" value="1"<?=$voter['voteclass']==1?' checked':''?>>
            多选</td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td height="25">限制IP</td>
          <td height="25"><input type="radio" name="dovote_ip" value="0"<?=$voter['doip']==0?' checked':''?>>
            不限制 
            <input name="dovote_ip" type="radio" value="1"<?=$voter['doip']==1?' checked':''?>>
            限制(限制后同一IP只能投一次票)</td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td height="25">过期时间</td>
          <td height="25"> <input name="vote_olddotime" type=hidden value="<?=$voter[dotime]?>"> 
            <input name="vote_dotime" type="text" value="<?=$voter[dotime]?>" size="12" onClick="setday(this)">
            (超过此期限,将不能投票,0000-00-00为不限制)</td>
        </tr>
		<tr bgcolor="#FFFFFF"> 
      	  <td height="25">查看投票窗口</td>
      	<td height="25">宽度: 
        <input name="vote_width" type="text" value="<?=$voter[width]?>" size="6">
        高度: 
        <input name="vote_height" type="text" value="<?=$voter[height]?>" size="6"></td>
    	</tr>
        <tr bgcolor="#FFFFFF"> 
          <td height="25">选择模板</td>
          <td height="25"><select name="vote_tempid">
              <?=$votetemp?>
            </select> <input type="button" name="Submit62223" value="管理投票模板" onclick="window.open('template/ListVotetemp.php?gid=<?=$thegid?>');"> 
          </td>
        </tr>
      </table>
	</div>
</div>
  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
    <tr>
      <td width="16%">&nbsp;</td>
      <td><input type="submit" name="addnews" value=" 提 交 "> &nbsp;&nbsp;&nbsp;<input type="reset" name="Submit2" value="重置"></td>
    </tr>
  </table>
</form>
</body>
</html>
<?php
db_close();
$empire=null;
?>