<%@ page language="C#" autoeventwireup="true" inherits="HL_Admin_Admin_TemplateView, WebApp_deploy" title="可视编辑" enableEventValidation="false" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>可视编辑</title>
<style type="text/css">
html{
	width:100%;
	height:100%;
}
body{
	width:100%;
	height:100%;
	margin:0;
}
.login_0{background:url(images/1.gif) repeat-x center center;width:80px;height:25px;border:1px outset #c4dae3;font-size:14px;cursor:pointer!important;cursor:hand;}
.login_1{background:url(images/2.gif) repeat-x center center;width:80px;height:25px;border:1px inset #c4dae3;font-size:14px;cursor:pointer!important;cursor:hand;}
.Btn{float:left;}
</style>
<script language="javascript" charset="gb2312" type="text/javascript">
var sLinkFieldName = "TemplateContent";
</script>
<script language="javascript" charset="utf-8" type="text/javascript">
function ok(){
    var content = document.getElementById("TemplateContent").value;
    content = formatlabel(content);
    opener.document.getElementById("ctl00_ContentPlaceHolder1_TemplateContent").value=content;
    //window.close();
}

///格式化转换
function formatlabel(html)
{
	var m_RegExp;
	var Matches;
	var newhtml;
	newhtml = html;
	newhtml = html.replace(/<!--{HL.Config.([\s\S]*?)}-->([\s\S]*?)<!--{HL.Config.([\s\S]*?)\/}-->/g,"{HL.Config.$1}");
	newhtml = newhtml.replace(/<IMG([\s\S]*?)alt=([\s\S]*?) \/>/g,"$2}");
	return newhtml;
}
</script>
<script src="editor.js" charset="gb2312"></script>
<script src="table.js" charset="gb2312"></script>
<script src="menu.js" charset="gb2312"></script>
</head>

<body onConTextMenu="event.returnValue=false;">
<form runat="server" id="form1">
   <div style="display:none;">
       <asp:literal runat="server" ID="TemplateTitle" Text="填写文件名：" />
       <asp:literal runat="server" ID="EditTemplateTitle" Text="编辑模板：" />&nbsp;&nbsp;
       <asp:Literal ID="TemPath" runat="server" />&nbsp;&nbsp;
       <asp:Literal ID="TemplateFileName" runat="server" />
       <asp:TextBox ID="TemplateName" runat="server" /> 
       <asp:Literal ID="TemNameMsg" Text=".html (不需要写后缀,默认后缀为“.html”)" runat="server" />
        <asp:TextBox ID="TemplateContent" TextMode="MultiLine" Wrap="true" Height="435px" Width="670"  runat="server" CssClass="TextBoxStyle"/>
    </div>
</form>

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" >
  <tr>
    <td height="30" bgcolor="#F3F9FE">
	
	<table border=0 cellpadding=0 cellspacing=0 width='100%' class='Toolbar' id='LinziWebEditor_Toolbar'>
    <tr><td>
    
    <DIV CLASS="Btn" TITLE="粗体" onclick="format('bold')"><IMG CLASS="Ico" SRC="buttonimage/standard/bold.gif"></DIV>
    <DIV CLASS="Btn" TITLE="斜体" onclick="format('italic')"><IMG CLASS="Ico" SRC="buttonimage/standard/italic.gif"></DIV>
    <DIV CLASS="Btn" TITLE="左对齐" onclick="format('justifyleft')"><IMG CLASS="Ico" SRC="buttonimage/standard/JustifyLeft.gif"></DIV>
    <DIV CLASS="Btn" TITLE="居中对齐" onclick="format('justifycenter')"><IMG CLASS="Ico" SRC="buttonimage/standard/JustifyCenter.gif"></DIV>
    <DIV CLASS="Btn" TITLE="右对齐" onclick="format('justifyright')"><IMG CLASS="Ico" SRC="buttonimage/standard/JustifyRight.gif"></DIV>
    <DIV CLASS="Btn" TITLE="两端对齐" onclick="format('JustifyFull')"><IMG CLASS="Ico" SRC="buttonimage/standard/JustifyFull.gif"></DIV>
    <DIV CLASS="Btn" TITLE="字体颜色" onclick="ShowDialog('dialog/selcolor.htm?action=forecolor', 280, 250, true)"><IMG CLASS="Ico" SRC="buttonimage/standard/forecolor.gif"></DIV>
    <DIV CLASS="Btn" TITLE="对象背景颜色" onclick="ShowDialog('dialog/selcolor.htm?action=bgcolor', 280, 250, true)"><IMG CLASS="Ico" SRC="buttonimage/standard/bgcolor.gif"></DIV>
    <DIV CLASS="Btn" TITLE="字体背景颜色" onclick="ShowDialog('dialog/selcolor.htm?action=backcolor', 280, 250, true)"><IMG CLASS="Ico" SRC="buttonimage/standard/backcolor.gif"></DIV>
    <DIV CLASS="Btn" TITLE="背景图片" onclick="ShowDialog('dialog/backimage.htm', 350, 210, true)"><IMG CLASS="Ico" SRC="buttonimage/standard/bgpic.gif"></DIV>
    <DIV CLASS="Btn" TITLE="插入或修改图片" onclick="ShowDialog('dialog/img.htm', 350, 315, true)"><IMG CLASS="Ico" SRC="buttonimage/standard/img.gif"></DIV>
    <DIV CLASS="Btn" TITLE="插入表格" onclick="TableInsert()"><IMG CLASS="Ico" SRC="buttonimage/standard/tablemenu.gif"></DIV>
    
    <SELECT CLASS="TBGen" onchange="format('fontname',this[this.selectedIndex].value);this.selectedIndex=0">
	    <option selected>字体</option>
	    <option value="宋体">宋体</option>
	    <option value="黑体">黑体</option>
	    <option value="楷体_GB2312">楷体</option>
	    <option value="仿宋_GB2312">仿宋</option>
	    <option value="隶书">隶书</option>
	    <option value="幼圆">幼圆</option>
	    <option value="Arial">Arial</option>
    </select>
    <SELECT CLASS="TBGen" onchange="format('fontsize',this[this.selectedIndex].value);this.selectedIndex=0">
	    <option selected>字号</option>
	    <option value="7">一号</option>
	    <option value="6">二号</option>
	    <option value="5">三号</option>
	    <option value="4">四号</option>
	    <option value="3">五号</option>
	    <option value="2">六号</option>
	    <option value="1">七号</option>
    </SELECT>
    <input name="ok" type="button" value=" 确 定 " onclick="return ok()" />
    </td></tr>
    </table>
	
	</td>
  </tr>
  <tr>
    <td style="border:1px #c9ddf0 solid;">
	
	<table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%'>
	<tr><td height='100%'>
	<input name="Content" id="Content" type="hidden">
		<iframe ID="LinziWebEditor" MARGINHEIGHT="0" MARGINWIDTH="0" frameborder="0" width="100%" height="100%" scrolling="yes"></iframe>
	</td></tr>
	</table>
	
	</td>
  </tr>
</table>
    
</body>
</html>
