<%@ Page ValidateRequest="false" Language="C#" MasterPageFile="~/Views/Shared/ExhibitorMaster.Master"
    Inherits="System.Web.Mvc.ViewPage<FamousFurnitureExpo.Models.Actor>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script language="javascript" type="text/javascript">
        $(function () {
            $("#CurrentPosition").html("链接邀请");
            $("#mainmenu5").css("visibility", "visible");
        });
        function GoTo(str) {
            document.location = "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/" + str;
        }
        function copyToClipboard(txt) {
            if (window.clipboardData) {
                window.clipboardData.clearData();
                window.clipboardData.setData("Text", txt);
            } else if (navigator.userAgent.indexOf("Opera") != -1) {
                window.location = txt;
            } else if (window.netscape) {
                try {
                    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                } catch (e) {
                    alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");
                }
                var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
                if (!clip)
                    return;
                var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
                if (!trans)
                    return;
                trans.addDataFlavor('text/unicode');
                var str = new Object();
                var len = new Object();
                var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
                var copytext = txt;
                str.data = copytext;
                trans.setTransferData("text/unicode", str, copytext.length * 2);
                var clipid = Components.interfaces.nsIClipboard;
                if (!clip)
                    return false;
                clip.setData(trans, null, clipid.kGlobalClipboard);
                alert("复制成功！")
            }
        }
        
    </script>
    <%=ViewData["Msg"]%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <center>
            <form id="f2" name="f2" method="post" action="">
            <table width="100%" border="0" style="text-align: left" cellpadding="0" cellspacing="0"
                id="main">
                <tr style="display:none">
                    <td align="left">
                        <table border='0' cellpadding="0" cellspacing="0" width="100%" align="left">
                            <tr>
                                <td class="tdMenuSelect" onclick="GoTo('VisitorInvite')">
                                    邀请注册
                                </td>
                                <td class="tdMenuWidth">&nbsp;</td>
                                <td class="tdMenu" onclick="GoTo('VisitorInviteCount')">
                                    邀请统计
                                </td>
                                <td>&nbsp;</td>
                            </tr>
                            <tr>
                                <td class="tdMenuLine" colspan="4"></td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr style="display:none">
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                        <%
                            string exhName = Session["ExhName"].ToString();
                            DateTime exhBTime = Convert.ToDateTime(Session["ExhBTime"]);
                            DateTime exhETime = Convert.ToDateTime(Session["ExhETime"]);
                            string showDate = "";
                            if (exhBTime.Year == exhETime.Year && exhBTime.Month == exhETime.Month)
                            {
                                showDate = exhBTime.Year + "." + exhBTime.Month + "." + exhBTime.Day + "-" + exhETime.Day;
                            }
                            else if (exhBTime.Year == exhETime.Year)
                            {
                                showDate = exhBTime.Year + "." + exhBTime.Month + "." + exhBTime.Day + "-" + exhETime.Month + "." + exhETime.Day;
                            }
                            else
                            {
                                showDate = exhBTime.Year + "." + exhBTime.Month + "." + exhBTime.Day + "-" + exhETime.Year + "." + exhETime.Month + "." + exhETime.Day;
                            }

                            string mobileMessage = "您好，" + Server.HtmlEncode(Model.AtrName) + "邀请您一同参观" + showDate + "的" + exhName + "。";
                        %>
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="left" bgcolor="#ffffff">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="20" style="vertical-align:middle; height:20px;"></td>
                                <td style="vertical-align:middle; height:20px;">链接邀请</td>
                            </tr>
                            <tr><td>&nbsp;</td></tr>
                            <tr>
                                <td></td>
                                <td>
                                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td align="left">
                                                您可以复制此邀请链接发给您的好友，您的朋友通过此链接进行登记时，系统将记录您的邀请身份。同时感谢您对本展会的支持！<br />
                                                        <span style="color: #B10008">请点击“复制”按钮，按 Ctrl + v 或点击鼠标右键选择粘贴 到您需要的位置。</span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                    <tr>
                                                        <td style="width:70px">邀请链接：</td>
                                                        <td style="width:390px">
                                                            <input type="text" class="text" name="LinkAddress" id="LinkAddress" value="<%=ViewData["LinkUrl"] %>"
                                                                style="width: 365px; color: #000;" readonly="readonly" />
                                                        </td>
                                                        <td style="padding-left:10px">
                                                            <div class="button" onclick="copyToClipboard($('#LinkAddress').val());alert('拷贝成功');">复制</div>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" style="padding-top:10px">
                                                <%
                                                    string title = "您好，" + Server.HtmlEncode(Model.AtrName) + "邀请您一同参观" + showDate + "的" + exhName;
                                                %>
                                                <!--分享到-->
                                                <div>
                                                分享到：
                                                &nbsp;&nbsp;&nbsp;&nbsp;<script src="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Scripts/Share/Share.js" type="text/javascript"></script>
                                                <script type="text/javascript">
                                                    var title = "<%=Server.UrlEncode(title) %>"; //自定义分享标题
                                                    var url = "<%=Server.UrlEncode(ViewData["LinkUrl"].ToString()) %>"; //自定义分享网址
                                                    var imgroot = "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Scripts/Share/image";
                                                    share(title, url, imgroot);
                                                </script>
                                                </div>
                                                <!--END -->
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                        
                    </td>
                </tr>
            </table>
            </form>
        </center>
    </div>
</asp:Content>
