示例#1
0
文件: Worker.cs 项目: mdileep/Chandam
        public static void OnTwitterPost()
        {
            OverlayDialog OD = new OverlayDialog();

            OD.PreOKCallBack = delegate()
            {
                string content = "d=" + Util.GetValue("txt");

                Ajax.MakeCall("/Link.ashx?r=" + new Date().ToUTCString(), new AjaxCallback(delegate(string err, string data, XHR xhr)
                {
                    string Link  = "http://chandam.apphb.com/?p=" + data;
                    string txt   = Util.GetValue("txt");
                    string brand = Strings.Brand;
                    string more  = " ...";
                    string b     = txt.Substring(0, 140 - (more.Length + brand.Length)) + more + brand + Link;

                    //if ( txt.Length < 140 - ( brand.Length + more.Length ) )
                    //{
                    //    b = txt.Substring ( 0 , 140 - ( more.Length + brand.Length ) ) + brand + Link;
                    //}

                    Window.Open("https://twitter.com/intent/tweet?text=" + b.EncodeUri());
                }), HTTPMethod.POST, content, false);



                return(true);
            };
            OD.Title   = Strings.TwitterTitle;
            OD.Content = Util.GetValue("txt").Replace("\n", "<br/>");
            OD.Show();
        }
示例#2
0
文件: Worker.cs 项目: mdileep/Chandam
        private static void MakeNotice(string url, string key, string title, int delay, int days, bool always)
        {
            if (!always)
            {
                bool flg = CookieUtil.GetCookie(key) == "1" ? true : false;
                if (flg)
                {
                    return;
                }
            }
            Script.SetTimeout(delegate()
            {
                Ajax.MakeCall(url, new AjaxCallback(delegate(string err, string data, XHR xhr)
                {
                    if (string.IsNullOrEmpty(data))
                    {
                        return;
                    }

                    CookieUtil.SetCookie(key, "1", days);

                    OverlayDialog OD = new OverlayDialog(title, data);
                    OD.Id            = key;
                    OD.Show();
                }), HTTPMethod.GET);
            }, delay * 1000);
        }
示例#3
0
文件: Worker.cs 项目: mdileep/Chandam
        public static void OnFBShare()
        {
            OverlayDialog OD = new OverlayDialog();

            OD.PreOKCallBack = delegate()
            {
                string content = "d=" + Util.GetValue("txt");

                Ajax.MakeCall("/Link.ashx?r=" + new Date().ToUTCString(), new AjaxCallback(delegate(string err, string data, XHR xhr)
                {
                    FeedParams FP  = new FeedParams();
                    FP.Name        = Strings.Title;
                    FP.Caption     = Strings.TagLine;
                    FP.Description = Strings.StandardDesc;
                    FP.Picture     = "http://chandam.apphb.com/img/fbPreView.png?r" + new Date().ToUTCString();
                    FP.Link        = "http://chandam.apphb.com/?p=" + data;
                    FP.Message     = Util.GetValue("txt");
                    FBUtil.Post(FP);
                }), HTTPMethod.POST, content, false);


                return(true);
            };

            OD.Title   = Strings.FBTitle;
            OD.Content = Util.GetValue("txt").Replace("\n", "<br/>");
            OD.Show();
        }
示例#4
0
文件: Worker.cs 项目: mdileep/Chandam
        public static void ShowBulkCompute()
        {
            OverlayDialog OD = new OverlayDialog();

            OD.Title   = Strings.BulkCompute;
            OD.Content = Strings.BCOnRequest;
            OD.Show();
        }
示例#5
0
文件: Worker.cs 项目: mdileep/Chandam
        public static void OnPermLink()
        {
            if (Util.GetValue("txt").Length == 0)
            {
                return;
            }

            string content = "d=" + Util.GetValue("txt");

            Ajax.MakeCall("/Link.ashx?r=" + new Date().ToUTCString(), new AjaxCallback(delegate(string err, string data, XHR xhr)
            {
                OverlayDialog OD    = new OverlayDialog();
                OD.PostLoadCallback = delegate()
                {
                    Util.SetValue("txtPermLink", "http://chandam.apphb.com/?p=" + data);

                    Util.RegisterClick("txtPermLink", delegate(ElementEvent e)
                    {
                        Script.Literal("document.getElementById('txtPermLink').focus()");
                        Script.Literal("document.getElementById('txtPermLink').select()");
                    });

                    Script.Literal("document.getElementById('txtPermLink').click()");
                };

                OD.Title   = Strings.PermLinkTitle;
                OD.Content = Util.GetValue("txt").Replace("\n", "<br/>");



                Element E = Document.CreateElement("textarea");
                E.SetAttribute("readonly", "1");
                E.SetAttribute("rows", "1");
                E.Style.Overflow = "hidden";
                E.Style.Width    = "80%";
                E.ID             = "txtPermLink";
                E.ClassName      = "text";


                Element Span   = Document.CreateElement("span");
                Span.InnerHTML = Strings.PermLinkDesc;


                Element Div = Document.CreateElement("div");
                Div.AppendChild(Document.CreateElement("hr"));
                Div.AppendChild(E);
                Div.AppendChild(Document.CreateElement("br"));
                Div.AppendChild(Span);



                OD.InnerElement = Div;
                OD.Show();
            }), HTTPMethod.POST, content, false);
        }
示例#6
0
文件: Worker.cs 项目: mdileep/Chandam
        private static void OnSubscribe2(bool allow)
        {
            OverlayDialog OD = new OverlayDialog();

            OD.Title            = allow ? Strings.Subscribe : Strings.UnSubscribe;
            OD.Content          = "";
            OD.PostLoadCallback = delegate()
            {
                Document.GetElementById("txtEmail").Focus();
            };

            OD.PreOKCallBack = delegate()
            {
                if (!Util.IsEmailValid(Util.GetValue("txtEmail")))
                {
                    Window.Alert(Strings.InvalidEmail);
                    Document.GetElementById("txtEmail").Focus();
                    return(false);
                }
                string content = "g=" + (allow ? "1" : "0") + "&e=" + Util.GetValue("txtEmail");

                Ajax.MakeCall("/Subscribe.ashx?r=" + new Date().ToUTCString(), new AjaxCallback(delegate(string err, string data, XHR xhr)
                {
                    Worker.ShowNotification(allow ? Strings.SubscribtionSucc : Strings.UnSubscribtionSucc);
                }), HTTPMethod.POST, content);
                return(true);
            };

            Element Div = Document.CreateElement("div");

            Element Span = Document.CreateElement("div");

            Span.InnerHTML = "Email:&nbsp;&nbsp;";

            Element E = Document.CreateElement("input");

            E.SetAttribute("type", "email");
            E.ID        = "txtEmail";
            E.ClassName = "text";
            E.SetAttribute("placeholder", "Ex:[email protected]");

            Div.AppendChild(Span);
            Div.AppendChild(E);



            OD.InnerElement = Div;
            OD.Show();
        }
示例#7
0
文件: Worker.cs 项目: mdileep/Chandam
        public static void OnFeedback()
        {
            OverlayDialog OD = new OverlayDialog();

            OD.PreOKCallBack = delegate()
            {
                if (!Util.IsEmailValid(Util.GetValue("fEmail")))
                {
                    Window.Alert("Please provide a valid Email Address.");
                    Document.GetElementById("fEmail").Focus();
                    return(false);
                }

                string content = "n=" + Util.GetValue("fName") + "&e=" + Util.GetValue("fEmail") + "&m=" + Util.GetValue("fMessage");

                Ajax.MakeCall("/Feedback.ashx?r=" + new Date().ToUTCString(), new AjaxCallback(delegate(string err, string data, XHR xhr)
                {
                    Worker.ShowNotification(Strings.FeedbackSucc);
                }), HTTPMethod.POST, content);

                return(true);
            };

            OD.Title   = "Feedback";
            OD.Content = "";

            Element Table = Document.CreateElement("table");
            Element Tbody = Document.CreateElement("tbody");
            Element TR0   = AddTextRow("Name", "fName");
            Element TR1   = AddEmailRow("Email", "fEmail");
            Element TR2   = AddLabelRow("Message");
            Element TR3   = AddTextAreaRow("fMessage", 3);


            Tbody.AppendChild(TR0);
            Tbody.AppendChild(TR1);
            Tbody.AppendChild(TR2);
            Tbody.AppendChild(TR3);
            Table.AppendChild(Tbody);

            Table.Style.Width = "100%";

            OD.InnerElement = Table;
            OD.Show();
        }