<%@ language=VBScript CODEPAGE=936%>
<%
Option Explicit
response.buffer=True
%>
<!--#include file="../Conn.asp"-->
<!--#include file="../Inc/Cl_ClsSysTem.asp"-->
<!--#include file="Config.Asp"-->
<%
Cl.Page_Admin = True
Cl.GetWeb_Setting()		'Aspoo.Com
if Not Cl.ChkUserLogin then Cl.OutErr("<br /><li>您无此操作权限！</li>")
Dim sContentID, sStyleID, sFullScreen, sChannelID, wCssID
Dim sStyleName, sStyleDir, sStyleCSS, sInitMode, sAutoRemote
Dim sVersion, sReleaseDate, sLicense
Dim sToolBar, sTObj
sVersion		= "3.00"
sReleaseDate	= "2005-12-23"
sLicense		= "Copyright ? 2004-2005 Aspoo.cN, All Rights Reserved."
Install
%>
<html>
<head>
<title>Aspoo.Cn - Editor在线编辑器</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Style/Css/<%=sStyleCSS%>/Editor.css" type="text/css" rel="stylesheet">
<script language="JavaScript" type="text/javascript">
var sPath = document.location.pathname;
sPath = sPath.substr(0, sPath.length-11);
var sLinkFieldName = "<%=sContentID%>" ;
var sLinkOriginalFileName = "<%=Request.QueryString("originalfilename")%>" ;
var sLinkSaveFileName = "<%=Request.QueryString("savefilename")%>" ;
var sLinkSavePathFileName = "<%=Request.QueryString("savepathfilename")%>" ;
// 全局设置对象
var config = new Object() ;
config.WebDir = "<%=Cl.WebDir%>" ;
config.UpLoadDir = "<%=Cl.UpLoadDir%>" ;
config.Version = "<%=sVersion%>" ;
config.ReleaseDate = "<%=sReleaseDate%>" ;
config.License = "<%=sLicense%>" ;
config.StyleName = "<%=sStyleName%>";
config.ChannelID = "<%=sChannelID%>";
config.StyleMenuHeader = "<head><link href=\""+sPath+"/Style/Css/<%=sStyleCSS%>/MenuArea.css\" type=\"text/css\" rel=\"stylesheet\"></head><body scroll=\"no\" onConTextMenu=\"event.returnValue=false;\">";
config.StyleDir = "<%=sStyleDir%>";
config.InitMode = "<%=sInitMode%>";
config.AutoDetectFromWord = true;
config.AutoRemote = "<%=sAutoRemote%>";
config.ShowBorder = "0";
config.BaseUrl = "0";
config.sTObj = "<%=sTObj%>";
<%if sStyleName="Template" then%>
config.StyleEditorHeader = "<html><head><META http-equiv=Content-Type content=text/html; charset=gb2312><link href='<%=Cl.WebDir%>Skins/Css/Css<%=wCssID%>.css' rel='stylesheet' type='text/css'></head>" ;
<%else%>
config.StyleEditorHeader = "<html><head><link href=\""+sPath+"/Style/Css/<%=sStyleCSS%>/EditorArea.css\" type=\"text/css\" rel=\"stylesheet\"></head><body MONOSPACE>" ;
<%end if%>
</script>
<script language="JavaScript" type="text/javascript" src="Js/editor.js"></script>
<script language="JavaScript" type="text/javascript" src="Js/table.js"></script>
<script language="JavaScript" type="text/javascript" src="Js/menu.js"></script>
<script language="JavaScript" type="text/javascript" event="onerror(msg, url, line)" for="window">
return true ;	 // 隐藏错误
</script>
</head>
<body SCROLLING=no onConTextMenu="event.returnValue=false;">
<table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%'>
<tr><td>
	<%=sToolBar%>
</td></tr>
<tr><td height='100%'>
	<table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%'>
	<tr><td height='100%'>
	<input type="hidden" ID="ContentEdit" value="">
	<input type="hidden" ID="ModeEdit" value="">
	<input type="hidden" ID="ContentLoad" value="">
	<input type="hidden" ID="ContentFlag" value="0">
	<iframe class="Composition" ID="Editor" MARGINHEIGHT="1" MARGINWIDTH="1" width="100%" height="100%" scrolling="yes"> 
	</iframe>
	</td></tr>
	</table>
</td></tr>
<form id="Editor_UploadForm" action="upload.asp?action=remote&cid=<%=sChannelID%>&type=remote&style=<%=sStyleName%>&TObj=<%=sTObj%>" method="post" target="Editor_UploadTarget">
<input type="hidden" name="Editor_UploadText">
</form>
<tr><td height=25>
	<TABLE border="0" cellPadding="0" cellSpacing="0" width="100%" class=StatusBar height=25>
<%if sStyleName="Template" then%>
	<TR valign=middle>
		<td id="ShowObject"></td>
	</TR>
<%else%>
	<TR valign=middle>
	<td>
		<table border=0 cellpadding=0 cellspacing=0 height=20>
		<tr>
		<td width=10></td>
		<td class=StatusBarBtnOff id=Editor_CODE onclick="setMode('CODE')"><img border=0 src="Style/Button/<%=sStyleDir%>/modecode.gif" width=50 height=15 align=absmiddle></td>
		<td width=5></td>
		<td class=StatusBarBtnOff id=Editor_EDIT onclick="setMode('EDIT')"><img border=0 src="Style/Button/<%=sStyleDir%>/modeedit.gif" width=50 height=15 align=absmiddle></td>
		<td width=5></td>
		<td class=StatusBarBtnOff id=Editor_TEXT onclick="setMode('TEXT')"><img border=0 src="Style/Button/<%=sStyleDir%>/modetext.gif" width=50 height=15 align=absmiddle></td>
		<td width=5></td>
		<td class=StatusBarBtnOff id=Editor_VIEW onclick="setMode('VIEW')"><img border=0 src="Style/Button/<%=sStyleDir%>/modepreview.gif" width=50 height=15 align=absmiddle></td>
		</tr>
		</table>
	</td>
	<td align=center style="font-size:9pt"></td>
	<td align=right>
		<table border=0 cellpadding=0 cellspacing=0 height=20>
		<tr>
		<td style="cursor:pointer;" onclick="sizeChange(300)"><img border=0 SRC="Style/Button/<%=sStyleDir%>/sizeplus.gif" width=20 height=20 alt="增高编辑区"></td>
		<td width=5></td>
		<td style="cursor:pointer;" onclick="sizeChange(-300)"><img border=0 SRC="Style/Button/<%=sStyleDir%>/sizeminus.gif" width=20 height=20 alt="减小编辑区"></td>
		<td width=40></td>
		</tr>
		</table>
	</td>
	</TR>
<%end if%>
	</Table>
</td></tr>
</table>
<div id="Editor_Temp_HTML" style="VISIBILITY: hidden; OVERFLOW: hidden; POSITION: absolute; WIDTH: 0px; HEIGHT: 0px"></div>
<iframe name="Editor_UploadTarget" width=0 height=0></iframe>
<div id=divProcessing style="width:200px;height:30px;position:absolute;display:none">
<table border=0 cellpadding=0 cellspacing=1 bgcolor="#000000" width="100%" height="100%"><tr><td bgcolor=#3A6EA5><marquee align="middle" behavior="alternate" scrollamount="5" style="font-size:9pt"><font color=#FFFFFF>...远程文件收集中...请等待...</font></marquee></td></tr></table>
</div>
</body>
</html>
<script language="VBScript" type="text/vbscript">
	Function Resumeblank(ByVal Content)
		if Content="" then Resumeblank=Content : Exit Function
		Dim strHtml, strHtml2, Num, Numtemp, Strtemp, i, arrContent
		strHtml=Replace(Content, "<A", "<a")
		strHtml=Replace(strHtml, "</A>", "</a>")
		strHtml=Replace(strHtml, "<IMG", "<img")
		strHtml=Replace(strHtml, "<FONT", "<font")
		strHtml=Replace(strHtml, "</FONT>", "</font>")
		strHtml=Replace(strHtml, "<STRONG", "<strong")
		strHtml=Replace(strHtml, "</STRONG>", "</strong>")
		strHtml=Replace(strHtml, "<DIV", "<div")
		strHtml=Replace(strHtml, "</DIV>", "</div>")
		strHtml=Replace(strHtml, "<TABLE", "<table")
		strHtml=Replace(strHtml, "</TABLE>", vbCrLf & "</table>"& vbCrLf)
		strHtml=Replace(strHtml, "<TBODY>", "")
		strHtml=Replace(strHtml, "</TBODY>","" & vbCrLf)
		strHtml=Replace(strHtml, "<TR", "<tr")
		strHtml=Replace(strHtml, "</TR>", vbCrLf & "</tr>"& vbCrLf)
		strHtml=Replace(strHtml, "<TD", "<td")
		strHtml=Replace(strHtml, "</TD>", "</td>")
		strHtml=Replace(strHtml, "<" & "!--", vbCrLf & "<" & "!--")
		strHtml=Replace(strHtml, "<SELECT",vbCrLf & "<Select")
		strHtml=Replace(strHtml, "</SELECT>",vbCrLf & "</Select>")
		strHtml=Replace(strHtml, "<OPTION",vbCrLf & "  <Option")
		strHtml=Replace(strHtml, "</OPTION>","</Option>")
		strHtml=Replace(strHtml, "<INPUT",vbCrLf & "  <Input")
		strHtml=Replace(strHtml, "<" & "SCRIPT",vbCrLf & "<" & "Script")
		strHtml=Replace(strHtml, "</" & "SCRIPT>",vbCrLf & "</" & "Script>")
		strHtml=Replace(strHtml, "&amp;","&")
		arrContent = Split(strHtml,vbCrLf)
		For i = 0 To UBound(arrContent)
			Numtemp = False
			If InStr(arrContent(i), "<table") > 0 Then
				Numtemp = True
				If Strtemp <> "<table" And Strtemp <> "</table>" Then
					Num = Num + 2
				End If
				Strtemp = "<table"
			ElseIf InStr(arrContent(i), "<tr") > 0 Then
				Numtemp = True
				If Strtemp <> "<tr" And Strtemp <> "</tr>" Then
					Num = Num + 2
				End If
				Strtemp = "<tr"
			ElseIf InStr(arrContent(i), "<td") > 0 Then
				Numtemp = True
				If Strtemp <> "<td" And Strtemp <> "</td>" Then
					Num = Num + 2
				End If
				Strtemp = "<td"
			ElseIf InStr(arrContent(i), "</table>") > 0 Then
				Numtemp = True
				If Strtemp <> "</table>" And Strtemp <> "<table" Then
					Num = Num - 2
				End If
				Strtemp = "</table>"
			ElseIf InStr(arrContent(i), "</tr>") > 0 Then
				Numtemp = True
				If Strtemp <> "</tr>" And Strtemp <> "<tr" Then
					Num = Num - 2
				End If
				Strtemp = "</tr>"
			ElseIf InStr(arrContent(i), "</td>") > 0 Then
				Numtemp = True
				If Strtemp <> "</td>" And Strtemp <> "<td" Then
					Num = Num - 2
				End If
				Strtemp = "</td>"
			ElseIf InStr(arrContent(i), "<"&"!--") > 0 Then
				Numtemp = True
			End If

			If Num < 0 Then Num = 0
			If Trim(arrContent(i)) <> "" Then
				If i = 0 Then
					strHtml2 = String(Num, " ") & arrContent(i)
				ElseIf Numtemp = True Then
					strHtml2 = strHtml2 & vbCrLf & String(Num, " ") & arrContent(i)
				Else
					strHtml2 = strHtml2 & vbCrLf & arrContent(i)
				End If
			End If
		Next
		Resumeblank = strHtml2
	End Function
</script>
<%
' 显示调用错误提示
Sub OutErr(str)
	Call DBConnEnd()
	Response.Write "调用错误：" & str
	Response.End
End Sub
' 初始化
Sub Install()
	sFullScreen		= Trim(Request.QueryString("fullscreen")) ' 取全屏标志
	' 取对应的内容ID
	sContentID		= Trim(Request.QueryString("id"))
	sChannelID		= Cl.ChkClng(Request.QueryString("cid"))
	wCssID			= Cl.ChkClng(Request.QueryString("CssID"))
	sTObj			= Trim(Request.QueryString("TObj"))
	If sContentID = "" Then OutErr "请传入调用参数ID，即隐藏的内容表单项ID！"
	sStyleName		= Cl.Checkstr(Trim(Request.QueryString("style")))' 取样式初始值
	Dim tid
	Select Case Ucase(sStyleName)
	Case "ASPOO"	: tid=0
	Case "TEMPLATE" : tid=1
	Case Else		: tid=2
	End Select
	sStyleDir		= TsStyleDir(tid)
	sStyleCSS		= TsStyleCSS(tid)
	sAutoRemote		= TsAutoRemote(tid)
	sInitMode		= TsInitMode(tid)
	sToolBar		= TsToolbar(tid)
	If sFullScreen = "1" Then
		sToolBar	= Replace(sToolBar,"{%maximize%}","")
		sToolBar	= Replace(sToolBar,"{%minimize%}","<DIV CLASS=""Btn"" TITLE=""全屏返回"" onclick=""parent.Minimize()""><IMG CLASS=""Ico"" SRC=""{%styledir%}minimize.gif""></DIV>")
	Else
		sToolBar	= Replace(sToolBar,"{%maximize%}","<DIV CLASS=""Btn"" TITLE=""全屏编辑"" onclick=""Maximize()""><IMG CLASS=""Ico"" SRC=""{%styledir%}maximize.gif""></DIV>")
		sToolBar	= Replace(sToolBar,"{%minimize%}","")
	End If
	sToolBar		= Replace(sToolBar,"{%styledir%}","Style/Button/" & sStyleDir & "/")
End Sub
%>