<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CampaignForm.aspx.cs" Inherits="RM.Web.Training.Campaign.CampAignForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>TKS - <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterPlan_Form_title")%></title>
    <link href="/Themes/Styles/Site.css" rel="stylesheet" type="text/css" />
    <script src="/Themes/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/Validator/JValidator.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="../../Themes/Scripts/artDialog/artDialog.js" type="text/javascript"></script>
    <script src="../../Themes/Scripts/artDialog/iframeTools.source.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    <script src="../../Themes/Scripts/jquery.qrcode.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function(){	        
//	        $('#code').qrcode(str);	
	        $("#sub_btn").click(function(){
		        $("#code").empty();
		        var str = toUtf8($("#Campaign_CodePath").val());
		
		        $("#code").qrcode({
			        render: "table",
			        width: 150,
			        height:150,
			        text: str
		        });
			});			
        })
       
            
   
        function toUtf8(str) {   
            var out, i, len, c;   
            out = "";   
            len = str.length;   
            for(i = 0; i < len; i++) {   
    	        c = str.charCodeAt(i);   
    	        if ((c >= 0x0001) && (c <= 0x007F)) {   
        	        out += str.charAt(i);   
    	        } else if (c > 0x07FF) {   
        	        out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));   
        	        out += String.fromCharCode(0x80 | ((c >>  6) & 0x3F));   
        	        out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));   
    	        } else {   
        	        out += String.fromCharCode(0xC0 | ((c >>  6) & 0x1F));   
        	        out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));   
    	        }   
            }   
            return out;   
        }  
    </script>
</head>


<body>
   <form id="form1" runat="server">
     <table id="tablebody" border="0" cellpadding="0" cellspacing="0" class="frm">
        <tr>
            <th style="width: 80px;">
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CampaignName")%>:
            </th>
            <td>
                <input id="Campaign_Name" runat="server" maxlength="40" type="text" class="txt"
                    datacol="yes" err="活动名称" checkexpession="NotNull" style="width: 200px" />
            </td>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CampaignAddress")%>:
            </th>
            <td>
               <input id="Campaign_Address" runat="server" maxlength="40" type="text" class="txt"
                    datacol="yes" err="活动地址" checkexpession="NotNull" style="width: 200px" />
            </td>
        </tr>

        <tr>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CampaignOpenTime")%>:
            </th>
            <td>
               <input id="Campaign_OpenTime" runat="server" onclick="WdatePicker()" maxlength="40" type="text" class="txt" datacol="yes" err="活动开始时间" checkexpession="NotNull" style="width: 200px" />
            </td>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CampaignEndTime")%>:
            </th>
            <td>
               <input id="Campaign_EndTime" runat="server" onclick="WdatePicker()" maxlength="40" type="text" class="txt" datacol="yes" err="活动结束时间" checkexpession="NotNull" style="width: 200px" />
            </td>
        </tr>

        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CampaignCloseTime")%>:
            </th>
            <td>
               <input id="Campaign_CloseTime" runat="server" onclick="WdatePicker()" maxlength="40" type="text" class="txt" datacol="no" err="报名截止时间" checkexpession="NotNull" style="width: 200px" />
            </td>
            <th>
                活动备注:
            </th>
            <td>
               <input id="Campaign_Remark" runat="server" maxlength="40" type="text" class="txt" datacol="yes" err="备注" style="width: 200px" />
            </td>
        </tr>

        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("DIC")%>:
            </th>
            <td>
               <input id="Campaign_DIC" runat="server" onclick="WdatePicker()" maxlength="40" type="text" class="txt" datacol="no" err="详细信息外链" checkexpession="NotNull" style="width: 200px" />
            </td>
        </tr>
       <tr>
            <th style="width: 80px;">
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CampaignInfo")%>:
            </th>            
            <td colspan="3">
                    <script src="/Themes/Scripts/kindeditor/kindeditor-min.js" type="text/javascript"></script>
                    <script type="text/javascript">
                        var editor;
                        KindEditor.ready(function (K) {
                            editor = K.create('#Campaign_Info', {
                                allowFileManager: true,
                                allowUpload: true,
                                uploadJson: '/WeiXin/UploadImage.ashx',
                                minHeight: 240
                                
                            });
                        });
                    </script>
                    <textarea id="Campaign_Info" runat="server" style="width:675px; " err='活动内容' checkexpession="NotNull"></textarea>                   
                </td>     
        </tr>      
    </table>       
    <div class="frmbottom" style="margin-top:20px;">
        <asp:LinkButton ID="Save" runat="server" class="l-btn" OnClientClick="return saveForm();"  onclick="Save_Click"><span class="l-btn-left">
            <img src="/Themes/Images/disk.png" alt="" /><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Save")%></span></asp:LinkButton>
        <a class="l-btn" href="javascript:void(0)" onclick="OpenClose();"><span class="l-btn-left">
            <img src="/Themes/Images/cancel.png" alt="" /><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Close")%></span></a>
    </div>
    </form>
    <script type="text/javascript">       
        
        function saveForm() {
            
            if (!CheckDataValid('#form1')){ return false;}
           
            editor.sync();
            return true;
            
        }       
        $(function(){
          var str = toUtf8($("#Campaign_CodePath").val());
//          $('#code').qrcode(str);
          $("#code").qrcode({
              render: "table",
              width: 150,
              height:150,
              text: str
          });	
        });
    </script>
</body>
</html>
