<?php
require("../class/connect.php");
include("../class/db_sql.php");
include("../class/config.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);
//验证权限
CheckLevel($logininid,$loginin,$classid,"zt");
$enews=$_GET['enews'];
$url="<a href=ListZt.php>管理专题</a>&nbsp;->&nbsp;增加专题";
//初使化数据
$r[reorderf]="newstime";
$r[reorder]="DESC";
$r[maxnum]=0;
$r[ztnum]=25;
$r[zttype]=".html";
$r[newline]=10;
$r[newshowdate]="";
$r[newstrlen]=26;
$r[hotline]=10;
$r[hotshowdate]="";
$r[hotstrlen]=26;
$r[goodline]=10;
$r[goodshowdate]="";
$r[goodstrlen]=26;
$r[hotplline]=10;
$r[hotplstrlen]=26;
$r[firstline]=10;
$r[firststrlen]=26;
$hotplshowdate="";
$firstshowdate="";
$islist=" checked";
//修改专题
if($enews=="EditZt")
{
	$ztid=(int)$_GET['ztid'];
	$r=$empire->fetch1("select * from {$dbtbpre}enewszt where ztid='$ztid'");
	$url="<a href=ListZt.php>管理专题</a>&nbsp;->&nbsp;修改专题：".$r[ztname];
	$indextext=htmlspecialchars($r[indextext]);
	$islist="";
	if($r[islist])
	{$islist=" checked";}
	if($r[newshowdate])
	{$newshowdate=" checked";}
	if($r[hotshowdate])
	{$hotshowdate=" checked";}
	if($r[goodshowdate])
	{$goodshowdate=" checked";}
	if($r[hotplshowdate])
	{$hotplshowdate=" checked";}
	if($r[firstshowdate])
	{$firstshowdate=" checked";}
}
//列表模板
$msql=$empire->query("select mid,mname from {$dbtbpre}enewsmod order by mid");
while($mr=$empire->fetch($msql))
{
	$listtemp_options.="<option value=0 style=background-color:99C4E3>".$mr[mname]."</option>";
	$l_sql=$empire->query("select tempid,tempname from ".GetTemptb("enewslisttemp")." where modid='$mr[mid]'");
	while($l_r=$empire->fetch($l_sql))
	{
		if($l_r[tempid]==$r[listtempid])
		{$l_d=" selected";}
		else
		{$l_d="";}
		$listtemp_options.="<option value=".$l_r[tempid].$l_d."> |-".$l_r[tempname]."</option>";
	}
}
//栏目
$options=ShowClass_AddClass("",$r[classid],0,"|-",0,0);
//js模板
$jstempsql=$empire->query("select tempid,tempname from ".GetTemptb("enewsjstemp")." order by tempid");
while($jstempr=$empire->fetch($jstempsql))
{
	$select="";
	if($r[jstempid]==$jstempr[tempid])
	{
		$select=" selected";
	}
	$jstemp.="<option value='".$jstempr[tempid]."'".$select.">".$jstempr[tempname]."</option>";
}
//分类
$zcstr="";
$zcsql=$empire->query("select classid,classname from {$dbtbpre}enewsztclass order by classid");
while($zcr=$empire->fetch($zcsql))
{
	$select="";
	if($zcr[classid]==$r[zcid])
	{
		$select=" selected";
	}
	$zcstr.="<option value='".$zcr[classid]."'".$select.">".$zcr[classname]."</option>";
}
db_close();
$empire=null;
//风格
$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">
<link id="luna-tab-style-sheet" type="text/css" rel="stylesheet" href="adminstyle/<?=$loginadminstyleid?>/tab.winclassic.css" disabled="disabled" /> 
<!-- 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" ); 

//检查
function CheckForm(obj)
{
if(obj.ztname.value=='')
{
alert("请输入专题名称");
return false;
}
if(obj.ztpath.value=="")
{
alert("请输入专题目录");
return false;
}
if(obj.listtempid.value==0)
{
alert("请选择列表模板");
return false;
}
}

  </script>

</head>

<body>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr>
    <td height="25">位置： 
      <?=$url?>
    </td>
  </tr>
</table>
<form name="form1" method="post" action="enews.php" onsubmit="return CheckForm(document.form1);">
<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%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
        <tr class="header"> 
          <td height="25" colspan="2">增加专题 
            <input type=hidden name=enews value=<?=$enews?>> </td>
        </tr>
        <tr> 
          <td width="24%" height="25" bgcolor="#FFFFFF">专题名：</td>
          <td width="76%" height="25" bgcolor="#FFFFFF"> <input name="ztname" type="text" id="ztname" value="<?=$r[ztname]?>"> 
            <?
	  if($enews=="AddZt")
	  {
	  ?>
            <input type="button" name="Submit5" value="生成拼音目录" onclick="window.open('GetPinyin.php?hz='+document.form1.ztname.value+'&returnform=opener.document.form1.ztpath.value','','width=160,height=100');"> 
            <?
	  }
	  ?>
            <input name="ztid" type="hidden" id="ztid" value="<?=$ztid?>"> <input name="oldztid" type="hidden" id="oldztid" value="<?=$ztid?>"> 
          </td>
        </tr>
        <tr> 
          <td height="25" bgcolor="#FFFFFF">专题存放文件夹：</td>
          <td bgcolor="#FFFFFF">/s/ 
            <input name="ztpath" type="text" id="ztpath" value="<?=$r[ztpath]?>" size="15"> 
            <input type="button" name="Submit3" value="检测目录" onclick=javascript:window.open("enews.php?enews=CheckZtPath&classpath="+document.form1.ztpath.value,"","width=100,height=100,top=250,left=450");> 
            <input name="oldztpath" type="hidden" id="oldztpath" value="<?=$r[ztpath]?>"> 
          </td>
        </tr>
        <tr> 
          <td height="25" bgcolor="#FFFFFF">专题文件扩展名：</td>
          <td bgcolor="#FFFFFF"> <input name="zttype" type="text" id="zttype" value="<?=$r[zttype]?>" size="10"> 
            <select name="select" onchange="document.form1.zttype.value=this.value">
              <option value=".html">扩展名</option>
              <option value=".html">.html</option>
              <option value=".htm">.htm</option>
              <option value=".php">.php</option>
              <option value=".shtml">.shtml</option>
            </select>
            (如.html,.xml,.htm等)</td>
        </tr>
        <tr> 
          <td height="25" bgcolor="#FFFFFF">专题分类：</td>
          <td bgcolor="#FFFFFF"><select name="zcid" id="zcid">
              <option value="0">不隶属于任何分类</option>
              <?=$zcstr?>
            </select> <input type="button" name="Submit6222322" value="管理分类" onclick="window.open('ListZtClass.php');"></td>
        </tr>
        <tr> 
          <td height="25" bgcolor="#FFFFFF">专题访问域名：</td>
          <td bgcolor="#FFFFFF"> <input name="zturl" type="text" id="zturl" value="<?=$r[zturl]?>" size="38">
            (如没有绑定，请留空.后面无需加&quot;/&quot;)</td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td height="25">专题缩略图：</td>
          <td><input name="ztimg" type="text" id="ztimg" value="<?=$r[ztimg]?>" size="52"> 
            <a onclick="window.open('editor/file.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=1&classid=&doing=2&field=ztimg','','width=700,height=550,scrollbars=yes');" title="选择已上传的图片"><img src="../data/images/changeimg.gif" width="22" height="22" border="0" align="absbottom"></a></td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td height="25" valign="top">网页关键字：</td>
          <td><input name="ztpagekey" type="text" id="ztpagekey" value="<?=$r[ztpagekey]?>" size="52"></td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td height="25" valign="top">专题简介：</td>
          <td><textarea name="intro" cols="70" rows="8" id="intro"><?=stripSlashes($r[intro])?></textarea></td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td height="25" valign="top">是否显示到导航：</td>
          <td><input type="radio" name="showzt" value="0"<?=$r[showzt]==0?' checked':''?>>
            是 
            <input type="radio" name="showzt" value="1"<?=$r[showzt]==1?' checked':''?>>
            否<font color="#666666">（如：专题导航标签）</font></td>
        </tr>
      </table>
	</div>
	<div class="tab-page" id="changevar">             
      <h2 class="tab">&nbsp;<font class=tabcolor>选择设置</font>&nbsp;</h2>
                    <script type="text/javascript">tb1.addTabPage( document.getElementById( "changevar" ) );</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> 
      <td height="25" bgcolor="#FFFFFF">页面是否列表式：</td>
      <td height="25" bgcolor="#FFFFFF"><input name="islist" type="checkbox" id="islist" value="1"<?=$islist?>>
        是 (选择此项,页面式设置无效)</td>
    </tr>
    <tr> 
      <td height="25" bgcolor="#FFFFFF">列表式页面排序方式：</td>
      <td height="25" bgcolor="#FFFFFF">按字段： 
        <input name="reorderf" type="text" id="reorderf" value="<?=$r[reorderf]?>" size="16"> 
        <select name="select5" onchange="document.form1.reorderf.value=this.value">
          <option>选择</option>
          <option value="newstime">发布时间</option>
          <option value="id">ID</option>
          <option value="onclick">点击率</option>
          <option value="totaldown">下载数</option>
          <option value="plnum">评论数</option>
        </select>
        ，排列方式： 
        <select name="reorder" id="select">
          <option value="DESC"<?=$r[reorder]=="DESC"?' selected':''?>>倒序排序</option>
          <option value="ASC"<?=$r[reorder]=="ASC"?' selected':''?>>顺序排序</option>
        </select></td>
    </tr>
    <tr> 
      <td height="25" bgcolor="#FFFFFF">显示总条数：</td>
      <td height="25" bgcolor="#FFFFFF"> <input name="maxnum" type="text" id="ztnum" value="<?=$r[maxnum]?>" size="6">
        条 (0为显示所有记录)</td>
    </tr>
    <tr> 
      <td height="25" bgcolor="#FFFFFF">每页显示条数：</td>
      <td height="25" bgcolor="#FFFFFF"> <input name="ztnum" type="text" id="ztnum2" value="<?=$r[ztnum]?>" size="6">
        条</td>
    </tr>
    <tr> 
      <td height="25" bgcolor="#FFFFFF"><strong>所用列表模板：</strong></td>
      <td height="25" bgcolor="#FFFFFF"> <select name="listtempid" id="listtempid">
          <?=$listtemp_options?>
        </select>
            <input type="button" name="Submit622" value="管理列表模板" onclick="window.open('template/ListListtemp.php');">
            *</td>
    </tr>
    <tr> 
      <td height="25" bgcolor="#FFFFFF">隶属信息栏目：</td>
      <td height="25" bgcolor="#FFFFFF"> <select name="classid" id="classid">
          <option value="0">隶属于所有栏目</option>
          <?=$options?>
        </select>
            <input type="button" name="Submit622232" value="管理栏目" onclick="window.open('ListClass.php');">
            (选择父栏目，将应用于子栏目) </td>
    </tr>
    <tr class="header"> 
      <td height="25" colspan="2">页面式设置</td>
    </tr>
    <tr> 
      <td height="25" colspan="2" bgcolor="#FFFFFF"><div align="center">专题页面内容[标签同首页的标签]</div></td>
    </tr>
    <tr> 
      <td height="25" colspan="2" bgcolor="#FFFFFF"><div align="center"> 
          <textarea name="indextext" cols="96" rows="23" id="indextext"><?=stripSlashes($indextext)?></textarea>
        </div></td>
    </tr>
    <tr> 
      <td height="25" colspan="2" bgcolor="#FFFFFF"><div align="center">说明：栏目导行标签:[!--newsnav--]，调用标签介绍请点 
          <input type="button" name="Submit32" value="这里" onclick="window.open('template/EnewsBq.php','','width=600,height=500,scrollbars=yes');">
          或JS调用点 
          <input type="button" name="Submit322" value="这里" onclick="window.open('ListClass.php','','width=800,height=600,scrollbars=yes');">
          。</div></td>
    </tr>
	</table>
	</div>
	<div class="tab-page" id="setjs"> 
      <h2 class="tab">&nbsp;<font class="tabcolor">JS调用设置</font>&nbsp;</h2>
                    <script type="text/javascript">tb1.addTabPage( document.getElementById( "setjs" ) );</script>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
    <tr class="header"> 
      <td height="25" colspan="2">JS相关设置</td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25">所用JS模板：</td>
      <td><select name="jstempid" id="jstempid">
          <?=$jstemp?>
        </select>
            <input type="button" name="Submit62223" value="管理JS模板" onclick="window.open('template/ListJstemp.php');"></td>
    </tr>
    <tr> 
      <td height="25" bgcolor="#FFFFFF">最新专题JS调用：</td>
      <td height="25" bgcolor="#FFFFFF">调用 
        <input name="newline" type="text" id="newline" value="<?=$r[newline]?>" size="6">
        条记录,标题截取 
        <input name="newstrlen" type="text" id="newstrlen" value="<?=$r[newstrlen]?>" size="6">
        个字节, 
        <input name="newshowdate" type="checkbox" id="newshowdate" value="1"<?=$newshowdate?>>
        显示日期</td>
    </tr>
    <tr> 
      <td height="25" bgcolor="#FFFFFF">热门专题JS调用：</td>
      <td height="25" bgcolor="#FFFFFF">调用 
        <input name="hotline" type="text" id="hotline" value="<?=$r[hotline]?>" size="6">
        条记录,标题截取 
        <input name="hotstrlen" type="text" id="hotstrlen" value="<?=$r[hotstrlen]?>" size="6">
        个字节, 
        <input name="hotshowdate" type="checkbox" id="hotshowdate" value="1"<?=$hotshowdate?>>
        显示日期</td>
    </tr>
    <tr> 
      <td height="25" bgcolor="#FFFFFF">推荐专题JS调用：</td>
      <td height="25" bgcolor="#FFFFFF">调用 
        <input name="goodline" type="text" id="goodline" value="<?=$r[goodline]?>" size="6">
        条记录,标题截取 
        <input name="goodstrlen" type="text" id="goodstrlen" value="<?=$r[goodstrlen]?>" size="6">
        个字节, 
        <input name="goodshowdate" type="checkbox" id="goodshowdate" value="1"<?=$goodshowdate?>>
        显示日期</td>
    </tr>
    <tr> 
      <td height="25" bgcolor="#FFFFFF">热门评论信息js设置：</td>
      <td bgcolor="#FFFFFF">调用 
        <input name="hotplline" type="text" id="hotplline" value="<?=$r[hotplline]?>" size="6">
        条记录,标题截取 
        <input name="hotplstrlen" type="text" id="hotplstrlen" value="<?=$r[hotplstrlen]?>" size="6">
        个字节, 
        <input name="hotplshowdate" type="checkbox" id="hotplshowdate" value="1"<?=$hotplshowdate?>>
        显示日期</td>
    </tr>
    <tr> 
      <td height="25" bgcolor="#FFFFFF">头条信息js设置：</td>
      <td bgcolor="#FFFFFF">调用 
        <input name="firstline" type="text" id="firstline" value="<?=$r[firstline]?>" size="6">
        条记录,标题截取 
        <input name="firststrlen" type="text" id="firststrlen" value="<?=$r[firststrlen]?>" size="6">
        个字节, 
        <input name="firstshowdate" type="checkbox" id="firstshowdate" value="1"<?=$firstshowdate?>>
        显示日期</td>
    </tr>
	</table>
	</div>
</div>
  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
    <tr> 
      <td height="25" bgcolor="#FFFFFF"> <div align="center">
          <input type="submit" name="Submit" value="提交">
          &nbsp;&nbsp;<input type="reset" name="Submit2" value="重置">
        </div></td>
    </tr>
  </table>
</form>
</body>
</html>
