<?php
define('EmpireCMSAdmin','1');
require("../class/connect.php");
require("../class/db_sql.php");
require("../class/functions.php");
require("../class/dpfun.php");
require("../data/dbcache/class.php");
$link=db_connect();
$empire=new mysqlquery();
//验证用户
$lur=is_login();
$logininid=$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=$lur['groupid'];
$loginadminstyleid=$lur['adminstyleid'];

$enews=$_GET['enews'];
$wid=(int)$_GET[wid];

//验证权限
//$doselfinfo=CheckLevel($logininid,$loginin,$classid,"news");

//初始化数据
$r=array();//初始化数据
$word='增加作者';

//导航
$url='<a href="ListWriter.php">作者管理</a>&nbsp;>&nbsp;增加作者';

if($enews=="EditWriter")
{
	$url='<a href="ListWriter.php">作者管理</a>&nbsp;>&nbsp;修改作者';
	$word='修改作者';
	$r=$empire->fetch1("select * from {$dbtbpre}enewswriter where wid=$wid limit 1");
	if($r[wid]!=$wid){
		printerror('ErrorUrl','history.go(-1)');
	}
	
}


//----------- 特殊模型初始化 -----------
include('ecmseditor/infoeditor/fckeditor.php');



$writer_sql=$empire->query("select classid,classname from {$dbtbpre}enewswriterclass");
while($w_r=$empire->fetch($writer_sql))
{
	$se='';
	if($w_r[classid]==$r[classid]){$se=' selected';}
	$w_class.="<option value='".$w_r[classid]."' ".$se.">".$w_r[classname]."</option>";
}

$lt_sql3=$empire->query("select tempid,tempname from ".GetTemptb("enewslisttemp")." where classid=2");
while($lt_r3=$empire->fetch($lt_sql3))
{
		if($lt_r3[tempid]==$r[wtid]){$lt_d3=" selected";}
		else{$lt_d3="";}

		$listtemp3.="<option value=".$lt_r3[tempid].$lt_d3."> |-".$lt_r3[tempname]."</option>";
}

//当前使用的模板组
$thegid=GetDoTempGid();
$phpmyself=urlencode(eReturnSelfPage(1));
//返回头条和推荐级别名称
$ftnr=ReturnFirsttitleNameList($r['firsttitle'],$r['isgood']);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><?=$word?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<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" /> 
<!-- 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 { 
          width:                100%;
 } 
  .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 { 
         font-size:12px;
		 font-weight:normal;
		 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=vote_name[] size=30></div></td><td width='26%'> <div align=center><input type=text name=vote_num[] value=0 size=6></div></td></tr>";
	}
	document.getElementById('addvote').innerHTML="<table width='100%' border=0 cellspacing=1 cellpadding=3>"+str+"</table>";
}

function doSpChangeFile(name,url,filesize,filetype,idvar){
	document.getElementById(idvar).value=url;
	if(document.add.filetype!=null)
	{
		if(document.add.filetype.value=='')
		{
			document.add.filetype.value=filetype;
		}
	}
	if(document.add.filesize!=null)
	{
		if(document.add.filesize.value=='')
		{
			document.add.filesize.value=filesize;
		}
	}
}

function SpOpenChFile(type,field){
	window.open('ecmseditor/FileMain.php?classid=<?=$classid?>&infoid=<?=$id?><?=$addecmscheck?>&filepass=<?=$filepass?>&type='+type+'&sinfo=1&tranfrom=2&field='+field,'','width=700,height=550,scrollbars=yes');
}
</script>
<script src="ecmseditor/fieldfile/setday.js"></script>
<script src="../data/html/postinfo.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="document.add.title.focus();">
<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">
      </div></td>
  </tr>
</table>
<form name="add" method="post" enctype="multipart/form-data" action="ListWriter.php" onsubmit="return EmpireCMSInfoPostFun(document.add,'<?=$modid?>');">
<div class="tab-pane" id="TabPane1">
   

		<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="<?=$r[wid]?>" name=wid>
               </td>
			</tr>
		</table>

	  <table width='100%' align=center cellpadding=3 cellspacing=1 bgcolor='#DBEAF5'>
		<tr>
		  <td width='16%' height=25 bgcolor='ffffff'>作者分类</td>
		  <td bgcolor='ffffff'>
			<select name="classid">
              <option value=0>选择分类</option>
		      <?=$w_class?>
            </select>
			<a href="ListWriterClass.php">分类管理</a>
		  </td>
		</tr>
		<tr>
		  <td width='16%' height=25 bgcolor='ffffff'>作者名称</td>
		  <td bgcolor='ffffff'>
			<input type=text name=wname value="<?=$r[wname]?>" size="30">
		  </td>
		</tr>
		<tr>
		  <td width='16%' height=25 bgcolor='ffffff'>作者等级</td>
		  <td bgcolor='ffffff'>
		    <input type=text name=isgood value="<?=$r[isgood]?>" size="10"> (范围0～255，数字越大，排名越前)
		  </td>
		</tr>
		<tr> 
          <td height="25" bgcolor="#FFFFFF">文集模板</td>
		  <td bgcolor='ffffff'>
		    <select name="wtid" id="wtid">
			    <option value=0 style='background:#99C4E3'>默认模板</option>
                  <?=$listtemp3?>
            </select>
		  </td>
          </td>
        </tr>
		<tr>
		   <td height=25 colspan=2 bgcolor='ffffff'><div align=left>作者简介</div></td>
		</tr>
	 </table>

	<div style='background-color:#D0D0D0'>
	    <?=ECMS_ShowEditorVar("wintro",$ecmsfirstpost==1?"":stripSlashes($r[wintro]),"BookData","","300","100%")?>
	</div>
  </div>


  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
    <tr>
      <td width="16%">&nbsp;</td>
      <td><input type="submit" name="submit" value=" 提 交 "> &nbsp;&nbsp;&nbsp;<input type="reset" name="Submit2" value="重置"></td>
    </tr>
  </table>
</form>
<?=$copyclassidshowiframe?>
</body>
</html>
<?php
db_close();
$empire=null;
?>