Exemplo n.º 1
0
        ///
        /// <summary>
        /// Raises the FocusScriptRequired event.
        /// </summary>
        /// <remarks>
        /// This method inserts the required client-side Javascript to set the control's focus.  This need not
        /// be called in derived classes if the client-side Javascript is not required - the event itself will
        /// still be raised.
        /// </remarks>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        ///
        protected virtual void OnFocusScriptRequired(EventArgs e)
        {
            if (!DesignMode)
            {
                BrowserType browserType = GetBrowserType();
                switch (browserType)
                {
                case BrowserType.IE5Up:
                case BrowserType.IE6Up:
                case BrowserType.IE7Up:
                    Page.ClientScript.RegisterClientScriptBlock(typeof(TextBox), GetTextBoxKey, IEGetTextBox);
                    string ieFocuser = String.Format(Globalisation.GetCultureInfo(), FocusActionTemplate, UniqueID);
                    Page.ClientScript.RegisterStartupScript(typeof(TextBox), FocusScriptKeyPrefix + UniqueID, ieFocuser);
                    break;

                case BrowserType.FireFox2:
                case BrowserType.Mozilla:
                case BrowserType.WebKit:
                    Page.ClientScript.RegisterClientScriptBlock(typeof(TextBox), GetTextBoxKey, MozAndNSGetTextBox);
                    string mozFocuser = String.Format(Globalisation.GetCultureInfo(), FocusActionTemplate, UniqueID);
                    Page.ClientScript.RegisterStartupScript(typeof(TextBox), FocusScriptKeyPrefix + UniqueID, mozFocuser);
                    break;

                case BrowserType.Netscape:
                    Page.ClientScript.RegisterClientScriptBlock(typeof(TextBox), GetTextBoxKey, MozAndNSGetTextBox);
                    string netscapeFocuser = String.Format(Globalisation.GetCultureInfo(), FocusActionTemplate, UniqueID);
                    Page.ClientScript.RegisterStartupScript(typeof(TextBox), FocusScriptKeyPrefix + UniqueID, netscapeFocuser);
                    break;
                }
            }

            return;
        }
Exemplo n.º 2
0
        public static DateTime GetDateFromOdbcFormat(string odbcDate)
        {
            DateTime date = DateTime.MinValue;

            try
            {
                string[] dateString  = odbcDate.Split('-', 'T');
                string   yearString  = dateString[0];
                string   monthString = dateString[1];
                string   dayString   = dateString[2];

                int year  = Convert.ToInt32(yearString, Globalisation.GetCultureInfo());
                int month = Convert.ToInt32(monthString, Globalisation.GetCultureInfo());
                int iDay  = Convert.ToInt32(dayString, Globalisation.GetCultureInfo());

                date = CreateDate(year, month, iDay);
            }
            catch (NullReferenceException)
            {
            }
            catch (FormatException)
            {
            }

            return(date);
        }
Exemplo n.º 3
0
        protected override string GetEditFrame()
        {
            const string FrameTemplate = "\n<textarea name=\"{1}\" id=\"{0}\" cols=40 rows=15 style=\"display: none\">{3}</textarea>\n<iframe src=\"{4}\" contentEditable=true name=\"{1}FrameName\" id=\"{1}FrameID\" width=\"{5}\" height=\"{6}\" style=\"{8}{9}\" class=\"{2}\"></iframe><br /><div id=\"{1}ContentID\" style=\"display: none\"><div style=\"{10}\">{3}</div></div><div id=\"{1}PromptID\" style=\"display: none\">{7}</div>";
            const string ColorTemplate = "#{0:x2}{1:x2}{2:x2}; ";
            string       foreColor     = String.Empty;

            if (!_controller.ControlStyle.ForeColor.IsEmpty)
            {
                foreColor = "color: " + String.Format(Globalisation.GetCultureInfo(), ColorTemplate, _controller.ControlStyle.ForeColor.R, _controller.ControlStyle.ForeColor.G, _controller.ControlStyle.ForeColor.B);
            }

            string backColor = String.Empty;

            if (!_controller.ControlStyle.BackColor.IsEmpty)
            {
                backColor = "background-color: " + String.Format(Globalisation.GetCultureInfo(), ColorTemplate, _controller.ControlStyle.BackColor.R, _controller.ControlStyle.BackColor.G, _controller.ControlStyle.BackColor.B);
            }

            string style  = GetStyleString();
            string prompt = "";

            if (!String.IsNullOrEmpty(_controller.Prompt))
            {
                prompt = (_controller.Page.IsPostBack ? String.Empty : "<div style=\"" + style + "\">" + _controller.Prompt + "</div>");
            }

            string frame = String.Format(Globalisation.GetCultureInfo(), FrameTemplate, _controller.ClientID, _controller.UniqueID, _controller.CssClass, _controller.Text, _controller.InitialPage, GetWidth(), GetHeight() - ToolbarControlHeight, prompt, foreColor, backColor, style);

            return(frame);
        }
Exemplo n.º 4
0
        ///
        /// <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;
        }
Exemplo n.º 5
0
        //============================================================
        // Methods
        //============================================================

        ///
        /// <summary>
        /// Ignored
        /// </summary>
        ///
        public string GetReplacement(string filteredWord)
        {
            int    listLength  = _blockedWords.Count;
            bool   found       = false;
            bool   replaced    = false;
            string replacement = "";

            for (int wordCounter = 0; ((!found) && (wordCounter < listLength)); wordCounter++)
            {
                if (filteredWord.ToUpper(Globalisation.GetCultureInfo()) == _blockedWords [wordCounter].Word.ToUpper(Globalisation.GetCultureInfo()))
                {
                    found = true;
                    if (_blockedWords [wordCounter].Replacement != null)
                    {
                        replacement = _blockedWords [wordCounter].Replacement;
                        replaced    = true;
                    }
                }
            }

            if (!replaced)
            {
                replacement = replacement.PadRight(filteredWord.Length, '*');
            }

            return(replacement);
        }
Exemplo n.º 6
0
        public virtual void Render(HtmlTextWriter writer)
        {
            const string textareaTemplate = "<textarea name=\"{0}\" id=\"{0}\" {5}{6}{7}rows=\"{3}\" cols=\"{4}\" class=\"{2}\">{1}</textarea>";
            string       disableCode      = String.Empty;

            if (!_controller.Enabled)
            {
                disableCode = "disabled=\"disabled\" ";
            }

            string onFocus = String.Empty;

            if (_controller.Attributes ["onFocus"] != null)
            {
                onFocus = "onFocus=\"" + _controller.Attributes ["onFocus"] + "\" ";
            }

            string prompt = String.Empty;

            if (_controller.Attributes ["prompt"] != null)
            {
                prompt = "prompt=\"" + _controller.Attributes ["prompt"] + "\" ";
            }

            string textareaHtml = String.Format(Globalisation.GetCultureInfo(), textareaTemplate, _controller.ID, _controller.BaseText, _controller.CssClass, _controller.Rows, _controller.Columns, onFocus, prompt, disableCode);

            writer.Write(textareaHtml);

            return;
        }
        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;
        }
Exemplo n.º 8
0
        protected virtual string GetToolbar2DisabledButton(string szButtonName, string szClippingRegion)
        {
            const string ButtonTemplate = "<div id=\"{0}{1}Disabled\" style=\"clip: {2}; z-index: 1; display: none; position: absolute; overflow: hidden;\"><img src=\"{5}\" alt=\"\" width=\"{4}\" height=\"{3}\" /></div>";
            string       button         = String.Format(Globalisation.GetCultureInfo(), ButtonTemplate, _controller.UniqueID, szButtonName, szClippingRegion, ToolbarControlHeight, Toolbar2DisabledWidth, _controller.Page.ClientScript.GetWebResourceUrl(typeof(WysiwygRTField), RTConstants.Toolbar2DisabledResource));

            return(button);
        }
        //============================================================
        // Properties
        //============================================================

        //============================================================
        // Events
        //============================================================

        ///
        /// <summary>
        /// Loads the control.
        /// </summary>
        /// <remarks>
        /// Note for inheritors - for this control to function properly, any derived controls that override
        /// this method should ensure that they call this base method as part of their OnLoad.
        /// </remarks>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        ///
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (Enabled)
            {
                string dhtmlResourceName = GetDhtmlFileResourceName();
                if (!String.IsNullOrEmpty(dhtmlResourceName))
                {
                    Page.ClientScript.RegisterClientScriptResource(typeof(ShowOnConditionClientSide), dhtmlResourceName);
                }

                Control controlToHide = FindControl(ControlToHide);
                Control controlToTest = FindControl(ControlToTest);

                const string ShowOnConditionTemplate = @"<script language=""javascript"">
	initialize_hi_opgeek ('{0}', '{1}', '{2}', '{3}', '{4}');
</script>";

                string showOnConditionControl = String.Format(Globalisation.GetCultureInfo(), ShowOnConditionTemplate, ClientID, controlToTest.ClientID, controlToHide.ClientID, ShowOnConditionValue, ShowOnConditionNotValue);
                Page.ClientScript.RegisterStartupScript(typeof(ShowOnConditionClientSide), ClientID, showOnConditionControl);
            }

            return;
        }
Exemplo n.º 10
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;
        }
Exemplo n.º 11
0
        protected override string GetEditFrame()
        {
            const string FrameTemplate = "\n<textarea name=\"{1}\" id=\"{0}\" cols=\"40\" rows=\"15\" style=\"display: none;\">{3}</textarea>\n<iframe name=\"{1}FrameName\" id=\"{1}FrameID\" style=\"{5}{6}{7}; width: 100%; height: 100%;\" class=\"{2}\" contentEditable=\"true\"></iframe><br /><div id=\"{1}ContentID\" style=\"display: none\"><div style=\"{7}\">{3}</div></div><div id=\"{1}PromptID\" style=\"display: none\">{4}</div>";

            const string colorTemplate = "#{0:x2}{1:x2}{2:x2}";
            string       foreColor     = String.Empty;

            if (!_controller.ControlStyle.ForeColor.IsEmpty)
            {
                foreColor = "color: " + String.Format(Globalisation.GetCultureInfo(), colorTemplate, _controller.ControlStyle.ForeColor.R, _controller.ControlStyle.ForeColor.G, _controller.ControlStyle.ForeColor.B);
            }

            string backColor = String.Empty;

            if (!_controller.ControlStyle.BackColor.IsEmpty)
            {
                backColor = "background-color: " + String.Format(Globalisation.GetCultureInfo(), colorTemplate, _controller.ControlStyle.BackColor.R, _controller.ControlStyle.BackColor.G, _controller.ControlStyle.BackColor.B);
            }

            string style  = GetStyleString();
            string prompt = (ControlHelper.IsPostBack ? String.Empty : "<div style=\"" + style + "\">" + _controller.Prompt + "</div>");

            string frame = String.Format(Globalisation.GetCultureInfo(), FrameTemplate, _controller.ClientID, _controller.UniqueID, _controller.CssClass, _controller.Text, prompt, foreColor, backColor, style);

            return(frame);
        }
        //============================================================
        // Events
        //============================================================

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            Page.ClientScript.RegisterHiddenField(_id, "1");

            if (_value != DateTime.MinValue)
            {
                if (_value.Year < FirstYear)
                {
                    // Set the date to the first of January of the first year.
                    _value = DateTime.Parse("01/01/" + FirstYear + " 00:00:00", Globalisation.GetCultureInfo());
                    // Can set it to the current date in the first year instead:
                    //_value = _value.AddYears (FirstYear - _value.Year);
                }
                else if (_value.Year > LastYear)
                {
                    // Set the date to the first of January of the last year.
                    _value = DateTime.Parse("01/01/" + LastYear + " 00:00:00", Globalisation.GetCultureInfo());
                    // Can set it to the current date in the last year instead:
                    //_value = _value.AddYears (LastYear - _value.Year);
                }
            }

            string dhtmlResourceName = GetDhtmlFileResourceName();

            if (!String.IsNullOrEmpty(dhtmlResourceName))
            {
                Page.ClientScript.RegisterClientScriptResource(typeof(DefaultDatePickerField), dhtmlResourceName);
            }

            return;
        }
Exemplo n.º 13
0
        //============================================================
        // Methods
        //============================================================

        ///
        /// <summary>
        /// Creates a new configuration handler and adds it to the section handler collection.
        /// </summary>
        /// <remarks>
        /// Performs the regular handling of configuration sections, plus our custom handling of compound values
        /// and inner-XML values.
        /// <seealso cref="PowerPackConfigurationSection"/>
        /// </remarks>
        /// <param name="parent">The configuration settings in a corresponding parent configuration section.</param>
        /// <param name="configContext">The virtual path for which the configuration section handler computes
        /// configuration values. Normally this parameter is reserved and is a null reference (<b>Nothing</b>
        /// in Visual Basic).</param>
        /// <param name="section">The <see cref="XmlNode"/> that contains the configuration information to be
        /// handled. Provides direct access to the XML contents of the configuration section.</param>
        /// <returns>A <see cref="PowerPackConfigurationSection"/>.</returns>
        ///
        public object Create(object parent, object configContext, XmlNode section)
        {
            if (section == null)
            {
                throw new ArgumentNullException("section", Globalisation.GetString("argumentCannotBeNull"));
            }

            PowerPackConfigurationSection settings = parent == null ? new PowerPackConfigurationSection() : new PowerPackConfigurationSection((NameValueCollection)parent);

            foreach (XmlNode node in section.ChildNodes)
            {
                string key;
                if (node.Name == "add")
                {
                    key = GetKey(node);
                    string value = GetValue(node);
                    settings.Add(key, value);
                }
                else if (node.Name == "remove")
                {
                    key = GetKey(node);
                    settings.Remove(key);
                }
                else if (node.Name == "clear")
                {
                    settings.Clear();
                }
            }

            return(settings);
        }
Exemplo n.º 14
0
        protected virtual string GetRegularToolbarButton(string szButtonName, string szButtonTitle)
        {
            const string ButtonTemplate = "<td width=\"{4}\"><img src=\"{5}\" alt=\"{2}\" height=\"{3}\" width=\"{4}\" name=\"{0}{1}\" onmousedown=\"handleMouseClick_rtb_opgeek ('{0}', '{1}'); return false;\" onmouseover=\"handleMouseOver_rtb_opgeek ('{0}', '{1}'); return false;\" onmouseup=\"handleMouseUp_rtb_opgeek ('{0}', '{1}'); return false;\" onmouseout=\"handleMouseOut_rtb_opgeek ('{0}', '{1}'); return false;\" /></td>";
            string       button         = String.Format(Globalisation.GetCultureInfo(), ButtonTemplate, _controller.UniqueID, szButtonName, szButtonTitle, ToolbarControlHeight, ButtonWidth, _controller.Page.ClientScript.GetWebResourceUrl(typeof(WysiwygRTField), RTConstants.ButtonNormalResource));

            return(button);
        }
Exemplo n.º 15
0
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="PrintButton"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="PrintButton"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public PrintButton()
        {
            _license = LicenseManager.Validate(typeof(PrintButton), this);

            Text = Globalisation.GetString("printButtonDefaultText");

            return;
        }
Exemplo n.º 16
0
        protected override string GetEditorActivator()
        {
            var activation = new StringBuilder();

            const string ActivationTemplate = @"
	activateField_rtb_opgeek ('{0}', '{2}');
	{1}
";

            string activationCode = @"
	function showContextMenu_{0}_rtb_opgeek ()
	{{
		showContextMenu_rtb_opgeek ('{1}');
		return false;
	}}

	function setState_{0}_rtb_opgeek ()
	{{
		setState_rtb_opgeek ('{1}');
		return true;
	}}

	var editControl_{0}_rtb_opgeek = frames ['{1}FrameID'].document;
";

            const string SetupTemplate = @"

	document.getElementById ('{1}FrameID').onfocus = prepareForSubmission_rtb_opgeek;
	document.getElementById ('{1}FrameID').onblur = prepareForSubmission_rtb_opgeek;
	setFontName_rtb_opgeek ('{1}');
	setFontSize_rtb_opgeek ('{1}');
	finaliseFieldReadiness_rtb_opgeek ('{1}', '{5}', '{6}', '{3}', '{4}');
";

            string text = SafeContents;

            if (_promptRequired)
            {
                text = _controller.Prompt;
            }

            string foreColor = GetForeColor();
            string backColor = GetBackColor();

            if (_controller.Enabled)
            {
                activationCode = String.Format(Globalisation.GetCultureInfo(), ActivationTemplate, _controller.UniqueID, activationCode, _controller.GrabFocus);
            }

            activation.Append("<script type=\"text/javascript\" type=\"text/javascript\">\n");
            activation.Append(activationCode);
            activation.Append(SetupTemplate);
            activation.Append("</script>\n");

            string editorActivator = String.Format(Globalisation.GetCultureInfo(), activation.ToString(), _controller.ClientID, _controller.UniqueID, text, foreColor, backColor, _controller.ControlStyle.Font.Name, _controller.ControlStyle.Font.Size);

            return(editorActivator);
        }
Exemplo n.º 17
0
        public static void Exception(Exception exception, string format, params object[] parameters)
        {
            string caller    = GetCaller();
            string formatted = String.Format(Globalisation.GetCultureInfo(), format, parameters);

            DebugWriter(formatted + exception, caller);

            return;
        }
Exemplo n.º 18
0
        public static void EmptyMethod(string format, params object[] parameters)
        {
            string caller    = GetCaller();
            string formatted = String.Format(Globalisation.GetCultureInfo(), format, parameters);

            DebugWriter(formatted, caller);

            return;
        }
Exemplo n.º 19
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            string initialisationCode = String.Format(Globalisation.GetCultureInfo(), InitialisationCodeTemplate, Parent.ClientID, ClientID);

            Page.ClientScript.RegisterStartupScript(typeof(IE6ComboBoxField), UniqueID, BuildClientScriptBlock(initialisationCode));

            return;
        }
Exemplo n.º 20
0
        private string GetInnerHtml()
        {
            var outputBuffer           = new StringBuilder("");
            var outputBufferWriter     = new StringWriter(outputBuffer, Globalisation.GetCultureInfo());
            var outputBufferHtmlWriter = new HtmlTextWriter(outputBufferWriter);

            RenderChildren(outputBufferHtmlWriter);

            return(outputBuffer.ToString());
        }
Exemplo n.º 21
0
        protected override string GetImagePrepopulation()
        {
            const string ImageTemplate = "<img src=\"{0}\" style=\"display: none\" />";

            string normal = String.Format(Globalisation.GetCultureInfo(), ImageTemplate, GetButtonNormal());
            string up     = String.Format(Globalisation.GetCultureInfo(), ImageTemplate, GetButtonUp());
            string down   = String.Format(Globalisation.GetCultureInfo(), ImageTemplate, GetButtonDown());

            return(normal + up + down);
        }
Exemplo n.º 22
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;
        }
Exemplo n.º 23
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)
        {
            base.OnLoad(e);

            if (String.IsNullOrEmpty(Text))
            {
                Text = Globalisation.GetString("makeMeHomePageDefaultText");
            }

            MakeMeHomePageAction.AddAttributes(Attributes);

            return;
        }
Exemplo n.º 24
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)
        {
            base.OnLoad(e);

            if (String.IsNullOrEmpty(Text))
            {
                Text = Globalisation.GetString("printButtonDefaultText");
            }

            PrintAction.AddAttributes(Attributes);

            return;
        }
Exemplo n.º 25
0
        protected string GetBackColor()
        {
            const string colorTemplate = "#{0:x2}{1:x2}{2:x2}";
            string       backColor     = RTConstants.DefaultBackColour;

            if (!_controller.ControlStyle.BackColor.IsEmpty)
            {
                backColor = String.Format(Globalisation.GetCultureInfo(), colorTemplate,
                                          _controller.ControlStyle.BackColor.R,
                                          _controller.ControlStyle.BackColor.G,
                                          _controller.ControlStyle.BackColor.B);
            }
            return(backColor);
        }
Exemplo n.º 26
0
        ///
        /// <summary>
        /// Manages the state data in the ViewState.
        /// </summary>
        /// <remarks>
        /// Loads the new state of the panel in from the postback data.
        /// </remarks>
        /// <param name="postDataKey">The key identified for the control.</param>
        /// <param name="postCollection">The collection of all incoming name values.</param>
        /// <returns><b>True</b> if the server control's state changes as a result of the post back; otherwise <b>false</b>.</returns>
        ///
        public virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)
        {
            string postedStateString = Context.Request.Form [UniqueID + "_Hidden"];
            bool   postedState       = Convert.ToBoolean(postedStateString, Globalisation.GetCultureInfo());

            bool stateChanged = false;

            if ((EnableClientScript) && (Expand != postedState))
            {
                Expand       = postedState;
                stateChanged = true;
            }

            return(stateChanged);
        }
Exemplo n.º 27
0
        internal static void EnsureIdSet(Control control)
        {
            if (String.IsNullOrEmpty(control.ID))
            {
                // This line forces the creation of the unique ID
#pragma warning disable 168
                string discardedClientID = control.ClientID;
#pragma warning restore 168
                control.ID = control.ID;
            }

            if (String.IsNullOrEmpty(control.ID))
            {
                throw new InvalidProgramException(Globalisation.GetString("failedToSetControlId"));
            }

            return;
        }
Exemplo n.º 28
0
        //============================================================
        // Properties
        //============================================================

        //============================================================
        // Events
        //============================================================

        //============================================================
        // Methods
        //============================================================

        protected override string GetFontColorSelector()
        {
            var          colorOptions        = new StringBuilder("");
            const string ColorOptionTemplate = "<option value=\"{0}\" style=\"color: {1}{2};\"{3}>A&nbsp;</option>";

            for (int colorCounter = 0; colorCounter < _fontColorList.Length; colorCounter++)
            {
                string selectedMoniker = (_fontColorList [colorCounter] == "Black" ? " selected" : "");
                string backgroundColor = (_fontColorList [colorCounter] == "White" ? "; background-color: Black" : "");
                string colorOption     = String.Format(Globalisation.GetCultureInfo(), ColorOptionTemplate, _fontColorList [colorCounter], _fontColorList [colorCounter], backgroundColor, selectedMoniker);
                colorOptions.Append(colorOption);
            }

            const string ColorSelectorTemplate = "<select name=\"{0}ForeColor\" id=\"{0}ForeColor\" tabindex=\"1\" onchange=\"setFontColor_rtb_opgeek ('{0}'); return false;\" style=\"background-color: white; font-style: italic; font-weight: bold; width: 45px; font-size: 11px;\">{1}</select>";
            string       colorSelector         = String.Format(Globalisation.GetCultureInfo(), ColorSelectorTemplate, _controller.UniqueID, colorOptions);

            return(colorSelector);
        }
Exemplo n.º 29
0
        protected virtual string GetBackgroundColorSelector()
        {
            var          colorOptions        = new StringBuilder();
            const string ColorOptionTemplate = "<option value=\"{0}\" style=\"background-color: {1};\"{2}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>";

            colorOptions.Append("<option value=\"transparent\" style=\"background-color: transparent; font-style: italic;\">&nbsp;Transparent&nbsp;&nbsp;</option>");
            for (int colorCounter = 0; colorCounter < _fontColorList.Length; colorCounter++)
            {
                string selectedMoniker = (_fontColorList [colorCounter] == "White" ? " selected" : "");
                string colorOption     = String.Format(Globalisation.GetCultureInfo(), ColorOptionTemplate, _fontColorList [colorCounter], _fontColorList [colorCounter], selectedMoniker);
                colorOptions.Append(colorOption);
            }

            const string ColorSelectorTemplate = "<select name=\"{0}HiliteColor\" id=\"{0}HiliteColor\" tabindex=\"-1\" onchange=\"setBackColor_rtb_opgeek ('{0}'); return false;\" style=\"width: 85px; font-size: 10px; \">{1}</select>";
            string       colorSelector         = String.Format(Globalisation.GetCultureInfo(), ColorSelectorTemplate, _controller.UniqueID, colorOptions);

            return(colorSelector);
        }
Exemplo n.º 30
0
        private void BuildDynamicTable()
        {
            _titleHyperLink.EnableViewState = true;

            _titleCell.Controls.Add(_titleHyperLink);

            _hiddenState.Value = IsExpanded().ToString(Globalisation.GetCultureInfo());

            _titleCell.Controls.Add(_hiddenState);

            string hiddenState = Page.Request.Form [_hiddenState.Name];

            if (!String.IsNullOrEmpty(hiddenState))
            {
                Expand = Convert.ToBoolean(hiddenState, Globalisation.GetCultureInfo());
            }

            return;
        }