<?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');
$editor=1;
is_login($logininid,$loginin,$loginrnd);
//验证权限
CheckLevel($logininid,$loginin,$classid,"userpage");
$cid=$_GET['cid'];
$enews=$_GET['enews'];
$url="<a href=ListPage.php>管理自定义页面</a>&nbsp;->&nbsp;增加自定义页面";
//修改
if($enews=="EditUserpage")
{
	$id=(int)$_GET['id'];
	$r=$empire->fetch1("select id,title,path,pagetext,classid,pagetitle,pagekeywords,pagedescription from {$dbtbpre}enewspage where id='$id'");
	$url="<a href=ListPage.php>管理自定义页面</a>&nbsp;->&nbsp;修改自定义页面：<b>".$r[title]."</b>";
}
//分类
$cstr="";
$csql=$empire->query("select classid,classname from {$dbtbpre}enewspageclass order by classid");
while($cr=$empire->fetch($csql))
{
	$select="";
	if($cr[classid]==$r[classid])
	{
		$select=" selected";
	}
	$cstr.="<option value='".$cr[classid]."'".$select.">".$cr[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">
<script>
function ReturnHtml(html)
{
document.form1.pagetext.value=html;
}
</script>
</head>

<body>
<table width="98%%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr>
    <td height="25">位置：<?=$url?></td>
  </tr>
</table>

<form name="form1" method="post" action="../enews.php">
  <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
    <tr class="header"> 
      <td height="25" colspan="2">增加用户自定义页面 
        <input name="enews" type="hidden" id="enews" value="<?=$enews?>"> <input name="id" type="hidden" id="id" value="<?=$id?>"> 
        <input name="oldpath" type="hidden" id="oldpath" value="<?=$r[path]?>"> 
        <input name="cid" type="hidden" id="cid" value="<?=$cid?>"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td width="19%" height="25">页面名称</td>
      <td width="81%" height="25"> <input name="title" type="text" id="title" value="<?=$r[title]?>">
        (如：联系我们)</td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25">文件名</td>
      <td height="25"><input name="path" type="text" id="path" value="<?=$r[path]?>">
        (从后台地址算起，如：../../about.html，放于根目录)</td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25">所属分类</td>
      <td height="25"><select name="classid" id="classid">
          <option value="0">不隶属于任何类别</option>
          <?=$cstr?>
        </select>
        <input type="button" name="Submit6222322" value="管理分类" onclick="window.open('PageClass.php');"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" valign="top">页面内容<br> <br> <br> <input type="button" name="Submit3" value="页面在线编辑" onclick="window.open('editor.php?getvar=opener.document.form1.pagetext.value&returnvar=opener.document.form1.pagetext.value&fun=ReturnHtml','edittemp','width=880,height=600');"> 
      </td>
      <td height="25"><textarea name="pagetext" cols="90" rows="23" id="pagetext"><?=htmlspecialchars(stripSlashes($r[pagetext]))?></textarea></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25">网页标题</td>
      <td height="25"><input name="pagetitle" type="text" id="pagetitle" value="<?=htmlspecialchars(stripSlashes($r[pagetitle]))?>" size="60"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25">网页关键词</td>
      <td height="25"><input name="pagekeywords" type="text" id="pagekeywords" value="<?=htmlspecialchars(stripSlashes($r[pagekeywords]))?>" size="60"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25">网页描述</td>
      <td height="25"><input name="pagedescription" type="text" id="pagedescription" value="<?=htmlspecialchars(stripSlashes($r[pagedescription]))?>" size="60"></td>
    </tr>
    <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>
    <tr bgcolor="#FFFFFF">
      <td height="25">标签说明：</td>
      <td height="25"><table width="100%" border="0" cellpadding="3" cellspacing="1">
          <tr>
            <td>网页标题: 
              <input name="textfield" type="text" value="[!--pagetitle--]"></td>
            <td>网页关键词: 
              <input name="textfield2" type="text" value="[!--pagekeywords--]"></td>
          </tr>
          <tr>
            <td>网页描述: 
              <input name="textfield3" type="text" value="[!--pagedescription--]"></td>
            <td>&nbsp;</td>
          </tr>
        </table></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25">&nbsp;</td>
      <td height="25">说明：具体标签介绍请点 
        <input type="button" name="Submit32" value="这里" onclick="window.open('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');">
        。</td>
    </tr>
  </table>
</form>
</body>
</html>
