<%@ Page Language="C#" MasterPageFile="Main.Master" AutoEventWireup="true" CodeFile="DataContents.aspx.cs" Inherits="eFrameWork.Manage.DataContents" %>
<%@ Register Src="GroupMenu.ascx" TagPrefix="uc1" TagName="GroupMenu" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script>    
    function bindcontrols_callback(text, value) {
        
        KE.insertHtml('f2', value);
    };
    function style_callback(data)
    {
        

        //KE.util.loadStyle("http://192.168.1.8/EKEFrameV11/Plugins/getStyles.ashx?type=1");
        //KE.util.loadStyle("../Plugins/getStyles.ashx?type=1");

        //KE.util.loadStyle("/EKEFrameV11/Plugins/getStyles2.css");
        //KindEditor.html('f2', data.viewHTML);

        //KE.html('f2', data.viewHTML);
        //KE.insertHtml('f2', data.viewHTML);
        KE.appendHtml('f2', data.viewHTML);
       

        var doc = KE.g['f2'].iframeDoc;
        var link = KE.$$('link');
        /*
        link.setAttribute('type', 'text/css');
        link.setAttribute('rel', 'stylesheet');
        link.setAttribute('href', path);
        doc.getElementsByTagName("head")[0].appendChild(link);

        alert(KE.g['f2'].iframeDoc);
        */

        //editor.appendCss('/path/to/your/style.css');
        //editor.appendStyle('.your-class { color: red; }');
      

        //var editor = KindEditor.editor('f2');
        //alert(editor);
        //KindEditor.editor('f2').setHtml('<p>这是新的HTML内容</p>');
        //KindEditor.editor('editor_id').html('<p>这是新的HTML内容</p>');
        //var iframeDoc = KindEditor.iframeDoc(editor.edit.doc);
        // 替换HTML内容
        //iframeDoc.body.innerHTML = '<p>这是新的HTML内容</p>';
    };
</script>
<uc1:GroupMenu runat="server" ID="GroupMenu" />
<div class="nav">您当前位置：<a href="Default.aspx">首页</a> -> 静态内容<a id="btn_add" style="<%=(act == "" ? "" : "display:none;" )%>" class="button" href="<%=edt.getAddURL()%>"><span><i class="add">添加</i></span></a></div>
 <div style="margin:6px;line-height:25px;font-size:13px;">
     <div class="tips" style="margin-bottom:6px;">
             <a href="http://help.eketeam.com/1/167.html" style="float:right;display:inline-block;margin-right:6px;margin-top:-5px;" target="_blank" title="帮助中心"><img src="images/help.gif"></a>
         <b>提示</b><br>在此进行定义,通过容器模块或aspx里eDataContent控件进行调用。示例地址：Examples/eDataContent.aspx</div>
<%if (eRegisterInfo.Base == 0 && eRegisterInfo.Loaded)
  { %>   
<div class="tips" style="margin-bottom:6px;">
    <b>未授权提示</b><br><a href="http://frame.eketeam.com/getSerialNumber.html" style="color:#ff0000;" target="_blank">申请临时授权</a>,享更多功能。</div>
 <%} %>
</div>
<style>
.divd4q a{display:inline-block;margin-right:25px;}
</style>
<%
    if (act == "edit" || act == "add" || act == "copy" || act == "view")
{
%>
<div style="margin:6px;">
	<form name="frmaddoredit" id="frmaddoredit" method="post" action="<%=edt.getSaveURL()%>">
	<input name="id" type="hidden" id="id" value="<%=edt.ID%>">
    <input name="act" type="hidden" id="act" value="save">  
	<input name="fromurl" type="hidden" id="fromurl" value="<%=edt.FromURL%>">  
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="eDataView">

      <tr>
        <td width="126" class="title"><ins>*</ins>名称：</td>
        <td class="content"><span class="eform">
		 <ev:eFormControl ID="f1" Field="MC" FieldName="名称" width="600" notnull="true" runat="server" />
		</span></td>
      </tr>
	 
        <tr>
          <td class="title">内容：</td>
          <td class="content"><span class="eform">
		  <ev:eFormControl ID="f2" ControlType="html" Field="NR" FieldName="内容" width="95%" height="500" HtmlEncode="true" runat="server" />
		  </span><a href="javascript:;" class="button" style="margin-top:6px;" onclick="applyStyle();"><span>应用样式</span></a>
              <a href="javascript:;" class="button" style="margin-top:6px;margin-left:6px;" onclick="bindControls();"><span>绑定数据</span></a>
          </td>
        </tr>
  		<tr>
          <td class="title">说明：</td>
          <td class="content"><span class="eform">
		   <ev:eFormControl ID="f3" ControlType="textarea" FieldName="说明" Field="BZ" width="600" height="60" runat="server" />
		   </span></td>
        </tr>
        <tr>
       <td colspan="2" class="title"  style="text-align:left;padding-left:100px;padding-top:10px;padding-bottom:10px;">		
		<a class="button" href="javascript:;" onclick="if(frmaddoredit.onsubmit()!=false){frmaddoredit.submit();}" style="display:none;"><span><i class="save">保存</i></span></a>
		<a class="button" href="javascript:;" onclick="ajaxSubmit(frmaddoredit);" style="<% =(act == "view" ? "display:none;" : "")%>"><span><i class="save">保存</i></span></a>
		<a class="button" href="javascript:;" style="margin-left:30px;" onclick="history.back();"><span><i class="back">返回</i></span></a>
		</td>
	   </tr>
	 
    </table>
	 </form>
	 </div>
	<%}else{%>
<div style="margin:6px;overflow-x:auto;overflow-y:hidden;">
<dl id="eSearchBox" class="ePanel">
<dt><h1 onclick="showPanel(this);" class="search"><a href="javascript:;" class="cur" onfocus="this.blur();"></a>搜索</h1></dt>
<dd style="display:none;">
<asp:PlaceHolder ID="eSearchControlGroup" runat="server">
<form id="frmsearch" name="frmsearch" method="post" onsubmit="return goSearch(this);" action="<%=elist.getSearchURL()%>">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="eDataView">
<colgroup>
<col width="120" />
<col />
</colgroup>
<tr>
<td class="title">名称：</td>
<td class="content"><span class="eform"><ev:eSearchControl ID="s1" Name="s1" ControlType="text" Field="MC" Operator="like" FieldName="名称" DataType="string" Width="300px" runat="server" /></span></td>
<td class="title">编号：</td>
<td class="content"><span class="eform"><ev:eSearchControl ID="s2" Name="s2" ControlType="text" Field="DataContentID" Operator="like" FieldName="编号" DataType="string" Width="300px" runat="server" /></span></td>
</tr>
<tr>
<td colspan="4" class="title" style="text-align:left;padding-left:125px;"><a class="button" href="javascript:;" onclick="if(frmsearch.onsubmit()!=false){frmsearch.submit();}"><span><i class="search">搜索</i></span></a></td>
</tr>
</table>
</form>
</asp:PlaceHolder>
</dd>
</dl>
<%}%>
<asp:Repeater id="Rep" runat="server">
<headertemplate>
<%#
"<table id=\"eDataTable\" class=\"eDataTable\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"100%\">\r\n" +
"<thead>\r\n" +
"<tr bgcolor=\"#f2f2f2\">\r\n" +
"<td width=\"260\">编号</td>\r\n" +
"<td>名称</td>\r\n" +
"<td>说明</td>\r\n" +
"<td width=\"80\">添加时间</td>\r\n" +
"<td width=\"120\">操作</td>\r\n" +
"</tr>\r\n" +
"</thead>\r\n"
%>
</headertemplate>
<itemtemplate>
<%#
"<tr" + ((Container.ItemIndex+1) % 2 == 0 ? " class=\"alternating\" eclass=\"alternating\"" : " eclass=\"\"") + ">\r\n" +
"<td height=\"32\"><a class=\"copy\" href=\"javascript:;\" data-clipboard-action=\"copy\" data-clipboard-text=\"" +Eval("DataContentID")+ "\"></a>"+ Eval("DataContentID")+"</td>\r\n" +
"<td>"+ Eval("MC").ToString()+"</td>\r\n" +
"<td>"+ Eval("BZ").ToString()+"</td>\r\n" +
"<td>"+ Eval("addTime","{0:yyyy-MM-dd}")+"</td>\r\n" +
"<td>"+
"<a href=\""+ edt.getActionURL("copy",Eval("DataContentID").ToString())  +"\" onclick=\"javascript:return confirm('确认要复制吗？');\">复制</a>"+
"<a href=\"" + edt.getActionURL("edit",Eval("DataContentID").ToString())  + "\">修改</a>"+
"<a href=\""+ edt.getActionURL("del",Eval("DataContentID").ToString()) +"\" onclick=\"javascript:return confirm('确认要删除吗？');\">删除</a>"+
"</td>\r\n" +
"</tr>\r\n" 
%>
</itemtemplate>
<footertemplate><%#"</table>\r\n"%></footertemplate>
</asp:Repeater>
</div>
<div style="margin:6px;"><ev:ePageControl ID="ePageControl1" PageSize="20" PageNum="9" runat="server" /></div>
<asp:Literal id="litTip" runat="server" />
<iframe style="display:none;" width="500" height="500" id="fra" src="about:blank" name="fra"></iframe>
<script>
    /*
    KindEditor.ready(function (K) {
        alert(5);
    });
    */
</script>
</asp:Content>