<%@ Language=VBScript%>
<!-- #include file="../dsn.asp" -->
<!-- #include file="../links.asp" -->
<%
Response.Buffer=true
Response.Expires=0
%>
<%
pid=Request.QueryString("pid")
ppid=Request.QueryString("ppid")
htmlname=linkxy&"?pid="&pid&"&ppid="&ppid
backhtml=linkadmin&"?pid="&pid&"&ppid="&ppid
creadate=now()
set cn=Server.CreateObject("ADODB.Connection")
set rs1=Server.CreateObject("ADODB.Recordset")
cn.Open mycnstr
if pid="" then
	pid=0
else
	pid=cint(pid)
end if	
if pid<>0 then 
	tabname="classes"
	newid=pid
else
	tabname="scool"
	newid=ppid
end if	

if Request.ServerVariables("REQUEST_METHOD")="POST" then
				body=Request.Form("content")
				sqltext2="select * from "+tabname+" where id="&newid
				rs1.Open sqltext2,cn,1,2
				rs1("body")=body	
				rs1("creatdate")=creadate		
				rs1.Update 
				rs1.Close 
				editok=1
end if
if pid=1 then
		pic=1
	else
		pic=0
end if
	sqltext="select * from scool where id="&ppid
	rs1.Open sqltext,cn,1,1
	scoolname=rs1("title")
	rs1.Close 
	if pid<>0 then	
		sqltext1="select * from classes where id="&pid
		rs1.Open sqltext1,cn,1,1
		classname=rs1("title")
		rs1.Close
	else
		classname="序言"	 
	end if
	sqltext="select * from "+tabname+" where id="&newid
	rs1.Open sqltext,cn,1,1
	if not rs1.EOF then
		creadate=rs1("creatdate")
		body=rs1("body")
		if pic=1 then
				picflag=rs1("picflag1")
				picname=rs1("picname1")
			else
				picflag=rs1("picflag")
				picname=rs1("picname")
		end if			
	end if
if right(picname,3)="swf" then
		fileflag=1
	else
		fileflag=0
end if	
%>
<html>
<head>
<title>基本资料</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {font-size: 12px; color: #000000; font-family: 宋体}
td {font-size: 12px; color: #000000; font-family: 宋体;}
.t1 {font:12px 宋体;color=000000} 
.t2 {font:12px 宋体;color:ffffff} 
.t5 {font:12px 宋体;color:ff6600} 

.bt1 {font:14px 宋体;color=000000} 
.bt2 {font:14px 宋体;color:ffffff} 

A:link {color: #000066}
A:visited {color: #000066}
A:hover {color: #ff0000}

A.r1:link {font-size:12px;text-decoration:underline;color:#000000;}
A.r1:visited {font-size:12px;text-decoration:underline;color:#000000;}
A.r1:hover {font-size:12px;text-decoration:underline;color:#ff6600;}

A.r2:link {font-size:12px;text-decoration:underline;color:#ffffff;}
A.r2:visited {font-size:12px;text-decoration:underline;color:#ffffff;}
A.r2:hover {font-size:12px;text-decoration:underline;color:#ff6600;}
-->
</style>
</head>

<body bgcolor=#ffffff topmargin=10>
<form action="<%=htmlname%>" method=post name=editform>
 
 <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr><td>
			<font class=t5>当前位置:<%=scoolname%>→　<%=classname%></font> 
		</td>
	</td></tr>
	<tr><td><hr size=1></td></tr>
	<tr bgcolor="666690"><td height=20><font class=t2>具体内容<%if editok=1 then Response.Write ("&nbsp;&nbsp;&nbsp;&nbsp;<font color=ffff99>(提交成功)</font>")%></font><br>
	</td></tr>
	<tr><td height=5></td></tr>
 </table>
 <table width="100%" border="0" cellspacing="1" cellpadding="0" align="center">
	<tr><td width=70 align=right>&nbsp;更新时间：</td><td align=left><font color=000000><%=creadate%></font></td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td width=70 align=right></td>
		<td>
			<img src="images\bold.gif" onclick="format('bold')" style="cursor:hand;" title="粗体">
			<img src="images\italicize.gif" onclick="format('italic')" style="cursor:hand;" title="斜体">
			<img src="images\underline.gif"  onclick="format('underline')" style="cursor:hand;" title="下划线">
			<img src="images\center.gif"  onclick="format('center')" style="cursor:hand;" title="居中">
			<img src="images\space.gif"  onclick="format('space')" style="cursor:hand;" title="空格">
			<img src="images\url1.gif"  onclick="formaturl('url')" style="cursor:hand;" title="超级链接">
		<select name=font style="width:120px" onchange="formatfont(this.options[this.selectedIndex].value)">
			<option value="宋体" selected>宋体
			<option value="楷体_gb2312">楷体GB2312
			<option value="黑体">黑体
			<option value="隶书">隶书
			<option value="Arial">Arial
			<option value="Arial Black">Arial Black
			<option value="Impact">Impact
			<option value="Tahoma">Tahoma
			<option value="Times New Roman">Times New Roman
			<option value="Verdana">Verdana
		</select>				
		<select name=fontsize style="width:50px" onchange="formatsize(this.options[this.selectedIndex].value)">
			<option value="6" >一号
			<option value="5">二号
			<option value="4">三号
			<option value="3">四号
			<option value="2"selected>五号
		</select>				
		<select name=color style="width:70px" onchange="formatcolor(this.options[this.selectedIndex].value)">
			<option style="background-color:black;color=black" value="black">黑色
			<option style="background-color:red;color=red" value="red">红色
			<option style="background-color:blue;color=blue" value="blue">蓝色
			<option style="background-color:green;color=green" value="green">绿色
			<option style="background-color:aqua;color=aqua"  value="aqua">浅绿色
			<option style="background-color:fuchsia;color=fuchsia" value="fuchsia">紫红色
			<option style="background-color:gray;color=gray" value="gray" selected>灰色			
			<option style="background-color:maroon;color=maroon" value="maroon">粟色
			<option style="background-color:navy;color=navy" value="navy">深蓝色
			<option style="background-color:olive;color=olive" value="olive">橄榄色
			<option style="background-color:purple;color=purple" value="purple">紫色
			<option style="background-color:teal;color=teal" value="teal">茶色			
			<option style="background-color:yellow;color=yellow" value="yellow">黄色
		</select>				
		</td></tr>
	<tr>
	<tr>
		<table>
			<td width=70 align=right>内容</td>
			<td><textarea rows=15 cols=60 name=content style="font-family:宋体" ><%=body%></textarea></td>
			<td width=20>&nbsp;</td>
			<%if pid<>23 and pid<>27 and pid<>31 and pid<>53 and pid<>54 and pid<>55 and pid<>19 then%>
			<td valign=top>
			<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
				<tr><td width=60></td><td height=10></td></tr>
				<tr>
					<td width=60></td>
					<td align=center>
					<%if picflag=1 then%>
						<%if fileflag=0 then%>
								<img src="../upfile/<%=picname%>" border="0"><br><br>
							<%else%>	
								<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" id=ShockwaveFlash2>
									<param name=movie value="../upfile/<%=picname%>"><param name=quality value=high>
									<embed src="../upfile/<%=picname%>" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed> 
								</object><br><br>
					    <%end if%>			
						<a href="Javascript:editfile('<%=pid%>','<%=pic%>','classes')">上传图片</a>
					<%else%>
						<a href="Javascript:editfile('<%=pid%>','<%=pic%>','classes')">点击此处上传图片</a>
					<%end if%>
					</td>
				</tr>
			</table>
			<%end if%>
		</table>

</table>	
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr><td width=200></td><td height=10></td></tr>
	<tr>
	<td width=200></td>
	<td align=left>
		<input type="submit" name="submit" value="确认提交">&nbsp;&nbsp;&nbsp;&nbsp;
		<input type=button value='内容预览' name=Button onclick=gopreview() style="">
	</td></tr>
</table>

</form>
<form name=preview method=post action="content_view.asp" target=winview>
	<input type=hidden name=viewtitle value=""><input type=hidden name=viewbody value="">
</form>

</body>
</html>
<script language=Javascript>

	function format(flag)
	{
		switch(flag){
			case "bold":
				begintxt="<b>";
				endtxt="</b>";
				break;
			case "italic":
				begintxt="<i>";
				endtxt="</i>";
				break;
			case "underline":
				begintxt="<u>";
				endtxt="</u>";
				break;
			case "center":
				begintxt="<center>";
				endtxt="</center>";
				break;
			case "space":
				begintxt="&nbsp;";
				endtxt="";
				break;
		}
		dealcontent()
	}

	function formatcolor(newvalue)
	{
		begintxt="<font color="+newvalue+">"
		endtxt="</font>";
		dealcontent()
	}

	function formatfont(newvalue)
	{
		begintxt="<font face="+newvalue+">"
		endtxt="</font>";
		dealcontent()
	}

	function formatsize(newvalue)
	{
		begintxt="<font size="+newvalue+">"
		endtxt="</font>";
		dealcontent()
	}

	function formaturl(newvalue)
	{
		var urladd=window.prompt ("请在输入链接地址！","http://")
		begintxt="<a href="+urladd+">"
		endtxt="</a>";
		dealcontent()
	}	

	function dealcontent()
	{
		
		if ((document.selection)&&(document.selection.type == "Text"))
		{
		var range = document.selection.createRange();
		var ch_text=range.text;
		range.text = begintxt + ch_text + endtxt;
		} 
		else 
		{
		document.editform.content.value=begintxt+document.editform.content.value+endtxt;
		document.editform.content.focus();
		}
	}


	function gopreview()
	{
	document.preview.viewtitle.value=document.editform.title.value;
	document.preview.viewbody.value=document.editform.content.value;
	window.open('content_view.asp', 'winview', 'scrollbars=yes,width=500,height=400');
	document.preview.submit()
	}
	
	function editfile(keyno,pic,tablename)
	{
		var str
		str="file_upload.asp?" ;
		str=str+"keyno="+keyno+"&pic="+pic+"&tablename="+tablename
		window.open(str,"mywin","toolbar=no,location=no,directories=no,status=no,resizable=no,menubar=no,scrollbars=yes,width=550,height=400,left=120,top=70")		
	}
</script>
