Пример #1
0
        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();
        }
Пример #2
0
        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
        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();
        }
Пример #4
0
 public static void ShowStats()
 {
     Ajax.MakeCall("/Stats.ashx?r=" + new Date().ToUTCString(), new AjaxCallback(delegate(string err, string data, XHR xhr)
     {
         Window.Document.GetElementById("totCalcs").InnerHTML = data;
     }), HTTPMethod.GET);
 }
Пример #5
0
        public static void Export2(Metric metric, int?time, string identifier, string percentage)
        {
            string content = "m=" + ToString2(metric) + (time == null ? "" : "&t=" + time) + (identifier == null ? "" : "&i=" + identifier) + (percentage == null ? "" : "&s=" + percentage);

            Ajax.MakeCall("/Metrics.ashx", new AjaxCallback(delegate(string err, string data, XHR xhr)
            {
                ShowStats();
            }), HTTPMethod.POST, content);
        }
Пример #6
0
        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);
        }
Пример #7
0
 private static void MakeStaticCall(string url)
 {
     if (ReqInProgress)
     {
         return;
     }
     ReqInProgress = true;
     Ajax.MakeCall(url + "?r=" + new Date().ToUTCString(), new AjaxCallback(delegate(string err, string data, XHR xhr)
     {
         Window.Document.GetElementById("result").InnerHTML = data;
     }), HTTPMethod.GET);
     ReqInProgress = false;
 }
Пример #8
0
        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();
        }
Пример #9
0
        private static void HandlePermLinks(string p)
        {
            if (string.IsNullOrEmpty(p))
            {
                return;
            }
            string content = "p=" + p;

            Ajax.MakeCall("/GLink.ashx?r=" + new Date().ToUTCString(), new AjaxCallback(delegate(string err, string data, XHR xhr)
            {
                if (string.IsNullOrEmpty(data))
                {
                    return;
                }
                Util.SetValue("txt", data);
            }), HTTPMethod.POST, content);
        }
Пример #10
0
        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();
        }
Пример #11
0
        private static void Share(Rule R, string cc)
        {
            string r = Business.Rules3(R);
            string c = CSWriter.CodeIt(R);

            r = FixRequest(r);
            c = FixRequest(c);

            string content = "t=rc&e=" + cc + "&n=" + R.Name + "&r=" + r + "&c=" + c;

            Ajax.MakeCall("/Log.ashx", new AjaxCallback(delegate(string err, string data, XHR xhr)
            {
                Debug2.Write("Status: " + xhr.Status.ToString() + "<br />" +
                             "Error: " + err + "<br/>" +
                             "Response: " + data);
                if (xhr.Status.ToString() == "200")
                {
                    Window.Alert("మీరు పద్య లక్షణాలు 'ఛందం ©' తో పంచుకున్నందుకు చాలా సంతోషం.\nThanks for your contribution.! Details are Shared with  'Chandam©' team.");
                }
            }), HTTPMethod.POST, content);
        }