<?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,"template");
$gid=(int)$_GET['gid'];
$gname=CheckTempGroup($gid);
$urlgname=$gname."&nbsp;->&nbsp;";
$cid=$_GET['cid'];
$enews=$_GET['enews'];
$r[showdate]="[m-d]";
$url=$urlgname."<a href=ListJstemp.php?gid=$gid>管理JS模板</a>&nbsp;->&nbsp;增加JS模板";
//修改
if($enews=="EditJstemp")
{
	$tempid=(int)$_GET['tempid'];
	$r=$empire->fetch1("select tempid,tempname,temptext,classid,showdate from ".GetDoTemptb("enewsjstemp",$gid)." where tempid=$tempid");
	$url=$urlgname."<a href=ListJstemp.php?gid=$gid>管理JS模板</a>&nbsp;->&nbsp;修改JS模板".$r[tempname];
}
//分类
$cstr="";
$csql=$empire->query("select classid,classname from {$dbtbpre}enewsjstempclass 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>增加JS模板</title>
<link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
</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="ListJstemp.php">
  <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
    <tr class="header"> 
      <td height="25" colspan="2">增加JS模板 
        <input name="enews" type="hidden" id="enews" value="<?=$enews?>"> <input name="tempid" type="hidden" id="tempid" value="<?=$tempid?>"> 
        <input name="cid" type="hidden" id="cid" value="<?=$cid?>">
        <input name="gid" type="hidden" id="gid" value="<?=$gid?>"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td width="19%" height="25">模板名称</td>
      <td width="81%" height="25"> <input name="tempname" type="text" id="tempname" value="<?=$r[tempname]?>"> 
      </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('JsTempClass.php');"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25">时间显示格式</td>
      <td height="25"><input name="showdate" type="text" id="showdate" value="<?=$r[showdate]?>" size="20"> 
        <select name="select4" onchange="document.form1.showdate.value=this.value">
          <option value="Y-m-d H:i:s">选择</option>
          <option value="Y-m-d H:i:s">2005-01-27 11:04:27</option>
          <option value="Y-m-d">2005-01-27</option>
          <option value="m-d">01-27</option>
        </select></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25">模板内容</td>
      <td height="25"><textarea name="temptext" cols="90" rows="23" id="temptext"><?=htmlspecialchars(stripSlashes($r[temptext]))?></textarea></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25">&nbsp;</td>
      <td height="25"><table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
          <tr> 
            <td width="50%" height="23">标题: 
              <input name="textfield" type="text" value="[!--title--]"></td>
            <td height="23">标题链接: 
              <input name="textfield2" type="text" value="[!--titleurl--]"></td>
          </tr>
          <tr> 
            <td height="23">作者: 
              <input name="textfield3" type="text" value="[!--writer--]"></td>
            <td height="23">发布时间: 
              <input name="textfield4" type="text" value="[!--newstime--]"></td>
          </tr>
          <tr> 
            <td height="23"> <p>信息ID: 
                <input name="textfield6" type="text" value="[!--id--]">
              </p></td>
            <td height="23">栏目ID: 
              <input name="textfield5" type="text" value="[!--classid--]"></td>
          </tr>
          <tr> 
            <td height="23">栏目名称: 
              <input name="textfield7" type="text" value="[!--classname--]"></td>
            <td height="23">栏目链接: 
              <input name="textfield8" type="text" value="[!--classurl--]"></td>
          </tr>
          <tr>
            <td height="23">标题alt: 
              <input name="textfield9" type="text" value="[!--oldtitle--]"></td>
            <td height="23">标题图片: 
              <input name="textfield22" type="text" value="[!--titlepic--]"></td>
          </tr>
        </table></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">格式:列表头[!--empirenews.listtemp--]列表内容[!--empirenews.listtemp--]列表尾</td>
    </tr>
  </table>
</form>
</body>
</html>
