コード例 #1
0
        private bool DoWeShowLink()
        {
            bool showLink = true;

            if (UseSmartLink)
            {
                if ((!Page.IsPostBack) && (!DesignMode))
                {
                    if ((Uri.IsWellFormedUriString(NavigateUrl, UriKind.Absolute)) ||
                        (Uri.IsWellFormedUriString(NavigateUrl, UriKind.Relative)))
                    {
                        string localPath    = Page.Request.Url.LocalPath;
                        var    navigateUrl  = new Uri(Page.Request.Url, NavigateUrl);
                        string navigatePath = navigateUrl.LocalPath;
                        if (ComparePaths(localPath, navigatePath))
                        {
                            string queryString    = Page.Request.Url.Query;
                            string navigateString = navigateUrl.Query;
                            if (Normaliser.StringCompare(queryString, navigateString))
                            {
                                showLink = false;
                            }
                        }
                    }
                }
            }

            return(showLink);
        }
コード例 #2
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            const string MouseTemplate   = "onmousedown=\"return onButtonClick_dp_opgeek ('{0}', this);\" onclick=\"return false\"";
            const string ControlTemplate = "<input type=\"text\" name=\"{0}Display\" id=\"{0}Display\" size=\"18\" value=\"\" {5}readonly/><img align=\"absbottom\" vspace=\"1\" border=\"2\" id=\"{0}Icon\" name=\"{0}Icon\" src=\"{2}DatePickerIcon.gif\" width=\"19\" height=\"19\" {6}><input type=\"hidden\" class=\"DateBox_dp_opgeek\" name=\"{0}\" id=\"{0}\" value=\"{1}\"/><script type=\"text/javascript\">\n\tinitialize_dp_opgeek ('{0}', '{1}', true, '{7}', {3}, {4});\n</script>\n";

            string disableCode = String.Empty;
            string mouseHtml   = String.Empty;

            if (!Enabled)
            {
                disableCode = "disabled=\"disabled\" ";
            }
            else
            {
                mouseHtml = String.Format(Globalisation.GetCultureInfo(), MouseTemplate, ClientID);
            }

            string value = String.Empty;

            if (!IsEmpty)
            {
                value = Normaliser.GetOdbcFormatFromDate(Value);
            }

            string controlHtml = String.Format(Globalisation.GetCultureInfo(), ControlTemplate, ClientID, value, GetIconUrl(), FirstYear, LastYear, disableCode, mouseHtml, DisplayFormat);

            writer.Write(controlHtml);

            return;
        }
コード例 #3
0
        protected override void RenderContents(HtmlTextWriter htwOutput)
        {
            const string MouseTemplate    = "onmousedown=\"return onButtonDown_dp_opgeek ('{0}Icon');\" onmouseup=\"return onButtonUp_dp_opgeek ('{0}Icon');\" onmouseout=\"return onButtonUp_dp_opgeek ('{0}Icon');\" onclick=\"return onButtonClick_dp_opgeek ('{0}');\"";
            const string ControlTemplate  = "\n<div class=\"DatePicker_dp_opgeek\" id=\"{0}DatePicker_dp_opgeek\"></div><input type=\"text\" style=\"{3}{9}\" name=\"{0}Display\" id=\"{0}Display\" size=\"18\" value=\"\" {6}readonly/><img id=\"{0}Icon\" src=\"{2}\" width=\"{11}\" height=\"{10}\" {7} style=\"margin-bottom: -3px; background-color: menu; border-width: 1px; border-style: outset;\"><input type=\"hidden\" class=\"DateBox_dp_opgeek\" name=\"{0}\" id=\"{0}\" value=\"{1}\"/><script type=\"text/javascript\">\n\tinitialize_dp_opgeek ('{0}', true, '{8}', {4}, {5});\n</script>\n";
            string       backgroundColour = String.Empty;

            if (!ControlStyle.BackColor.IsEmpty)
            {
                backgroundColour = "background-color: " + String.Format(Globalisation.GetCultureInfo(), "#{0:x2}{1:x2}{2:x2}", ControlStyle.BackColor.R, ControlStyle.BackColor.G, ControlStyle.BackColor.B) + "; ";
            }

            string disableCode = String.Empty;
            string mouseHtml   = String.Empty;

            if (!Enabled)
            {
                disableCode = "disabled=\"disabled\" ";
            }
            else
            {
                mouseHtml = String.Format(Globalisation.GetCultureInfo(), MouseTemplate, ClientID);
            }

            string value = String.Empty;

            if (!IsEmpty)
            {
                value = Normaliser.GetOdbcFormatFromDate(Value);
            }

            string boxWidth = String.Empty;

            if ((!Width.IsEmpty) && (Width.Type == UnitType.Pixel))
            {
                int iWidth = (int)Width.Value - DatePickerConstants.ButtonWidth - 3;
                if (iWidth > 0)
                {
                    boxWidth = "width: " + iWidth + "px; ";
                }
                else
                {
                    boxWidth = "display: none;";
                }
            }

            string boxHeight = String.Empty;

            if ((!Height.IsEmpty) && (Height.Type == UnitType.Pixel))
            {
                boxHeight = "height: " + (Height.Value - DatePickerConstants.ButtonHeight - 3) + "px; ";
            }

            string boxSize = boxHeight + boxWidth;

            string controlHtml = String.Format(Globalisation.GetCultureInfo(), ControlTemplate, ClientID, value, GetIconUrl(), backgroundColour, FirstYear, LastYear, disableCode, mouseHtml, DisplayFormat, boxSize, DatePickerConstants.ButtonHeight, DatePickerConstants.ButtonWidth);

            htwOutput.Write(controlHtml);

            return;
        }
コード例 #4
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            const string MouseTemplate   = "onmousedown=\"return onButtonDown_dp_opgeek ('{0}Icon');\" onmouseup=\"return onButtonUp_dp_opgeek ('{0}Icon');\" onmouseout=\"return onButtonUp_dp_opgeek ('{0}Icon');\" onclick=\"return onButtonClick_dp_opgeek ('{0}');\"";
            const string ControlTemplate = "<span class=\"DatePicker_dp_opgeek\" id=\"{0}DatePicker_dp_opgeek\" style=\"position: absolute; display:\"></span><input type=\"text\" style=\"background-color: menu; font-size: 8pt; padding-top: 4; padding-left: 2;{8}\" name=\"{0}Display\" id=\"{0}Display\" size=\"18\" value=\"\" {5}readonly/><img id=\"{0}Icon\" name=\"{0}Icon\" src=\"{2}DatePickerIcon.gif\" width=\"{9}\" height=\"{10}\" valign=\"bottom\" {6} style=\"vertical-align: bottom; background-color: menu; border-width: 2px; border-style: outset;\"><input type=\"hidden\" class=\"DateBox_dp_opgeek\" name=\"{0}\" id=\"{0}\" value=\"{1}\"/><script type=\"text/javascript\">\n\tinitialize_dp_opgeek ('{0}', '{1}', true, '{7}', {3}, {4});\n</script>\n";

            string disableCode = String.Empty;
            string mouseHtml   = String.Empty;

            if (!Enabled)
            {
                disableCode = "disabled=\"disabled\" ";
            }
            else
            {
                mouseHtml = String.Format(Globalisation.GetCultureInfo(), MouseTemplate, ClientID);
            }

            string value = String.Empty;

            if (!IsEmpty)
            {
                value = Normaliser.GetOdbcFormatFromDate(Value);
            }

            string boxWidth = String.Empty;

            if ((!Width.IsEmpty) && (Width.Type == UnitType.Pixel))
            {
                int iWidth = (int)Width.Value - DatePickerConstants.ButtonWidth - 3;
                if (iWidth > 0)
                {
                    boxWidth = "width: " + iWidth + "px; ";
                }
                else
                {
                    boxWidth = "display: none;";
                }
            }

            string boxHeight = String.Empty;

            if ((!Height.IsEmpty) && (Height.Type == UnitType.Pixel))
            {
                boxHeight = "height: " + (Height.Value - DatePickerConstants.ButtonHeight - 3) + "px; ";
            }

            string boxSize = boxHeight + boxWidth;

            string controlHtml = String.Format(Globalisation.GetCultureInfo(), ControlTemplate, ClientID, value, GetIconUrl(), FirstYear, LastYear, disableCode, mouseHtml, DisplayFormat, boxSize, DatePickerConstants.ButtonHeight, DatePickerConstants.ButtonWidth);

            writer.Write(controlHtml);

            return;
        }
コード例 #5
0
        public static string GetCaseInsensitiveName(CssStyleCollection styles, string name)
        {
            string result = null;

            foreach (string currentName in styles.Keys)
            {
                if (Normaliser.StringCompare(currentName, name))
                {
                    result = currentName;
                }
            }

            return(result);
        }
コード例 #6
0
        ///
        /// <summary>
        /// Raises the Load event.
        /// </summary>
        /// <remarks>
        /// This method notifies the server control that it should perform actions common to each HTTP request
        /// for the page it is associated with, such as setting up a database query. At this stage in the page
        /// lifecycle, server controls in the hierarchy are created and initialized, view state is restored,
        /// and form controls reflect client-side data.
        /// </remarks>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        ///
        protected override void OnLoad(EventArgs e)
        {
//			if ((!_nLoadPostDataCalled) && (this.Page.IsPostBack))
//			{
//				LoadPostData (this.ID, HttpContext.Current.Request.Form);
//			}

            base.OnLoad(e);

            EnsureChildControls();

            _realField.AddAttributes(Attributes);
            foreach (string key in Style.Keys)
            {
                if (Normaliser.StringCompare(key, "position"))
                {
                    if (_explicitlyAbsolutelyPositioned)
                    {
                        _realField.Style.Add(key, Style [key]);
                    }
                }
                else if (!Normaliser.StringCompare(key, "display"))
                {
                    _realField.Style.Add(key, Style [key]);
                }
            }

            if (_explicitlyAbsolutelyPositioned)
            {
                string topName = CssHelper.GetCaseInsensitiveName(Style, "TOP");
                if (topName != null)
                {
                    Style.Remove(topName);
                }

                string leftName = CssHelper.GetCaseInsensitiveName(Style, "LEFT");
                if (leftName != null)
                {
                    Style.Remove(leftName);
                }
            }

            return;
        }
コード例 #7
0
        protected virtual string GetFontNameSelector()
        {
            var          fontSelectionOptions       = new StringBuilder();
            const string FontSelectorOptionTemplate = "<option value=\"{0}\"{2}>{1}</option>";

            for (int fontCounter = 0; fontCounter < _fontNameList.Length; fontCounter++)
            {
                string selectedMoniker = "";
                if (Normaliser.StringCompare(_controller.ControlStyle.Font.Name, _fontTitleList [fontCounter]))
                {
                    selectedMoniker = " selected";
                }
                string fontSelectorOption = String.Format(Globalisation.GetCultureInfo(), FontSelectorOptionTemplate, _fontNameList [fontCounter], _fontTitleList [fontCounter], selectedMoniker);
                fontSelectionOptions.Append(fontSelectorOption);
            }

            const string FontSelectorTemplate = "<select name=\"{0}FontName\" id=\"{0}FontName\" tabindex=\"-1\" onchange=\"setFontName_rtb_opgeek ('{0}'); return false;\" style=\"font-size: 10px; width: 80;\">{1}</select>";
            string       fontSelector         = String.Format(Globalisation.GetCultureInfo(), FontSelectorTemplate, _controller.UniqueID, fontSelectionOptions);

            return(fontSelector);
        }
コード例 #8
0
        private static bool IsMozilla()
        {
            bool isMozilla = false;

            if (HttpContext.Current != null)
            {
                string browser = HttpContext.Current.Request.Browser.Browser;
                if ((Normaliser.StringCompare(browser, "firefox")) ||
                    (Normaliser.StringCompare(browser, "mozilla")))
                {
                    isMozilla = true;
                }
                else if ((Normaliser.StringCompare(browser, "netscape")) &&
                         (HttpContext.Current.Request.Browser.MajorVersion >= 5))
                {
                    isMozilla = true;
                }
            }

            return(isMozilla);
        }
コード例 #9
0
        protected virtual string GetFontSizeSelector()
        {
            var          fontSizeSelectionOptions       = new StringBuilder();
            const string FontSizeSelectorOptionTemplate = "<option value=\"{0}\"{2}>{1}</option>";

            for (int fontSizeCounter = 1; fontSizeCounter < 8; fontSizeCounter++)
            {
                string pointSize       = "" + (8 + (2 * fontSizeCounter)) + "pt";
                string selectedMoniker = "";
                if (Normaliser.StringCompare(_controller.ControlStyle.Font.Size.Unit, pointSize))
                {
                    selectedMoniker = " selected";
                }
                string fontSizeSelectorOption = String.Format(Globalisation.GetCultureInfo(), FontSizeSelectorOptionTemplate, fontSizeCounter, pointSize, selectedMoniker);
                fontSizeSelectionOptions.Append(fontSizeSelectorOption);
            }

            const string FontSizeSelectorTemplate = "<select name=\"{0}FontSize\" id=\"{0}FontSize\" tabindex=\"-1\" onchange=\"setFontSize_rtb_opgeek ('{0}'); return false;\" style=\"font-size: 10px; width: 50;\">{1}</select>";
            string       fontSizeSelector         = String.Format(Globalisation.GetCultureInfo(), FontSizeSelectorTemplate, _controller.UniqueID, fontSizeSelectionOptions);

            return(fontSizeSelector);
        }
コード例 #10
0
        private static bool ComparePaths(string actual, string target)
        {
            bool match = false;

            if (Normaliser.StringCompare(actual, target))
            {
                match = true;
            }
            else
            {
                if (!target.EndsWith("/"))
                {
                    target += "/";
                }
                target += "default.aspx";

                if (Normaliser.StringCompare(actual, target))
                {
                    match = true;
                }
            }

            return(match);
        }
コード例 #11
0
ファイル: TextBox.cs プロジェクト: OpinionatedGeek/PowerPack
        ///
        /// <summary>
        /// Adds details of the prompt text to the control's attributes.
        /// </summary>
        /// <remarks>
        /// This method adds details of prompt text to the control's attribute collection as well as setting up
        /// the onFocus event.  This method is exposed so that it is available for derived classes that choose
        /// to override the Render () method, as well as allowing derived classes to override this behaviour.
        /// However, it is not recommended that you call or override this method since it is quite tightly coupled
        /// to the way the prompt text feature is implemented.
        /// </remarks>
        ///
        protected virtual void AddPromptAttributes()
        {
            if (!DesignMode)
            {
                BrowserType browserType = GetBrowserType();
                switch (browserType)
                {
                case BrowserType.IE5Up:
                case BrowserType.IE6Up:
                case BrowserType.IE7Up:
                    string iePrompt = String.Format(Globalisation.GetCultureInfo(), IEPromptActionTemplate, Prompt, Normaliser.NormaliseForJavascript(Text));
                    Attributes.Add("onFocus", iePrompt);
                    Attributes.Add("prompt", _prompt);
                    break;

                case BrowserType.FireFox2:
                case BrowserType.Mozilla:
                case BrowserType.WebKit:
                    string mozPrompt = String.Format(Globalisation.GetCultureInfo(), MozPromptActionTemplate, Prompt, Normaliser.NormaliseForJavascript(Text));
                    Attributes.Add("onFocus", mozPrompt);
                    Attributes.Add("prompt", _prompt);
                    break;

                case BrowserType.Netscape:
                    string netscapePrompt = String.Format(Globalisation.GetCultureInfo(), NSPromptActionTemplate, Prompt, Normaliser.NormaliseForJavascript(Text));
                    Attributes.Add("onFocus", netscapePrompt);
                    Attributes.Add("prompt", _prompt);
                    break;
                }
            }

            return;
        }