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);
        }
Exemple #2
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);
        }
Exemple #3
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;
        }
Exemple #4
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);
        }
Exemple #5
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);
        }
Exemple #6
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);
        }
        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);
        }