Пример #1
0
        protected override void RenderControl(string requesterUniqueID)
        {
            this.BlockIDsToUpdate = base.FixBlockIDs(this);

            // Password Control does not have any ContentArguments, That's why it copies it's parent Arguments
            if (this.Parent != null)
            {
                this.ContentArguments.Replace(this.Parent.ContentArguments);
            }

            // Render Text Content
            this.Text = ControllerHelper.RenderSingleContent(this.Text, this, this.ContentArguments, requesterUniqueID);
            if (!string.IsNullOrEmpty(this.Text))
            {
                this.Attributes["value"] = this.Text;
            }
            else
            {
                this.Attributes.Remove("value");
            }

            // Render Bind Parameters
            this.Bind = ControllerHelper.RenderBind(this.Bind, this, this.ContentArguments, requesterUniqueID);

            // Define onKeyDown Server event for Button
            string xeoraCall = string.Empty;

            if (this.Bind != null)
            {
                if (this.IsUpdateBlockController)
                {
                    xeoraCall = string.Format(
                        "__XeoraJS.update('{1}', '{0}')",
                        Manager.AssemblyCore.EncodeFunction(
                            Helpers.Context.HashCode,
                            this.Bind.ToString()
                            ),
                        string.Join(",", this.BlockIDsToUpdate)
                        );
                }
                else
                {
                    xeoraCall = string.Format(
                        "__XeoraJS.post('{0}')",
                        Manager.AssemblyCore.EncodeFunction(
                            Helpers.Context.HashCode,
                            this.Bind.ToString()
                            )
                        );
                }
            }

            string keydownEvent = this.Attributes["onkeydown"];

            keydownEvent = base.CleanJavascriptSignature(keydownEvent);

            if (!string.IsNullOrEmpty(xeoraCall))
            {
                keydownEvent = string.Format("{0}{1};", keydownEvent, xeoraCall);
            }

            if (!string.IsNullOrEmpty(this.DefaultButtonID))
            {
                keydownEvent =
                    string.Format(
                        "{0}if(event.keyCode==13){{document.getElementById('{1}').click();}};",
                        keydownEvent, this.DefaultButtonID
                        );
            }

            if (!string.IsNullOrEmpty(keydownEvent))
            {
                keydownEvent = string.Format("javascript:try{{{0}}}catch(ex){{}};", keydownEvent);
            }

            this.Attributes["onkeydown"] = keydownEvent;
            // !--

            // Render Attributes
            for (int aC = 0; aC < this.Attributes.Count; aC++)
            {
                AttributeDefinition item = this.Attributes[aC];

                this.Attributes[aC] =
                    new AttributeDefinition(
                        item.Key,
                        ControllerHelper.RenderSingleContent(item.Value, this, this.ContentArguments, requesterUniqueID)
                        );
            }
            // !--

            if (this.Security.Disabled.Set && this.Security.Disabled.Type == SecurityDefinition.DisabledDefinition.Types.Dynamic)
            {
                this.RenderedValue = this.Security.Disabled.Value;
            }
            else
            {
                this.RenderedValue =
                    string.Format(
                        "<input type=\"password\" name=\"{0}\" id=\"{0}\"{1}>",
                        this.ControlID, this.Attributes.ToString()
                        );
            }

            this.Mother.Scheduler.Fire(this.ControlID);
        }
Пример #2
0
        protected override void RenderControl(string requesterUniqueID)
        {
            this.BlockIDsToUpdate = base.FixBlockIDs(this);

            // RadioButton Control does not have any ContentArguments, That's why it copies it's parent Arguments
            if (this.Parent != null)
            {
                this.ContentArguments.Replace(this.Parent.ContentArguments);
            }

            // Render Text Content
            this.Text = ControllerHelper.RenderSingleContent(this.Text, this, this.ContentArguments, requesterUniqueID);

            string itemIndex     = (string)this.ContentArguments["_sys_ItemIndex"];
            string radioButtonID = this.ControlID;

            if (itemIndex != null)
            {
                radioButtonID = string.Format("{0}_{1}", this.ControlID, itemIndex);
            }
            string radioButtonLabel =
                string.Format("<label for=\"{0}\">{1}</label>", radioButtonID, this.Text);

            // Render Bind Parameters
            this.Bind = ControllerHelper.RenderBind(this.Bind, this, this.ContentArguments, requesterUniqueID);

            // Define OnClick Server event for Button
            if (this.Bind != null)
            {
                string xeoraCall;

                if (this.IsUpdateBlockController)
                {
                    xeoraCall = string.Format(
                        "__XeoraJS.update('{1}', '{0}')",
                        Manager.AssemblyCore.EncodeFunction(
                            Helpers.Context.HashCode,
                            this.Bind.ToString()
                            ),
                        string.Join(",", this.BlockIDsToUpdate)
                        );
                }
                else
                {
                    xeoraCall = string.Format(
                        "__XeoraJS.post('{0}')",
                        Manager.AssemblyCore.EncodeFunction(
                            Helpers.Context.HashCode,
                            this.Bind.ToString()
                            )
                        );
                }

                if (string.IsNullOrEmpty(this.Attributes["onclick"]))
                {
                    this.Attributes["onclick"] = string.Format("javascript:{0};", xeoraCall);
                }
                else
                {
                    this.Attributes["onclick"] = base.CleanJavascriptSignature(this.Attributes["onclick"]);

                    this.Attributes["onclick"] =
                        string.Format(
                            "javascript:try{{{0};{1};}}catch(ex){{}};",
                            this.Attributes["onclick"], xeoraCall
                            );
                }
            }
            // !--

            // Render Attributes
            for (int aC = 0; aC < this.Attributes.Count; aC++)
            {
                AttributeDefinition item = this.Attributes[aC];

                this.Attributes[aC] =
                    new AttributeDefinition(
                        item.Key,
                        ControllerHelper.RenderSingleContent(item.Value, this, this.ContentArguments, requesterUniqueID)
                        );
            }
            // !--

            if (this.Security.Disabled.Set && this.Security.Disabled.Type == SecurityDefinition.DisabledDefinition.Types.Dynamic)
            {
                this.RenderedValue = this.Security.Disabled.Value;
            }
            else
            {
                this.RenderedValue =
                    string.Format(
                        "<input type=\"radio\" name=\"{0}\" id=\"{1}\"{2}>{3}",
                        this.ControlID,
                        radioButtonID,
                        this.Attributes.ToString(),
                        radioButtonLabel
                        );
            }

            this.Mother.Scheduler.Fire(this.ControlID);
        }
Пример #3
0
        protected override void RenderControl(string requesterUniqueID)
        {
            this.BlockIDsToUpdate = base.FixBlockIDs(this);

            // LinkButton Control does not have any ContentArguments, That's why it copies it's parent Arguments
            if (this.Parent != null)
            {
                this.ContentArguments.Replace(this.Parent.ContentArguments);
            }

            // Render Text Content
            this.Text = ControllerHelper.RenderSingleContent(this.Text, this, this.ContentArguments, requesterUniqueID);

            // href attribute is disabled always, use url attribute instand of...
            this.Attributes.Remove("href");
            this.Attributes.Remove("value");

            if (this.URL != null && this.URL.Trim().Length > 0)
            {
                if (this.URL.IndexOf("~/") == 0)
                {
                    this.URL = this.URL.Remove(0, 2);
                    this.URL = this.URL.Insert(0, Configurations.Xeora.Application.Main.ApplicationRoot.BrowserImplementation);
                }
                else if (this.URL.IndexOf("¨/") == 0)
                {
                    this.URL = this.URL.Remove(0, 2);
                    this.URL = this.URL.Insert(0, Configurations.Xeora.Application.Main.VirtualRoot);
                }

                // Render URL Content
                this.URL = ControllerHelper.RenderSingleContent(this.URL, this, this.ContentArguments, requesterUniqueID);
                if (!string.IsNullOrEmpty(this.URL))
                {
                    this.Attributes["href"] = this.URL;
                }
            }

            if (string.IsNullOrWhiteSpace(this.URL))
            {
                this.URL = "#_action0";
            }

            if (this.Bind != null)
            {
                this.URL = "#_action1";

                if (this.Security.Disabled.Set && this.Security.Disabled.Type == SecurityDefinition.DisabledDefinition.Types.Dynamic)
                {
                    this.Text = this.Security.Disabled.Value;
                }
            }

            // Render Bind Parameters
            this.Bind = ControllerHelper.RenderBind(this.Bind, this, this.ContentArguments, requesterUniqueID);

            // Define OnClick Server event for Button
            if (this.Bind != null)
            {
                string xeoraCall;

                if (this.IsUpdateBlockController)
                {
                    xeoraCall = string.Format(
                        "__XeoraJS.update('{1}', '{0}')",
                        Manager.AssemblyCore.EncodeFunction(
                            Helpers.Context.HashCode,
                            this.Bind.ToString()
                            ),
                        string.Join(",", this.BlockIDsToUpdate)
                        );
                }
                else
                {
                    xeoraCall = string.Format(
                        "__XeoraJS.post('{0}')",
                        Manager.AssemblyCore.EncodeFunction(
                            Helpers.Context.HashCode,
                            this.Bind.ToString()
                            )
                        );
                }

                if (string.IsNullOrEmpty(this.Attributes["onclick"]))
                {
                    this.Attributes["onclick"] = string.Format("javascript:{0};", xeoraCall);
                }
                else
                {
                    this.Attributes["onclick"] = base.CleanJavascriptSignature(this.Attributes["onclick"]);

                    this.Attributes["onclick"] =
                        string.Format(
                            "javascript:try{{{0};{1};}}catch(ex){{}};",
                            this.Attributes["onclick"], xeoraCall
                            );
                }
            }
            // !--

            // Render Attributes
            for (int aC = 0; aC < this.Attributes.Count; aC++)
            {
                AttributeDefinition item = this.Attributes[aC];

                this.Attributes[aC] =
                    new AttributeDefinition(
                        item.Key,
                        ControllerHelper.RenderSingleContent(item.Value, this, this.ContentArguments, requesterUniqueID)
                        );
            }
            // !--

            if (this.Security.Disabled.Set && this.Security.Disabled.Type == SecurityDefinition.DisabledDefinition.Types.Dynamic)
            {
                this.RenderedValue = this.Security.Disabled.Value;
            }
            else
            {
                this.RenderedValue =
                    string.Format(
                        "<a name=\"{0}\" id=\"{0}\"{1}>{2}</a>",
                        this.ControlID, this.Attributes.ToString(), this.Text
                        );
            }

            this.Mother.Scheduler.Fire(this.ControlID);
        }