<%@ Register TagPrefix="uc1" TagName="TextareaResize" Src="../UserControls/TextareaResize.ascx" %>
<%@ Register TagPrefix="cc1" Namespace="Discuz.Control" Assembly="Discuz.Control" %>
<%@ Page language="c#" Inherits="Discuz.ForumPage.Admin.templatesedit" Codebehind="global_templatesedit.aspx.cs" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>templatesedit</title>
		<link href="../styles/dntmanager.css" type="text/css" rel="stylesheet">  
		<LINK href="../styles/colorpicker.css" type="text/css" rel="stylesheet">

<style type=text/css>
.img
{
	border:0px;
	align:bottom;
	position:relative;
	top:0.5%;
}	
</style>

		<script language="JavaScript">
var n = 0;
function displayHTML(obj) {
	window.open(obj, 'popup', 'toolbar = no, status = no, scrollbars=yes');
}	
	
function HighlightAll(obj) {
	obj.focus();
	obj.select();
	if (document.getElementById("templatenew_posttextarea")) {
		obj.createTextRange().execCommand("Copy");
		window.status = '将模板内容复制到剪贴板';
		setTimeout("window.status=''", 1800);
	}
}



function findInPage(obj, str) {
try
{
	var txt, i, found;
	if (str == "") {
		return false;
	}
	if (document.layers) {
		if (!obj.find(str)) {
			while(obj.find(str, false, true)) {
				n++;
			}
		} else {
			n++;
		}
		if (n == 0) {
			alert("未找到指定字串. ");
		}
	}
	if (document.getElementById("templatenew_posttextarea")) {
		txt = obj.createTextRange();
		for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
			txt.moveStart('character', 1);
			txt.moveEnd('textedit');
		}
		if (found) {
			txt.moveStart('character', -1);
			txt.findText(str);
			txt.select();
			txt.scrollIntoView();
			n++;
		} else {
			if (n > 0) {
				n = 0;
				findInPage(str);
			} else {
				alert("未找到指定字串. ");
			}
		}
	}
	return false;
}
catch(error)
{
	alert("已经到达文件尾！");
}
}



		</script>
	<script language="javascript" src="../js/common.js"></script>
</head>

	<body >
		<form id="Form1" method="post" runat="server">
			<table class="table1" cellspacing="0" cellpadding="4" width="100%" align="center">
				<tr>
					<td class="td1">编辑文件 - <b><%=filename%></b></td>
				</tr>
				<tr>
					<td class="td1">
					 <button class="ManagerButton" type="button" onclick="javascript:window.location.href='global_templatetree.aspx?templateid=<%=Request.Params["templageid"]%>&path=<%=Request.Params["path"]%>&templatename=<%=Request.Params["templatename"]%>';"><img src="../images/arrow_undo.gif" />返回</button>
					 </td>
			    </tr>
			    <tr>
			        <td align="center">
					 <cc1:ColorPicker id="ColorPicker1" LeftOffSet="0.5" TopOffSet="2.5" FirefoxOffSet="0"	runat="server" ReadOnly="True"></cc1:ColorPicker>&nbsp;&nbsp;
						<uc1:TextareaResize id="templatenew" runat="server" controlname="templatenew" is_replace=false rows="20" cols="120"></uc1:TextareaResize>
						<br />
						<input name="search" type="text" accesskey="t" size="20" onChange="n=0;">
						&nbsp;<button type="button" class="ManagerButton" accesskey="f" onClick="findInPage(this.form.templatenew_posttextarea, this.form.search.value)"><img src="../images/search.gif" />搜索</button>
						&nbsp;<button type="button" class="ManagerButton" accesskey="c" onClick="HighlightAll(this.form.templatenew_posttextarea,'')"><img src="../images/topictype.gif" /> 复制</button>
						&nbsp;<button type="button" class="ManagerButton" accesskey="p" onClick="displayHTML('<%=filenamefullpath%>')"><img src="../images/cache_resetall.gif" /> 预览</button><br />
					</td>
				</tr>
				<tr><td align=center><cc1:Button id="SavaTemplateInfo" runat="server" Text=" 提 交 "></cc1:Button></td></tr>
			</table>
			
			
			
			
			

		</form>
		<%=footer%>
	</body>
</HTML>
