Ejemplo n.º 1
1
 public override void RenderWebPart(HtmlTextWriter writer, WebPart webPart)
 {
     if (webPart == null)
     {
         throw new ArgumentNullException("webPart");
     }
     base.Zone.PartChromeStyle.AddAttributesToRender(writer, base.Zone);
     writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
     writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
     writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
     writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
     if (webPart.Hidden && !base.WebPartManager.DisplayMode.ShowHiddenWebParts)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
     }
     writer.RenderBeginTag(HtmlTextWriterTag.Table);
     writer.RenderBeginTag(HtmlTextWriterTag.Tr);
     writer.RenderBeginTag(HtmlTextWriterTag.Td);
     if (base.WebPartManager.DisplayMode == WebPartManager.EditDisplayMode || webPart.ChromeType != PartChromeType.None)
     {
         this.RenderTitleBar(writer, webPart);
     }
     writer.RenderEndTag();
     writer.RenderEndTag();
     writer.RenderBeginTag(HtmlTextWriterTag.Tr);
     base.Zone.PartStyle.AddAttributesToRender(writer, base.Zone);
     writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, base.Zone.PartChromePadding.ToString());
     writer.RenderBeginTag(HtmlTextWriterTag.Td);
     this.RenderPartContents(writer, webPart);
     writer.RenderEndTag();
     writer.RenderEndTag();
     writer.RenderEndTag();
 }
Ejemplo n.º 2
0
        public string Execute(string[] parameters)
        {
            if (parameters.Any() == false)
            {
                throw new ArgumentOutOfRangeException();
            }

            var giphy = new GiphyService();
            var search = string.Join(" ", parameters);

            var result = giphy.GetGiphyRandom(search);

            // Build the image tag
            using (var sw = new StringWriter())
            {
                using (var htmlWriter = new HtmlTextWriter(sw))
                {
                    htmlWriter.AddAttribute(HtmlTextWriterAttribute.Src, result);
                    htmlWriter.AddAttribute(HtmlTextWriterAttribute.Alt, search);
                    htmlWriter.RenderBeginTag(HtmlTextWriterTag.Img);
                    htmlWriter.RenderEndTag();

                    return sw.ToString();
                }
            }
        }
Ejemplo n.º 3
0
        /// <Summary>RenderEditMode renders the Edit mode of the control</Summary>
        /// <Param name="writer">A HtmlTextWriter.</Param>
        protected override void RenderEditMode( HtmlTextWriter writer )
        {
            PortalSettings _portalSettings = Globals.GetPortalSettings();

            //Get the Pages
            ArrayList tabs = Globals.GetPortalTabs(_portalSettings.PortalId, true, true, false, false, false);

            //Render the Select Tag
            ControlStyle.AddAttributesToRender(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);
            writer.RenderBeginTag(HtmlTextWriterTag.Select);

            for (int tabIndex = 0; tabIndex <= tabs.Count - 1; tabIndex++)
            {
                TabInfo tab = (TabInfo)tabs[tabIndex];

                //Add the Value Attribute
                writer.AddAttribute(HtmlTextWriterAttribute.Value, tab.TabID.ToString());

                if (tab.TabID == IntegerValue)
                {
                    //Add the Selected Attribute
                    writer.AddAttribute(HtmlTextWriterAttribute.Selected, "selected");
                }

                //Render Option Tag
                writer.RenderBeginTag(HtmlTextWriterTag.Option);
                writer.Write(tab.TabName);
                writer.RenderEndTag();
            }

            //Close Select Tag
            writer.RenderEndTag();
        }
Ejemplo n.º 4
0
        protected override void RenderBeginTag(HtmlTextWriter writer)
        {
            // Div
            writer.AddAttribute(HtmlTextWriterAttribute.Class, WRAPPER_CSS_CLASS);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.Control.ClientID);
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.Indent++;

            // Ul
            string cssClass = "";
            if (!string.IsNullOrEmpty(this.Control.CssClass))
            {
                cssClass = this.Control.CssClass;
            }

            CheckBoxList checkList = this.Control as CheckBoxList;
            if (checkList != null)
            {
                cssClass += " " + REPEATDIRECTION_CSS_CLASS + checkList.RepeatDirection.ToString();
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass.Trim());

            writer.RenderBeginTag(HtmlTextWriterTag.Ul);
        }
Ejemplo n.º 5
0
        public void RenderLabel(HtmlTextWriter textWriter, FormElement formElement, IFormBuilderParameters formBuilderParameters)
        {
            var bootStrapBuilderParameters = (BootStrapBuilderParameters)formBuilderParameters;
            // if there is a Name specified in the DisplayAttribute use it , other wise use the property name 
            var displayName = formElement.ControlSpecs.ControlName.SpacePascal();

            if (!String.IsNullOrEmpty(formElement.ControlSpecs.Name))
            {
                displayName = formElement.ControlSpecs.Name;
            }

            // Label
            if (bootStrapBuilderParameters.FormType == BootstrapFormType.Horizontal)
            {
                textWriter.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-3 control-label");
            }
            else
            {
                textWriter.AddAttribute(HtmlTextWriterAttribute.Class, "control-label");
            }
            textWriter.AddAttribute(HtmlTextWriterAttribute.For, formElement.ControlSpecs.ControlName);
            textWriter.RenderBeginTag(HtmlTextWriterTag.Label);
            textWriter.Write(displayName);
            textWriter.RenderEndTag(); // label
        }
 protected override void AddAttributesToRender(HtmlTextWriter writer)
 {
     string associatedControlID = this.AssociatedControlID;
     if (associatedControlID.Length != 0)
     {
         if (this.AssociatedControlInControlTree)
         {
             Control control = this.FindControl(associatedControlID);
             if (control == null)
             {
                 if (!base.DesignMode)
                 {
                     throw new HttpException(System.Web.SR.GetString("LabelForNotFound", new object[] { associatedControlID, this.ID }));
                 }
             }
             else
             {
                 writer.AddAttribute(HtmlTextWriterAttribute.For, control.ClientID);
             }
         }
         else
         {
             writer.AddAttribute(HtmlTextWriterAttribute.For, associatedControlID);
         }
     }
     base.AddAttributesToRender(writer);
 }
Ejemplo n.º 7
0
 protected virtual void RenderTitleBar(HtmlTextWriter writer, WebPart webPart)
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
     writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
     writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
     writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
     writer.RenderBeginTag(HtmlTextWriterTag.Table);
     writer.RenderBeginTag(HtmlTextWriterTag.Tr);
     base.Zone.PartTitleStyle.AddAttributesToRender(writer, base.Zone);
     writer.RenderBeginTag(HtmlTextWriterTag.Td);
     writer.AddAttribute(HtmlTextWriterAttribute.Title, webPart.Description, true);
     writer.RenderBeginTag(HtmlTextWriterTag.Span);
     writer.WriteEncodedText(webPart.Title);
     writer.RenderEndTag();
     writer.RenderEndTag();
     base.Zone.PartTitleStyle.AddAttributesToRender(writer, base.Zone);
     writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, TextAlign.Right.ToString());
     writer.RenderBeginTag(HtmlTextWriterTag.Td);
     if (base.WebPartManager.DisplayMode == WebPartManager.EditDisplayMode)
     {
         this.RenderVerbs(writer, webPart);
     }
     writer.RenderEndTag();
     writer.RenderEndTag();
     writer.RenderEndTag();
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Outputs server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter" /> object and stores tracing information about the control if tracing is enabled.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param>
        public override void RenderControl( HtmlTextWriter writer )
        {
            if ( this.Text.Trim() != string.Empty )
            {
                writer.AddAttribute( "class", "warning" );
                writer.AddAttribute( "href", "#" );
                writer.AddAttribute( "tabindex", "-1" );

                foreach (var key in this.Style.Keys.OfType<HtmlTextWriterStyle>())
                {
                    writer.AddStyleAttribute( key, this.Style[key] );
                }

                writer.RenderBeginTag( HtmlTextWriterTag.A );
                writer.AddAttribute("class", "fa fa-exclamation-triangle");
                writer.RenderBeginTag( HtmlTextWriterTag.I );
                writer.RenderEndTag();
                writer.RenderEndTag();

                writer.AddAttribute( "class", "alert alert-warning warning-message" );
                writer.AddAttribute( "style", "display:none" );
                writer.RenderBeginTag( HtmlTextWriterTag.Div );
                writer.RenderBeginTag( HtmlTextWriterTag.Small );
                writer.Write( this.Text.Trim() );
                writer.RenderEndTag();
                writer.RenderEndTag();
            }
        }
 /// <summary>
 /// Accordions the HTML.
 /// </summary>
 /// <param name="html">The HTML.</param>
 /// <param name="items">The items.</param>
 /// <param name="headertemplete">The headertemplete.</param>
 /// <param name="itemtemplete">The itemtemplete.</param>
 public static void AccordionHtml(this HtmlHelper html, List<AccordionItem> items, Func<AccordionItem, string> headertemplete, Func<AccordionLeafItem, string> itemtemplete)
 {
     if (items != null)
     {
         StringBuilder buffer = new StringBuilder();
         HtmlTextWriter writer = new HtmlTextWriter(new StringWriter(buffer));
         foreach (AccordionItem item in items)
         {
             writer.AddAttribute(HtmlTextWriterAttribute.Class, "accordionheadercontainer");
             writer.RenderBeginTag(HtmlTextWriterTag.Div);
             writer.Write(headertemplete(item));
             writer.RenderEndTag();
             writer.AddAttribute(HtmlTextWriterAttribute.Class, "accordionbody");
             writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
             writer.RenderBeginTag(HtmlTextWriterTag.Div);
             writer.RenderBeginTag(HtmlTextWriterTag.Ul);
             foreach (AccordionLeafItem leafitem in item.Children)
             {
                 writer.AddAttribute(HtmlTextWriterAttribute.Class, "accordionitemcontainer");
                 writer.RenderBeginTag(HtmlTextWriterTag.Li);
                 writer.Write(itemtemplete(leafitem));
                 writer.RenderEndTag();
             }
             writer.RenderEndTag();
             writer.RenderEndTag();
         }
         HttpContext.Current.Response.Write(buffer.ToString());
     }
 }
Ejemplo n.º 10
0
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Src, MediaManager.GetMediaUrl(MediaItem, _mediaUrlOptions));
            writer.AddAttribute(HtmlTextWriterAttribute.Alt, MediaItem.Alt);

            base.AddAttributesToRender(writer);
        }
Ejemplo n.º 11
0
        /// <summary>Renders the control to the specified HTML writer.</summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param>
        protected override void Render(HtmlTextWriter writer)
        {
            this.AddCssClass(this.CssClass);

            switch (this.ImageType)
            {
                case ImageTypes.Rounded:
                    this.AddCssClass("img-rounded");
                    break;

                case ImageTypes.Circle:
                    this.AddCssClass("img-circle");
                    break;

                case ImageTypes.Thumbnail:
                    this.AddCssClass("img-thumbnail");
                    break;

                default:
                    break;
            }

            //writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
            writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);

            if (!string.IsNullOrEmpty(this.cssClass))
                writer.AddAttribute(HtmlTextWriterAttribute.Class, this.cssClass);

            base.Render(writer);
        }
Ejemplo n.º 12
0
        protected void RenderDropDownList(HtmlTextWriter writer, string type, int val)
        {
            //Render the Select Tag
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "text");
            writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID + "_" + type);
            writer.AddStyleAttribute("width", "60px");
            writer.RenderBeginTag(HtmlTextWriterTag.Select);
            for (int i = 0; i <= 99; i++)
            {
                //Add the Value Attribute
                writer.AddAttribute(HtmlTextWriterAttribute.Value, i.ToString());
                if (val == i)
                {
                    //Add the Selected Attribute
                    writer.AddAttribute(HtmlTextWriterAttribute.Selected, "selected");
                }
				
                //Render Option Tag
                writer.RenderBeginTag(HtmlTextWriterTag.Option);
                writer.Write(i.ToString("00"));
                writer.RenderEndTag();
            }
			
            //Close Select Tag
            writer.RenderEndTag();
        }
 protected void AddParameter(string name, string value, HtmlTextWriter writer)
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Name, name);
     writer.AddAttribute(HtmlTextWriterAttribute.Value, value);
     writer.RenderBeginTag(HtmlTextWriterTag.Param);
     writer.RenderEndTag();
 }
Ejemplo n.º 14
0
        protected override void Render(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Id, string.Concat(ClientID, "-container"));
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "button");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);

            if ( NavigateUrl == null )
            {
                AddAttributesToRender(writer);
            }
            else
            {
                string path = NavigateUrl;
                string qs = string.Empty;
                int splitIndex = path.IndexOf('?');

                if ( splitIndex != -1 )
                {
                    path = NavigateUrl.Substring(0, splitIndex);
                    qs = NavigateUrl.Substring(splitIndex);
                }

                path = VirtualPathUtility.ToAbsolute(path);
                writer.AddAttribute(HtmlTextWriterAttribute.Href, string.Concat(path, qs));
            }

            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.WriteEncodedText(Text);
            writer.RenderEndTag();

            writer.RenderEndTag();
        }
        protected override void RenderBeginTag(HtmlTextWriter writer)
        {
            writer.Indent++;

            // Div
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.Control.ClientID);

            // inject the asp.RadioButtonList css entries into the new HTML ouput generated.
            string cssClass = String.Empty;
            if (!string.IsNullOrEmpty(this.Control.CssClass))
            {
                cssClass = Helpers.BuildClassList(cssClass, this.Control.CssClass);
            }

            RadioButtonList controlList = this.Control as RadioButtonList;
            if (controlList != null)
            {
                if (controlList.RepeatDirection == RepeatDirection.Horizontal)
                {
                    cssClass = Helpers.BuildClassList(cssClass, CBootstrapFormInlineLayoutClassName);
                }
            }

            if (!string.IsNullOrEmpty(cssClass.Trim()))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass.Trim());
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="writer"></param>
 protected override void AddAttributesToRender(HtmlTextWriter writer)
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Width, this.Width);
     writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
     writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
     writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "1");
 }
Ejemplo n.º 17
0
 private string CreateSummary() {
     StringWriter stringWriter = new StringWriter();
     HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
     htmlWriter.AddAttribute(HtmlTextWriterAttribute.Class,
         "table table-bordered");
     htmlWriter.RenderBeginTag(HtmlTextWriterTag.Table);
     htmlWriter.AddAttribute(HtmlTextWriterAttribute.Class, "success");
     htmlWriter.RenderBeginTag(HtmlTextWriterTag.Tr);
     htmlWriter.RenderBeginTag(HtmlTextWriterTag.Td);
     htmlWriter.Write("Requests");
     htmlWriter.RenderEndTag();
     htmlWriter.RenderBeginTag(HtmlTextWriterTag.Td);
     htmlWriter.Write(requestCount);
     htmlWriter.RenderEndTag();
     htmlWriter.RenderEndTag();
     htmlWriter.AddAttribute(HtmlTextWriterAttribute.Class, "success");
     htmlWriter.RenderBeginTag(HtmlTextWriterTag.Tr);
     htmlWriter.RenderBeginTag(HtmlTextWriterTag.Td);
     htmlWriter.Write("Total Time");
     htmlWriter.RenderEndTag();
     htmlWriter.RenderBeginTag(HtmlTextWriterTag.Td);
     htmlWriter.Write("{0:F5} seconds", totalTime);
     htmlWriter.RenderEndTag();
     htmlWriter.RenderEndTag();
     htmlWriter.RenderEndTag();
     return stringWriter.ToString();
 }
 protected override void AddAttributesToRender(HtmlTextWriter writer)
 {
     base.AddAttributesToRender(writer);
     if (base.ControlStyleCreated && (base.EnableLegacyRendering || (writer is Html32TextWriter)))
     {
         Color borderColor = this.BorderColor;
         if (!borderColor.IsEmpty)
         {
             writer.AddAttribute(HtmlTextWriterAttribute.Bordercolor, ColorTranslator.ToHtml(borderColor));
         }
     }
     string str = "0";
     bool flag = false;
     if (base.ControlStyleCreated)
     {
         Unit borderWidth = this.BorderWidth;
         if (this.GridLines != System.Web.UI.WebControls.GridLines.None)
         {
             if (borderWidth.IsEmpty || (borderWidth.Type != UnitType.Pixel))
             {
                 str = "1";
                 flag = true;
             }
             else
             {
                 str = ((int) borderWidth.Value).ToString(NumberFormatInfo.InvariantInfo);
             }
         }
     }
     if ((this.RenderingCompatibility < VersionUtil.Framework40) || flag)
     {
         writer.AddAttribute(HtmlTextWriterAttribute.Border, str);
     }
 }
Ejemplo n.º 19
0
        private string GetBar()
        {
            var stringWriter = new StringWriter();
            using (var writer = new HtmlTextWriter(stringWriter))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, Id);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "horizontal-bar");
                if (!Title.Equals("")) 
                    writer.AddAttribute(HtmlTextWriterAttribute.Title, Title);
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                var sum = Elements.Sum(x => x.Value);

                var sortedItems = Elements.Where(x => x.Value >= 0.0000001);
                if(_orderByDescending) sortedItems = sortedItems.OrderByDescending(x => x.Value);
                foreach (var item in sortedItems)
                {
                    var value = item.Value;
                    var width = Math.Max((value / sum) * 100, 0.01);
                    var tooltip = new Tooltip(item.TooltipText, item.InnerText, item.BackgroundColor, "horizontal-bar-item",
                        width, item.Href);
                    writer.Write(tooltip.HtmlCode);
                }
                writer.RenderEndTag();
            }
            return stringWriter.ToString();
        }
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            //writer.AddAttribute(HtmlTextWriterAttribute.Class, GetCssClass());
            this.AddCssClass(this.CssClass);
            this.AddCssClass(GetCssClass());

            writer.AddAttribute("role", "button");

            if (this.Disabled)
                writer.AddAttribute(HtmlTextWriterAttribute.Disabled, string.Empty);

            if (!string.IsNullOrEmpty(this.AlertMessage))
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, string.Format(@"return confirm('{0}')", this.AlertMessage));

            if (!string.IsNullOrEmpty(this.TargetModalID))
            {
                writer.AddAttribute("data-toggle", "modal");
                writer.AddAttribute("data-target", string.Format("#{0}", this.TargetModalID));
            }

            if (!string.IsNullOrEmpty(this.LoadingText))
                writer.AddAttribute("data-loading-text", this.LoadingText);

            writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);
            if (!string.IsNullOrEmpty(this.cssClass))
                writer.AddAttribute(HtmlTextWriterAttribute.Class, this.cssClass);

            // Call the base's AddAttributesToRender method 
            base.AddAttributesToRender(writer);
        }
        protected override void Render(HtmlTextWriter writer)
        {
            if (this.GlyphiconType != GlyphiconTypes.None)
            {
                //<div class="input-group">
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "input-group");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                //  <span class="input-group-addon glyphicon glyphicon-lock"></span>
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "input-group-addon");
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, string.Format("glyphicon {0}", Glyphicon.GetGlyphiconCss(this.GlyphiconType)));
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                //writer.RenderBeginTag(HtmlTextWriterTag.I);
                writer.RenderEndTag();
                writer.RenderEndTag();
            }

            base.Render(writer);

            if (this.GlyphiconType != GlyphiconTypes.None)
            {
                //</div>
                writer.RenderEndTag();
            }
        }
Ejemplo n.º 22
0
        public void Render(HtmlTextWriter writer)
        {
            if (CollapseByDefault) writer.Write("<h4 class=\"expand\">{0} Details</h4>", ConfigurationName);
            else writer.Write("<h4>{0} Details</h4>", ConfigurationName);

            if(CollapseByDefault) writer.AddAttribute("class", "details collapsed");
            else writer.AddAttribute("class", "details");

            writer.RenderBeginTag("ul");

            RenderType("Predicate",
                "Predicates define what items get included into Unicorn, because you don't want to serialize everything. You can implement your own to use any criteria for inclusion you can possibly imagine.",
                _predicate,
                writer);

            RenderType("Serialization Provider",
                "Defines how items are serialized - for example, using standard Sitecore serialization APIs, JSON to disk, XML in SQL server, etc",
                _serializationProvider,
                writer);

            RenderType("Source Data Provider",
                "Defines how source data is read to compare with serialized data. Normally this is a Sitecore database.",
                _sourceDataProvider,
                writer);

            RenderType("Evaluator",
                "The evaluator decides what to do when included items need to be evaluated to see if they need updating, creation, or deletion.",
                _evaluator,
                writer);

            writer.RenderEndTag(); // ul
        }
Ejemplo n.º 23
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            writer.AddAttribute("class", "header");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write("CorrelatesWith");
            writer.RenderEndTag();

            writer.AddAttribute("class", "ww-code");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.WriteEncodedText(this.CorrelatesWith ?? string.Empty);
            writer.RenderEndTag();

            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write("Body");
            writer.RenderEndTag();

            writer.AddAttribute("class", "body");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            this.Body.Render(writer);
            writer.RenderEndTag();
        }
Ejemplo n.º 24
0
        protected virtual void WriteOEMForm(HtmlTextWriter writer)
        {
            //<div id="OemInput" class="g_input">
            writer.AddAttribute(HtmlTextWriterAttribute.Id, "OemInput");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "g_input");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            //<input name="Oem" type="text" id="Oem" size="17" style="width:200px;" value="'.$prevOem.'"/></div>
            writer.AddAttribute(HtmlTextWriterAttribute.Name, "Oem");
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "text");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, "Oem");
            writer.AddAttribute(HtmlTextWriterAttribute.Size, "17");
            writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:200px;");
            writer.AddAttribute(HtmlTextWriterAttribute.Value, PreviousOEM);
            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            writer.RenderEndTag();
            writer.RenderEndTag();

            //<input type="button" onclick="checkVinValue(this.form.vin.value, this)" name="OemSubmit" value="'.$this->GetLocalizedString('Search').'" id="OemSubmit" /></form>
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "button");
            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "checkOemValue(this.form.vin.value, this)");
            writer.AddAttribute(HtmlTextWriterAttribute.Name, "OemSubmit");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, "OemSubmit");
            writer.AddAttribute(HtmlTextWriterAttribute.Value, GetLocalizedString("Search"));
            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            writer.RenderEndTag();
        }
Ejemplo n.º 25
0
 protected override void Render(HtmlTextWriter writer)
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Src, ResolveClientUrl(PageURL));
     writer.AddAttribute(HtmlTextWriterAttribute.Alt, " ");
     base.RenderBeginTag(writer);
     base.Render(writer);
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Overrides <see cref="WebControl.AddAttributesToRender"/>
        /// </summary>
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Type,"button");
            writer.AddAttribute("value",this.Text);
            writer.AddAttribute("language","javascript");

            String myOnclick = " return false; ";

            // prepend the dialog open script to the onclick script
            if ( System.Web.HttpContext.Current != null && this.Page != null && this.Enabled && this.DialogToOpen != null && this.DialogToOpen.Length != 0 ) {

                DialogWindowBase dialog = this.NamingContainer.FindControl(this.DialogToOpen) as DialogWindowBase;
                if ( dialog == null ) {
                    dialog = this.Page.FindControl(this.DialogToOpen) as DialogWindowBase;
                }
                if ( dialog == null ) {
                    throw new InvalidOperationException("Cannot find a DialogWindow with the name '" + this.DialogToOpen + "'");
                }

                myOnclick = dialog.GetDialogOpenScript() + "; " + myOnclick;
            }

            // prepend the user's onclick script to mine
            if ( this.Attributes["onclick"] != null ) {
                myOnclick = this.Attributes["onclick"] + myOnclick;
                this.Attributes.Remove("onclick");
            }

            // write the final onclick
            writer.AddAttribute("onclick", myOnclick);

            base.AddAttributesToRender (writer);
        }
Ejemplo n.º 27
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// RenderEditMode renders the Edit mode of the control
        /// </summary>
        /// <param name="writer">A HtmlTextWriter.</param>
        /// <history>
        ///     [cnurse]	03/22/2006	created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void RenderEditMode(HtmlTextWriter writer)
        {
            PortalSettings _portalSettings = Globals.GetPortalSettings();

            //Get the Pages
            List<TabInfo> listTabs = TabController.GetPortalTabs(_portalSettings.PortalId, Null.NullInteger, true, "<" + Localization.GetString("None_Specified") + ">", true, false, true, true, false);

            //Render the Select Tag
            ControlStyle.AddAttributesToRender(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
            writer.RenderBeginTag(HtmlTextWriterTag.Select);

            for (int tabIndex = 0; tabIndex <= listTabs.Count - 1; tabIndex++)
            {
                TabInfo tab = listTabs[tabIndex];

                //Add the Value Attribute
                writer.AddAttribute(HtmlTextWriterAttribute.Value, tab.TabID.ToString());

                if (tab.TabID == IntegerValue)
                {
					//Add the Selected Attribute
                    writer.AddAttribute(HtmlTextWriterAttribute.Selected, "selected");
                }
				
                //Render Option Tag
                writer.RenderBeginTag(HtmlTextWriterTag.Option);
                writer.Write(tab.IndentedTabName);
                writer.RenderEndTag();
            }
			
            //Close Select Tag
            writer.RenderEndTag();
        }
Ejemplo n.º 28
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            writer.AddAttribute("class", "header");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write("Foreach");
            writer.RenderEndTag();

            writer.AddAttribute("class", "ww-code");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.WriteEncodedText(this.Argument);
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write("in");
            writer.RenderEndTag();

            writer.AddAttribute("class", "ww-code");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.WriteEncodedText(this.Values);
            writer.RenderEndTag();

            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write("Body");
            writer.RenderEndTag();

            writer.AddAttribute("class", "body");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            this.Body.Render(writer);
            writer.RenderEndTag();
        }
Ejemplo n.º 29
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (this.DesignMode) return;

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "sn-toolbar");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "sn-toolbar-inner");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            this.RenderUploadButton(writer);
            if (AllowOtherContentType) 
                RenderContentTypeDropDown(writer);
            this.RenderCancelButton(writer);

            writer.RenderEndTag();
            writer.RenderEndTag();

            this.RenderProgressBar(writer);

            if (!this._isEmpty) return;
            this.RenderEmptyEntry(writer);
            this.RenderFileInfo(writer);

            //StringBuilder sb = new StringBuilder();
            //sb.Append("var sm = sn.ux.smartMenu;");
            //sb.Append("$('.sn-toolbar-button').hover(sm.showArrow, sm.hideArrow);");
            //Page.ClientScript.RegisterStartupScript(typeof(Page), "empty7", sb.ToString(), true);
        }
Ejemplo n.º 30
0
		protected override void AddAttributesToRender(HtmlTextWriter output)
		{
			output.AddAttribute("name", this.UniqueID);
			output.AddAttribute(HtmlTextWriterAttribute.Type, "text");
			output.AddAttribute(HtmlTextWriterAttribute.Value, Text);
			base.AddAttributesToRender(output);
		}
Ejemplo n.º 31
0
        private Editor GetDesignTimeHtmlHeader(HtmlTextWriter writer)
        {
            var editor = (Editor)Component;

            editor.ControlStyle.AddAttributesToRender(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);          // TABLE
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);             // TR
            writer.RenderBeginTag(HtmlTextWriterTag.Td);             // TD

            writer.AddAttribute(HtmlTextWriterAttribute.Style, "position: relative; display: block; width:100%; border: 0px;");

            editor.CreateTools(editor.Template, false);
            editor.Toolbars.RenderDesign(writer);

            writer.RenderEndTag();                       // TD
            writer.RenderEndTag();                       // TR

            writer.RenderBeginTag(HtmlTextWriterTag.Tr); // TR
            writer.AddAttribute(HtmlTextWriterAttribute.Height, "100%");
            writer.RenderBeginTag(HtmlTextWriterTag.Td); // TD
            writer.AddAttribute(HtmlTextWriterAttribute.Style, "position: relative; display: block; width:100%; border: 0px;");
            writer.AddAttribute("onkeydown", "keydown('" + editor.ClientID + "');");

            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Height, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Style, "WIDTH: 100%; HEIGTH: 100%;");

            writer.RenderBeginTag(HtmlTextWriterTag.Iframe); // IFRAME
            writer.RenderEndTag();                           // IFRAME

            writer.RenderEndTag();                           // TD
            writer.RenderEndTag();                           // TR
            return(editor);
        }
Ejemplo n.º 32
0
 void RenderOuterBorderRight(System.Web.UI.HtmlTextWriter writer)
 {
     writer.AddStyleAttribute("background-repeat", "repeat-y");
     writer.AddStyleAttribute("background-position", "center right");
     if (OuterBorderRightWidth != Unit.Empty)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.Width, OuterBorderRightWidth.ToString());
     }
     if (OuterBorderRightImageUrl.Length > 0)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, "url(" + ResolveClientUrl(OuterBorderRightImageUrl) + ")");
     }
     if (!String.IsNullOrEmpty(ClientID))
     {
         writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + "_BorderR");
     }
     writer.RenderBeginTag(HtmlTextWriterTag.Td);
     writer.RenderEndTag();
 }
Ejemplo n.º 33
0
        protected override void Render(Writer writer)
        {
            writer.AddAttribute("class", "FilterBoxDiv");
            writer.RenderBeginTag("div");

            if (!string.IsNullOrWhiteSpace(ID))
            {
                writer.AddAttribute("id", UniqueID);
            }

            foreach (string key in Style.Keys)
            {
                writer.AddStyleAttribute(key, Style[key]);
            }

            if (!string.IsNullOrEmpty(CssClass))
            {
                writer.AddAttribute("class", CssClass);
            }

            writer.RenderBeginTag("details");

            if (ActiveStyle != null && Active)
            {
                writer.AddAttribute("class", ActiveStyle.CssClass);
            }

            writer.RenderBeginTag("summary");
            writer.RenderEndTag();

            writer.RenderBeginTag("div");
            LiveFilterBox.Attributes.Add("onkeyup", string.Format("keyup_handlerFilterControl2(this,'{0}')", CheckBoxList.ClientID));
            LiveFilterBox.Attributes.Add("placeholder", " поиск ");
            LiveFilterBox.RenderControl(writer);

            writer.AddAttribute("class", "FilterboxTable");
            CheckBoxList.RenderControl(writer);

            writer.RenderEndTag();
            writer.AddAttribute("class", "ApplyPanel");
            writer.RenderBeginTag("div");

            ApplyButton.RenderControl(writer);
            CancelButton.RenderControl(writer);

            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.RenderEndTag();
        }
Ejemplo n.º 34
0
        /// <summary>
        /// Renders the control to the specified HTML writer.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param>
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            this.AddCssClass(this.CssClass);
            this.AddCssClass("btn");
            this.AddCssClass(this.GetCssButtonType());

            if (this.Enabled == false)
            {
                this.AddCssClass("disabled");
            }

            if (this.Block == true)
            {
                this.AddCssClass("btn-block");
            }

            switch (this.ButtonSize)
            {
            case ButtonSizes.Large:
                this.AddCssClass("btn-large");
                break;

            case ButtonSizes.Small:
                this.AddCssClass("btn-small");
                break;

            case ButtonSizes.Mini:
                this.AddCssClass("btn-mini");
                break;

            default:
                break;
            }

            if (!String.IsNullOrEmpty(this.sCssClass))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, this.sCssClass);
            }
            base.Render(writer);
        }
Ejemplo n.º 35
0
 void RenderOuterBorderLeftBottomCorner(System.Web.UI.HtmlTextWriter writer)
 {
     writer.AddStyleAttribute("background-repeat", "no-repeat");
     writer.AddStyleAttribute("background-position", "bottom left");
     if (OuterBorderLeftBottomCornerImageUrl.Length > 0)
     {
         writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, "url(" + ResolveClientUrl(OuterBorderLeftBottomCornerImageUrl) + ")");
     }
     if (!String.IsNullOrEmpty(ClientID))
     {
         writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + "_BorderLB");
     }
     writer.RenderBeginTag(HtmlTextWriterTag.Td);
     //if (OuterBorderLeftBottomCornerImageUrl.Length > 0)
     //{
     //    writer.AddAttribute(HtmlTextWriterAttribute.Src, _urlResolver.ResolveClientUrl(OuterBorderLeftBottomCornerImageUrl));
     //    writer.AddAttribute(HtmlTextWriterAttribute.Alt, "");
     //    writer.RenderBeginTag(HtmlTextWriterTag.Img);
     //    writer.RenderEndTag();
     //}
     writer.RenderEndTag();
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Overrides <see cref="WebControl.AddAttributesToRender"/>.
 /// </summary>
 protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
 {
     base.AddAttributesToRender(writer);
     writer.AddAttribute(HtmlTextWriterAttribute.Type, "file");
     writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);
     if (this.MaxLength != -1)
     {
         writer.AddAttribute(HtmlTextWriterAttribute.Maxlength, this.MaxLength.ToString());
     }
     if (this.Accept.Length > 0)
     {
         writer.AddAttribute("accept", this.Accept);
     }
     if (this.AutoPostBack && this.Page != null)
     {
         writer.AddAttribute(HtmlTextWriterAttribute.Onchange, this.Page.GetPostBackClientEvent(this, ""));
         writer.AddAttribute("language", "javascript");
     }
 }
Ejemplo n.º 37
0
        public override void RenderEndTag(System.Web.UI.HtmlTextWriter writer)
        {
            writer.RenderEndTag(); // DIV-Content
            writer.RenderEndTag(); // TD

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "r");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "s");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.RenderEndTag();

            writer.RenderEndTag(); // td

            writer.RenderEndTag(); // tr
            writer.Write(writer.NewLine);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "bottom");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "l");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "c");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "r");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderEndTag();

            writer.RenderEndTag();  // tr
            writer.Write(writer.NewLine);
            writer.RenderEndTag();  // table
            writer.RenderEndTag();  // div
            writer.EndRender();
        }
Ejemplo n.º 38
0
        /// <summary>
        /// Generates the target-specific inner markup for the Web control to which the control adapter is attached.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> containing methods to render the target-specific output.</param>
        protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
        {
            CheckBox cb = Control as CheckBox;

            if (cb != null)
            {
                writer.WriteLine();

                // always render the label tag for the checkbox, even if the checkbox doesn't have text
                bool renderCheckboxLabel = true;
                var  textCssClass        = "label-text";
                if (renderCheckboxLabel)
                {
                    var containerCssClass = "checkbox";


                    if (cb is RockCheckBox)
                    {
                        if ((cb as RockCheckBox).DisplayInline)
                        {
                            containerCssClass = "checkbox-inline";
                        }
                        containerCssClass += " " + (cb as RockCheckBox).ContainerCssClass;
                        textCssClass      += " " + (cb as RockCheckBox).TextCssClass;
                    }

                    writer.AddAttribute(HtmlTextWriterAttribute.Class, containerCssClass);
                    writer.AddAttribute(HtmlTextWriterAttribute.Style, cb.Style.Value);

                    writer.RenderBeginTag(HtmlTextWriterTag.Div);

                    writer.AddAttribute("title", cb.ToolTip);
                    writer.RenderBeginTag(HtmlTextWriterTag.Label);
                }

                writer.AddAttribute("id", cb.ClientID);
                writer.AddAttribute("type", "checkbox");
                writer.AddAttribute("name", cb.UniqueID);
                if (cb.Checked)
                {
                    writer.AddAttribute("checked", "checked");
                }

                if (!string.IsNullOrWhiteSpace(cb.CssClass))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, cb.CssClass);
                }

                foreach (var inputAttributeKey in cb.InputAttributes.Keys)
                {
                    var key = inputAttributeKey as string;
                    writer.AddAttribute(key, cb.InputAttributes[key]);
                }

                if (cb.AutoPostBack)
                {
                    PostBackOptions postBackOption = new PostBackOptions(cb, string.Empty);
                    if (cb.CausesValidation && this.Page.GetValidators(cb.ValidationGroup).Count > 0)
                    {
                        postBackOption.PerformValidation = true;
                        postBackOption.ValidationGroup   = cb.ValidationGroup;
                    }

                    if (this.Page.Form != null)
                    {
                        postBackOption.AutoPostBack = true;
                    }

                    writer.AddAttribute(HtmlTextWriterAttribute.Onclick, Page.ClientScript.GetPostBackEventReference(postBackOption, true));
                }

                writer.RenderBeginTag(HtmlTextWriterTag.Input);
                writer.RenderEndTag();

                if (renderCheckboxLabel)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, textCssClass);
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);

                    if (cb.Text.Length > 0)
                    {
                        writer.Write(cb.Text);
                    }
                    else
                    {
                        writer.Write("&nbsp;");
                    }

                    writer.RenderEndTag();      // Span
                    writer.RenderEndTag();      // Label
                }

                var rockCb = cb as Rock.Web.UI.Controls.RockCheckBox;
                if (rockCb != null)
                {
                    bool renderRockLabel   = !string.IsNullOrEmpty(rockCb.Label);
                    bool renderRockHelp    = rockCb.HelpBlock != null && !string.IsNullOrWhiteSpace(rockCb.Help);
                    bool renderRockWarning = rockCb.WarningBlock != null && !string.IsNullOrWhiteSpace(rockCb.Warning);

                    if (!renderRockLabel && renderRockHelp)
                    {
                        rockCb.HelpBlock.RenderControl(writer);
                    }

                    if (!renderRockLabel && renderRockWarning)
                    {
                        rockCb.WarningBlock.RenderControl(writer);
                    }
                }

                if (renderCheckboxLabel)
                {
                    writer.RenderEndTag();      // Div
                }

                if (Page != null && Page.ClientScript != null)
                {
                    Page.ClientScript.RegisterForEventValidation(cb.UniqueID);
                }
            }
        }
Ejemplo n.º 39
0
        internal override void RenderItem(System.Web.UI.HtmlTextWriter output, FileViewItem item)
        {
            output.AddStyleAttribute(HtmlTextWriterStyle.Margin, "1px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "120px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Height, "126px");
            output.AddStyleAttribute("float", fileView.Controller.CurrentUICulture.TextInfo.IsRightToLeft ? "right" : "left");
            output.RenderBeginTag(HtmlTextWriterTag.Div);

            fileView.RenderItemBeginTag(output, item);

            output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            output.RenderBeginTag(HtmlTextWriterTag.Table);

            output.RenderBeginTag(HtmlTextWriterTag.Tr);
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "120px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Height, "96px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingLeft, "13px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "13px");
            output.AddStyleAttribute(HtmlTextWriterStyle.PaddingTop, "2px");
            output.RenderBeginTag(HtmlTextWriterTag.Td);

            output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            output.RenderBeginTag(HtmlTextWriterTag.Table);
            output.RenderBeginTag(HtmlTextWriterTag.Tr);
            output.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, "#ACA899");
            output.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "solid");
            output.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "1px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "92px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Height, "92px");
            output.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "center");
            output.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
            output.RenderBeginTag(HtmlTextWriterTag.Td);
            output.AddAttribute(HtmlTextWriterAttribute.Src, item.ThumbnailImage);
            output.AddAttribute(HtmlTextWriterAttribute.Alt, item.Info);
            output.RenderBeginTag(HtmlTextWriterTag.Img);
            output.RenderEndTag();
            output.RenderEndTag();
            output.RenderEndTag();
            output.RenderEndTag();

            output.RenderEndTag();
            output.RenderEndTag();

            output.RenderBeginTag(HtmlTextWriterTag.Tr);
            output.RenderBeginTag(HtmlTextWriterTag.Td);
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "120px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Height, "30px");
            output.AddStyleAttribute(HtmlTextWriterStyle.Overflow, "hidden");
            output.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "center");
            output.AddAttribute(HtmlTextWriterAttribute.Id, item.ClientID + "_Name");
            output.RenderBeginTag(HtmlTextWriterTag.Div);
            RenderItemName(output, item);
            output.RenderEndTag();
            output.RenderEndTag();
            output.RenderEndTag();

            output.RenderEndTag();

            fileView.RenderItemEndTag(output);

            output.RenderEndTag();
        }
Ejemplo n.º 40
0
        protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
        {
            if (this.DesignMode)
            {
                //nothing to be done yet
            }
            else
            {
                WriteParam(writer, "movie", ResolveClientUrl(MovieUrl));
                // choose a wmode and a bgcolor based on BackColor value.
                if (BackColor == System.Drawing.Color.Transparent)
                {
                    WriteParam(writer, "wmode", "Transparent");
                }
                else if (BackColor.Equals(System.Drawing.Color.Empty))
                {
                    //nothing to be done.
                }
                else
                {
                    //Conversion.Hex
                    string color = this.BackColor.ToArgb().ToString("x2");
                    if (!color.Equals("0"))
                    {
                        WriteParam(writer, "bgcolor", "#" + color.Substring(2));
                    }
                }

                WriteParam(writer, "menu", ShowMenu.ToString().ToLower());

                if (!string.IsNullOrEmpty(FlashVars))
                {
                    WriteParam(writer, "flashVars", FlashVars);
                }

                if (this.Scale != FlashScale.ShowAll)
                {
                    WriteParam(writer, "scale", Scale.ToString().ToLower());
                }

                if (!Play)
                {
                    WriteParam(writer, "play", "false");
                }
                if (ScriptAccess != FlashScriptAccess.Default)
                {
                    WriteParam(writer, "allowScriptAccess", ScriptAccess.ToString().ToLower());
                }
                if (AllowFullScreen)
                {
                    WriteParam(writer, "allowFullscreen", AllowFullScreen.ToString().ToLower());
                }

                if (!@Loop)
                {
                    WriteParam(writer, "loop", "false");
                }

                WriteParam(writer, "quality", Quality.ToString().ToLower());

                if (this.Alignment != FlashAlign.Center)
                {
                    string align = "";
                    switch (Alignment)
                    {
                    case FlashAlign.Bottom:
                        align = "b";
                        break;

                    case FlashAlign.BottomLeft:
                        align = "bl";
                        break;

                    case FlashAlign.BottomRight:
                        align = "br";
                        break;

                    case FlashAlign.Left:
                        align = "l";
                        break;

                    case FlashAlign.Right:
                        align = "r";
                        break;

                    case FlashAlign.Top:
                        align = "t";
                        break;

                    case FlashAlign.TopLeft:
                        align = "tl";
                        break;

                    case FlashAlign.TopRight:
                        align = "tr";
                        break;
                    }
                    WriteParam(writer, "salign", align);
                }

                if (!Unit.Equals(ExpandedWidth, Unit.Empty))
                {
                    writer.AddAttribute("width", this.ExpandedWidth.ToString());
                }
                else
                {
                    writer.AddAttribute("width", this.Width.ToString());
                }
                if (!Unit.Equals(ExpandedHeight, Unit.Empty))
                {
                    writer.AddAttribute("height", this.ExpandedHeight.ToString());
                }
                else
                {
                    writer.AddAttribute("height", this.Height.ToString());
                }


                writer.AddAttribute(HtmlTextWriterAttribute.Type, "application/x-shockwave-flash");
                writer.AddAttribute("pluginspage", "http://www.macromedia.com/go/getflashplayer");
                writer.RenderBeginTag(HtmlTextWriterTag.Embed);
                writer.RenderEndTag();
            }
        }
Ejemplo n.º 41
0
        internal override void RenderBeginList(System.Web.UI.HtmlTextWriter output)
        {
            BorderedPanel panel = new BorderedPanel();

            panel.Page = fileView.Page;
            if (fileView.DetailsColumnHeaderStyle.HorizontalAlign == HorizontalAlign.NotSet)
            {
                fileView.DetailsColumnHeaderStyle.HorizontalAlign = fileView.Controller.CurrentUICulture.TextInfo.IsRightToLeft ? HorizontalAlign.Right : HorizontalAlign.Left;
            }
            panel.ControlStyle.CopyFrom(fileView.DetailsColumnHeaderStyle);

            output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            output.RenderBeginTag(HtmlTextWriterTag.Table);
            output.RenderBeginTag(HtmlTextWriterTag.Thead);
            output.RenderBeginTag(HtmlTextWriterTag.Tr);
            output.RenderBeginTag(HtmlTextWriterTag.Th);

            output.AddAttribute(HtmlTextWriterAttribute.Onclick, fileView.GetSortEventReference(SortMode.Name));
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            output.AddAttribute(HtmlTextWriterAttribute.Id, fileView.ClientID + "_Thead_Name");

            panel.RenderBeginTag(output);
            output.Write(HttpUtility.HtmlEncode(controller.GetResourceString("Name", "Name")));
            panel.RenderEndTag(output);

            output.RenderEndTag();
            output.RenderBeginTag(HtmlTextWriterTag.Th);

            output.AddAttribute(HtmlTextWriterAttribute.Onclick, fileView.GetSortEventReference(SortMode.Size));
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            output.AddAttribute(HtmlTextWriterAttribute.Id, fileView.ClientID + "_Thead_Size");

            panel.RenderBeginTag(output);
            output.Write(HttpUtility.HtmlEncode(controller.GetResourceString("Size", "Size")));
            panel.RenderEndTag(output);

            output.RenderEndTag();
            output.RenderBeginTag(HtmlTextWriterTag.Th);

            output.AddAttribute(HtmlTextWriterAttribute.Onclick, fileView.GetSortEventReference(SortMode.Type));
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            output.AddAttribute(HtmlTextWriterAttribute.Id, fileView.ClientID + "_Thead_Type");

            panel.RenderBeginTag(output);
            output.Write(HttpUtility.HtmlEncode(controller.GetResourceString("Type", "Type")));
            panel.RenderEndTag(output);

            output.RenderEndTag();
            output.RenderBeginTag(HtmlTextWriterTag.Th);

            output.AddAttribute(HtmlTextWriterAttribute.Onclick, fileView.GetSortEventReference(SortMode.Modified));
            output.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "default");
            output.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            output.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            output.AddAttribute(HtmlTextWriterAttribute.Id, fileView.ClientID + "_Thead_Modified");

            panel.RenderBeginTag(output);
            output.Write(HttpUtility.HtmlEncode(controller.GetResourceString("Date_Modified", "Date Modified")));
            panel.RenderEndTag(output);

            output.RenderEndTag();
            output.RenderEndTag();
            output.RenderEndTag();

            output.AddStyleAttribute(HtmlTextWriterStyle.Overflow, "auto");
            output.RenderBeginTag(HtmlTextWriterTag.Tbody);
        }
Ejemplo n.º 42
0
        protected override void Render(Writer writer)
        {
            var harvester = string.Format("harvester('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}');",
                                          JeysonBox.ClientID, TechPredicateBox.ClientID, UserPredicateBox.ClientID, ApplyButton.ClientID, startBlockButton.ClientID, endBlockButton.ClientID, addExpressionButton.ClientID, addAndOperatorButton.ClientID, addOrOperatorButton.ClientID);

            //Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('Загрузка страници')", true);

            Page.ClientScript.RegisterStartupScript(this.GetType(), ClientID, harvester, true);
            //Page.ClientScript.RegisterStartupScript(this.GetType(), "ClientID", harvester, true);

            //ApplyButton.Attributes.Add("onclick", '');

            var x = JeysonBox.ClientID;

            addExpressionButton.Attributes.Add("onclick", string.Format("addExpression('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')", JeysonBox.ClientID,
                                                                        ApplyButton.ClientID, startBlockButton.ClientID, endBlockButton.ClientID, addExpressionButton.ClientID, addAndOperatorButton.ClientID, addOrOperatorButton.ClientID,
                                                                        TechPredicateBox.ClientID, UserPredicateBox.ClientID, OperatorList.ClientID, ValueBox.ClientID));

            startBlockButton.Attributes.Add("onclick", string.Format("startBlock('{0}','{1}','{2}')", JeysonBox.ClientID, TechPredicateBox.ClientID, UserPredicateBox.ClientID));

            endBlockButton.Attributes.Add("onclick", string.Format("endBlock('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", JeysonBox.ClientID, ApplyButton.ClientID,
                                                                   startBlockButton.ClientID, endBlockButton.ClientID, addExpressionButton.ClientID, addAndOperatorButton.ClientID, addOrOperatorButton.ClientID,
                                                                   TechPredicateBox.ClientID, UserPredicateBox.ClientID));

            addAndOperatorButton.Attributes.Add("onclick", string.Format("addLogicOperator('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", JeysonBox.ClientID, ApplyButton.ClientID,
                                                                         startBlockButton.ClientID, endBlockButton.ClientID, addExpressionButton.ClientID, addAndOperatorButton.ClientID, addOrOperatorButton.ClientID,
                                                                         TechPredicateBox.ClientID, UserPredicateBox.ClientID, " AND "));

            addOrOperatorButton.Attributes.Add("onclick", string.Format("addLogicOperator('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", JeysonBox.ClientID, ApplyButton.ClientID,
                                                                        startBlockButton.ClientID, endBlockButton.ClientID, addExpressionButton.ClientID, addAndOperatorButton.ClientID, addOrOperatorButton.ClientID,
                                                                        TechPredicateBox.ClientID, UserPredicateBox.ClientID, " OR "));

            clearAllButton.Attributes.Add("onclick", string.Format("clearAllPredicate('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", JeysonBox.ClientID, ApplyButton.ClientID,
                                                                   startBlockButton.ClientID, endBlockButton.ClientID, addExpressionButton.ClientID, addAndOperatorButton.ClientID, addOrOperatorButton.ClientID,
                                                                   TechPredicateBox.ClientID, UserPredicateBox.ClientID));

            clearButton.Attributes.Add("onclick", string.Format("clearPredicate('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", JeysonBox.ClientID, ApplyButton.ClientID,
                                                                startBlockButton.ClientID, endBlockButton.ClientID, addExpressionButton.ClientID, addAndOperatorButton.ClientID, addOrOperatorButton.ClientID,
                                                                TechPredicateBox.ClientID, UserPredicateBox.ClientID));

            writer.AddAttribute("class", "PredicateControlDiv");
            writer.RenderBeginTag("div");

            if (!string.IsNullOrWhiteSpace(ID))
            {
                writer.AddAttribute("id", ClientID);
            }

            if (!string.IsNullOrEmpty(CssClass))
            {
                writer.AddAttribute("class", CssClass);
            }

            writer.RenderBeginTag("details");

            if (ActiveStyle != null && Active)
            {
                writer.AddAttribute("class", ActiveStyle.CssClass);
            }

            writer.RenderBeginTag("summary");
            writer.RenderEndTag();

            writer.RenderBeginTag("div");

            Table.RenderControl(writer);

            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.RenderEndTag();
        }
Ejemplo n.º 43
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            //ReseteParentProperties();

            // Add wrapper div
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "inline-block");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "relative");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + selectPstfx);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, !string.IsNullOrEmpty(Style.SelectBoxCssClass) ? Style.SelectBoxCssClass + " " + selectCssClass : selectCssClass);
            if (Style.SelectBoxWidth.Value > 0)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, Style.SelectBoxWidth.ToString());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // Add caption
            if (!string.IsNullOrEmpty(Texts.SelectBoxCaption))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, "caption");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.WriteEncodedText(Texts.SelectBoxCaption);
                writer.RenderEndTag();
            }

            // Add dropdown div markup
            writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + divPstfx);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, !string.IsNullOrEmpty(Style.DropDownBoxCssClass) ? Style.DropDownBoxCssClass + " " + dropDownCssClass : dropDownCssClass);
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "absolute");
            if (Style.DropDownBoxBoxWidth.Value > 0)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, Style.DropDownBoxBoxWidth.ToString());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // Add div with check boxes
            writer.AddAttribute(HtmlTextWriterAttribute.Id, "checks");
            if (Style.DropDownBoxBoxHeight.Value > 0)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, Style.DropDownBoxBoxHeight.ToString());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // Add span for 'Select all' node
            if (UseSelectAllNode)
            {
                var selectAllHtml = @"<input type='checkbox' name='{0}'><label for='{0}'>{1}</label>";

                if (!string.IsNullOrEmpty(Texts.SelectAllNode))
                {
                    selectAllHtml = string.Format(selectAllHtml, ClientID + selectAllPstfx, Texts.SelectAllNode);
                }

                writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "block");
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                writer.Write(selectAllHtml);
                writer.RenderEndTag();
            }

            // Render legacy markup within wrapping markup
            base.Render(writer);

            // Close div with check boxes
            writer.RenderEndTag();

            // Add div with action buttons
            if (UseButtons)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, "buttons");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                // Close buttons div
                writer.RenderEndTag();
            }

            // Close dropdown div
            writer.RenderEndTag();

            // Close wrapper div
            writer.RenderEndTag();
        }
Ejemplo n.º 44
0
        protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
        {
            // Wire up the onkeypress event handler to the ChangeBackgroundColor() JavaScript function
            Control       c           = Page.FindControl(ControlToManage);
            StringBuilder onClickCall = new StringBuilder();

            //make sure it's the right object
            if (c != null && c.GetType().ToString().Equals("BrightcoveSDK.UI.VideoPlayer"))
            {
                VideoPlayer vp = (VideoPlayer)c;

                //check video id
                if (VideoID.Equals(-1))
                {
                    onClickCall.Append(vp.VideoID);
                }
                else
                {
                    onClickCall.Append(VideoID);
                }
                onClickCall.Append(", ");

                //check for player id
                if (PlayerID.Equals(-1))
                {
                    onClickCall.Append(vp.PlayerID);
                }
                else
                {
                    onClickCall.Append(PlayerID);
                }

                //check for player name
                onClickCall.Append(", '" + vp.PlayerName + "', ");

                //check for auto start
                if (AutoStart.Equals(false))
                {
                    onClickCall.Append(vp.AutoStart.ToString().ToLower());
                }
                else
                {
                    onClickCall.Append(AutoStart.ToString().ToLower());
                }
                onClickCall.Append(", '");

                //check for back color
                if (BackColor.Equals("#000000"))
                {
                    onClickCall.Append(vp.BackColor);
                }
                else
                {
                    onClickCall.Append(BackColor);
                }
                onClickCall.Append("', ");

                //check for width
                if (Width.Equals(0))
                {
                    onClickCall.Append(vp.Width.ToString());
                }
                else
                {
                    onClickCall.Append(Width.ToString());
                }
                onClickCall.Append(", ");

                //check for Height
                if (Height.Equals(0))
                {
                    onClickCall.Append(vp.Height.ToString());
                }
                else
                {
                    onClickCall.Append(Height.ToString());
                }
                onClickCall.Append(", ");

                //check for IsVid
                if (IsVid.Equals(true))
                {
                    onClickCall.Append(vp.IsVid.ToString().ToLower());
                }
                else
                {
                    onClickCall.Append(IsVid.ToString().ToLower());
                }
                onClickCall.Append(", '");

                //check for WMode
                if (WMode.Equals(""))
                {
                    onClickCall.Append(vp.WMode);
                }
                else
                {
                    onClickCall.Append(WMode);
                }

                //append for ClientID
                onClickCall.Append("', '" + vp.ClientID + "', '" + PlaylistTabString + "', '" + PlaylistComboString + "', '" + VideoList.ToString() + "'");

                writer.AddAttribute("onclick", "javascript:addPlayer(" + onClickCall.ToString() + ");return false;");

                base.AddAttributesToRender(writer);
            }
            else
            {
                StringBuilder error = new StringBuilder();
                error.Append("The ControlToManage must be specified or point to a valid VideoPlayer.");

                if (c == null)
                {
                    error.Append("\n The ControlToManage was null.");
                }
                else if (!c.GetType().ToString().Equals("BrightcoveSDK.UI.VideoPlayer"))
                {
                    error.Append("\n The ControlToManage type was " + c.GetType().ToString() + ".");
                }
                throw new ArgumentException(error.ToString());
            }
        }
Ejemplo n.º 45
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            writer.BeginRender();
            try
            {
                //bool toggled = this.Toggled;

                // Write the anchor start.  This will make these images be an actionable object.
                writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);
                writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
                writer.AddAttribute(HtmlTextWriterAttribute.Href, this.Page.ClientScript.GetPostBackClientHyperlink(this, "", true));
                if (this.StyleTheme != ButtonStyleTheme.Custom)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "rsButton " + this.StyleTheme.ToString().ToLower() + " " + this.ColorTheme.ToString().ToLower() + (this.Enabled ? " active" : " disabled"));
                }
                else if (!string.IsNullOrEmpty(this.CssClass))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass);
                }
                if (Enabled)
                {
                    writer.AddAttribute("Enabled", "false");
                }
                writer.RenderBeginTag(HtmlTextWriterTag.A);

                // Write the "outer" span.  This will be the left edge of the button.
                if (this.ControlStyleCreated)
                {
                    if (this.ControlStyle.Font.Italic)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.FontStyle, "oblique");
                    }
                    if (this.ControlStyle.Font.Size != FontUnit.Empty)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, this.ControlStyle.Font.Size.ToString());
                    }
                    if (this.ControlStyle.Font.Names.Length > 0)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.FontFamily, string.Join(", ", this.ControlStyle.Font.Names));
                    }
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "lOuter");
                writer.RenderBeginTag("span");

                // Write the "inner-outer" span.  This will be the right edge of the button.
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "rOuter");
                writer.RenderBeginTag("span");

                // Write the "inner" span.  This will be the center of the button and contain the text.
                if (this.Width != null && this.Width != Unit.Empty)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Width, this.Width.ToString());
                }
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "inner");
                writer.RenderBeginTag("span");

                if (this.ControlStyleCreated)
                {
                    if (this.ControlStyle.Font.Bold)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "bold");
                    }
                    else if (this.ControlStyle.ForeColor != System.Drawing.Color.Transparent)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.Color, Hex.GetWebColor(this.ControlStyle.ForeColor));
                    }
                    if (this.ControlStyle.Font.Strikeout)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.TextDecoration, "strikeout");
                    }
                    if (this.ControlStyle.Font.Underline)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.TextDecoration, "underline");
                    }
                }
                if (this.TextVerticalOffset != Unit.Empty)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.MarginTop, this.TextVerticalOffset.ToString());
                }
                writer.RenderBeginTag("span");

                writer.WriteEncodedText(this.Text);


                writer.RenderEndTag(); // SPAN_text
                writer.RenderEndTag(); // SPAN_inner
                writer.RenderEndTag(); // SPAN_inner-outer
                writer.RenderEndTag(); // SPAN_outer
                writer.RenderEndTag(); // A
            }
            finally
            {
                // Make sure we "end" the rendering, no matter what.
                writer.EndRender();
            }

            // These are not the droids you're looking for...
            //base.Render(writer);
        }
Ejemplo n.º 46
0
        /// <summary>
        /// Generates the target-specific inner markup for the Web control to which the control adapter is attached.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> containing methods to render the target-specific output.</param>
        protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
        {
            RadioButton rb = Control as RadioButton;

            if (rb != null)
            {
                writer.WriteLine();

                // always render the label tag for the radiobutton, even if the radiobutton doesn't have text
                bool renderRadioButtonLabel = true;
                if (renderRadioButtonLabel)
                {
                    if (rb is RockRadioButton)
                    {
                        if ((rb as RockRadioButton).DisplayInline)
                        {
                            writer.AddAttribute(HtmlTextWriterAttribute.Class, "radio-inline");
                        }
                    }

                    writer.RenderBeginTag(HtmlTextWriterTag.Label);
                }

                writer.AddAttribute(HtmlTextWriterAttribute.Id, rb.ClientID);
                writer.AddAttribute(HtmlTextWriterAttribute.Type, "radio");

                string uniqueGroupName = rb.GetType().GetProperty("UniqueGroupName", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(rb, null) as string;
                writer.AddAttribute(HtmlTextWriterAttribute.Name, uniqueGroupName);

                writer.AddAttribute(HtmlTextWriterAttribute.Value, rb.ID);

                if (!string.IsNullOrWhiteSpace(rb.CssClass))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, rb.CssClass);
                }

                if (rb.Checked)
                {
                    writer.AddAttribute("checked", "checked");
                }

                foreach (var attributeKey in rb.Attributes.Keys)
                {
                    var key = attributeKey as string;
                    writer.AddAttribute(key, rb.Attributes[key]);
                }

                foreach (var inputAttributeKey in rb.InputAttributes.Keys)
                {
                    var key = inputAttributeKey as string;
                    writer.AddAttribute(key, rb.InputAttributes[key]);
                }

                if (rb.AutoPostBack)
                {
                    PostBackOptions postBackOption = new PostBackOptions(rb, string.Empty);
                    if (rb.CausesValidation && this.Page.GetValidators(rb.ValidationGroup).Count > 0)
                    {
                        postBackOption.PerformValidation = true;
                        postBackOption.ValidationGroup   = rb.ValidationGroup;
                    }
                    if (this.Page.Form != null)
                    {
                        postBackOption.AutoPostBack = true;
                    }
                    writer.AddAttribute(HtmlTextWriterAttribute.Onclick, Page.ClientScript.GetPostBackEventReference(postBackOption, true));
                }

                writer.RenderBeginTag(HtmlTextWriterTag.Input);
                writer.RenderEndTag();

                if (renderRadioButtonLabel)
                {
                    if (rb.Text.Length > 0)
                    {
                        writer.Write(rb.Text);
                    }
                    else
                    {
                        writer.Write("&nbsp;");
                    }

                    writer.RenderEndTag();      // Label
                }

                if (Page != null && Page.ClientScript != null)
                {
                    Page.ClientScript.RegisterForEventValidation(uniqueGroupName, rb.ID);
                }
            }
        }
Ejemplo n.º 47
0
        /// <inheritdoc />
        protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);

            if (string.IsNullOrEmpty(SwfSrc))
            {
                throw new MissingRequiredAttribute("SwfSrc", SwfSrc);
            }
            else
            {
                writer.AddAttribute("swfsrc", SwfSrc);
            }

            if (!string.IsNullOrEmpty(ImgSrc))
            {
                writer.AddAttribute("imgsrc", ImgSrc);
            }
            if (Width > 0)
            {
                writer.AddAttribute("width", Width.ToString());
            }
            if (Height > 0)
            {
                writer.AddAttribute("height", Height.ToString());
            }
            if (!string.IsNullOrEmpty(ImgStyle))
            {
                writer.AddAttribute("imgstyle", ImgStyle);
            }
            if (!string.IsNullOrEmpty(ImgClass))
            {
                writer.AddAttribute("imgclass", ImgClass);
            }
            if (!string.IsNullOrEmpty(SwfBgColor))
            {
                writer.AddAttribute("swfbgcolor", SwfBgColor);
            }
            if (!string.IsNullOrEmpty(FlashVars))
            {
                writer.AddAttribute("flashvars", FlashVars);
            }
            if (!WaitForClick)
            {
                writer.AddAttribute("waitforclick", FbmlConstants.FALSE);
            }
            if (Loop)
            {
                writer.AddAttribute("loop", FbmlConstants.TRUE);
            }
            if (Quality != SwfQuality.None)
            {
                writer.AddAttribute("quality", Quality.ToString().ToLowerInvariant());
            }
            if (Scale != SwfScale.None)
            {
                writer.AddAttribute("scale", Scale.ToString().ToLowerInvariant());
            }
            if (Align != SwfAlign.None)
            {
                writer.AddAttribute("align", Align.ToString().ToLowerInvariant());
            }
            if (WMode != SwfWMode.Transparent)
            {
                writer.AddAttribute("wmode", WMode.ToString().ToLowerInvariant());
            }


            switch (SAlign)
            {
            case SwfSAlign.Bottom:
                writer.AddAttribute("salign", "b");
                break;

            case SwfSAlign.BottomLeft:
                writer.AddAttribute("salign", "bl");
                break;

            case SwfSAlign.BottomRight:
                writer.AddAttribute("salign", "br");
                break;

            case SwfSAlign.Left:
                writer.AddAttribute("salign", "l");
                break;

            case SwfSAlign.Right:
                writer.AddAttribute("salign", "r");
                break;

            case SwfSAlign.Top:
                writer.AddAttribute("salign", "t");
                break;

            case SwfSAlign.TopLeft:
                writer.AddAttribute("salign", "tl");
                break;

            case SwfSAlign.TopRight:
                writer.AddAttribute("salign", "tr");
                break;
            }
        }
Ejemplo n.º 48
0
 protected override void RenderAttributes(System.Web.UI.HtmlTextWriter writer)
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript");
     writer.AddAttribute(HtmlTextWriterAttribute.Src, this.Src);
     base.RenderAttributes(writer);
 }
Ejemplo n.º 49
0
        public static void DumpMessages(GameDataManager gameDataManager, List <TableFile> tableFiles, string outputFilename)
        {
            string strippedName = Path.GetFileNameWithoutExtension(tableFiles.FirstOrDefault().Filename);

            if (gameDataManager.Version == GameDataManager.Versions.European)
            {
                foreach (KeyValuePair <GameDataManager.Languages, string> pair in gameDataManager.LanguageSuffixes)
                {
                    strippedName = strippedName.Replace(pair.Value, "");
                }
            }

            int numTables = (int)tableFiles.FirstOrDefault().NumTables;

            if (!tableFiles.All(x => x.NumTables == numTables))
            {
                throw new Exception("Num tables mismatch!");
            }

            TextWriter writer = File.CreateText(outputFilename);

            using (WebUI.HtmlTextWriter html = new WebUI.HtmlTextWriter(writer))
            {
                html.WriteLine("<!DOCTYPE html>");
                html.RenderBeginTag(WebUI.HtmlTextWriterTag.Html);
                {
                    WriteHeader(html, string.Format("{0} Message Dump for {1}", System.Windows.Forms.Application.ProductName, strippedName));

                    html.RenderBeginTag(WebUI.HtmlTextWriterTag.Body);
                    {
                        html.AddAttribute(WebUI.HtmlTextWriterAttribute.Class, "container");
                        html.RenderBeginTag(WebUI.HtmlTextWriterTag.Div);
                        {
                            html.WriteEncodedText(string.Format("Message dump created by {0} {1}; dumping {2}, {3} tables...",
                                                                System.Windows.Forms.Application.ProductName,
                                                                VersionManagement.CreateVersionString(System.Windows.Forms.Application.ProductVersion),
                                                                (tableFiles.FirstOrDefault().FileNumber != -1 ? string.Format("{0}, file #{1}", strippedName, tableFiles.FirstOrDefault().FileNumber) : strippedName),
                                                                numTables));
                            html.WriteBreak();
                            html.WriteBreak();
                        }
                        html.RenderEndTag();

                        for (int i = 0; i < numTables; i++)
                        {
                            string tableId = string.Format("table-{0:D4}", i);

                            html.AddAttribute(WebUI.HtmlTextWriterAttribute.Class, "header");
                            html.RenderBeginTag(WebUI.HtmlTextWriterTag.Div);
                            {
                                html.AddAttribute(WebUI.HtmlTextWriterAttribute.Class, "header-text");
                                html.RenderBeginTag(WebUI.HtmlTextWriterTag.Span);
                                {
                                    html.Write("Table {0}", i + 1);
                                }
                                html.RenderEndTag();

                                html.AddAttribute(WebUI.HtmlTextWriterAttribute.Class, "header-toggle");
                                html.RenderBeginTag(WebUI.HtmlTextWriterTag.Span);
                                {
                                    html.AddAttribute(WebUI.HtmlTextWriterAttribute.Href, string.Format("javascript:toggle('{0}');", tableId), false);
                                    html.RenderBeginTag(WebUI.HtmlTextWriterTag.A);
                                    {
                                        html.Write("+/-");
                                    }
                                    html.RenderEndTag();
                                }
                                html.RenderEndTag();
                            }
                            html.RenderEndTag();

                            html.AddAttribute(WebUI.HtmlTextWriterAttribute.Id, tableId);
                            html.AddStyleAttribute(WebUI.HtmlTextWriterStyle.Display, "table");
                            html.RenderBeginTag(WebUI.HtmlTextWriterTag.Table);
                            {
                                html.RenderBeginTag(WebUI.HtmlTextWriterTag.Tr);
                                {
                                    html.RenderBeginTag(WebUI.HtmlTextWriterTag.Th);
                                    {
                                        html.Write("ID");
                                    }
                                    html.RenderEndTag();

                                    foreach (TableFile file in tableFiles)
                                    {
                                        html.RenderBeginTag(WebUI.HtmlTextWriterTag.Th);
                                        {
                                            string language = Path.GetFileNameWithoutExtension(file.Filename);
                                            language = gameDataManager.LanguageSuffixes.FirstOrDefault(x => x.Value == language.Substring(language.LastIndexOf('_'), 3)).Key.ToString();
                                            html.Write(language);
                                        }
                                        html.RenderEndTag();
                                    }
                                }
                                html.RenderEndTag();

                                int numMessages = (int)(tableFiles.FirstOrDefault().Tables[i] as MessageTable).NumMessages;
                                for (int j = 0; j < numMessages; j++)
                                {
                                    if ((tableFiles.FirstOrDefault().Tables[i] as MessageTable).Messages[j].RawData.Length == 0)
                                    {
                                        continue;
                                    }

                                    html.RenderBeginTag(WebUI.HtmlTextWriterTag.Tr);
                                    {
                                        html.AddAttribute(WebUI.HtmlTextWriterAttribute.Class, "desc-column-mesg");
                                        html.RenderBeginTag(WebUI.HtmlTextWriterTag.Th);
                                        {
                                            html.Write("#{0}", j);
                                        }
                                        html.RenderEndTag();

                                        for (int k = 0; k < tableFiles.Count; k++)
                                        {
                                            html.RenderBeginTag(WebUI.HtmlTextWriterTag.Td);
                                            {
                                                string message = (tableFiles[k].Tables[i] as MessageTable).Messages[j].ConvertedString;
                                                message = message.Replace("<!pg>", "");
                                                message = message.Replace(" ", "&nbsp;");
                                                message = message.Replace("<", "&lt;");
                                                message = message.Replace(">", "&gt;");
                                                message = message.Replace(Environment.NewLine, "<br />");
                                                html.Write(message);
                                            }
                                            html.RenderEndTag();
                                        }
                                    }
                                    html.RenderEndTag();
                                }
                            }
                            html.RenderEndTag();
                            html.WriteBreak();
                        }
                    }
                    html.RenderEndTag();
                }
                html.RenderEndTag();
            }
            writer.Close();
        }
Ejemplo n.º 50
0
        /// <summary>
        /// Generates the target-specific inner markup for the Web control to which the control adapter is attached.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> containing methods to render the target-specific output.</param>
        protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
        {
            RadioButtonList rbl = Control as RadioButtonList;

            if (rbl != null)
            {
                PostBackOptions postBackOption = null;

                if (rbl.AutoPostBack)
                {
                    postBackOption = new PostBackOptions(rbl, string.Empty);
                    if (rbl.CausesValidation && this.Page.GetValidators(rbl.ValidationGroup).Count > 0)
                    {
                        postBackOption.PerformValidation = true;
                        postBackOption.ValidationGroup   = rbl.ValidationGroup;
                    }
                    if (this.Page.Form != null)
                    {
                        postBackOption.AutoPostBack = true;
                    }
                }

                WebControl control = new WebControl(HtmlTextWriterTag.Span);
                control.ID = rbl.ClientID;
                control.CopyBaseAttributes(rbl);
                control.RenderBeginTag(writer);

                int i = 0;
                foreach (ListItem li in rbl.Items)
                {
                    writer.WriteLine();

                    if (rbl.RepeatDirection == RepeatDirection.Vertical)
                    {
                        writer.AddAttribute("class", "radio");
                        writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    }
                    else
                    {
                        writer.AddAttribute("class", "radio-inline");
                    }

                    writer.RenderBeginTag(HtmlTextWriterTag.Label);

                    string itemId = string.Format("{0}_{1}", rbl.ClientID, i++);
                    writer.AddAttribute("id", itemId);
                    writer.AddAttribute("type", "radio");
                    writer.AddAttribute("name", rbl.UniqueID);
                    writer.AddAttribute("value", li.Value);
                    if (li.Selected)
                    {
                        writer.AddAttribute("checked", "checked");
                    }

                    foreach (var attributeKey in li.Attributes.Keys)
                    {
                        var key = attributeKey as string;
                        writer.AddAttribute(key, li.Attributes[key]);
                    }

                    if (postBackOption != null)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, Page.ClientScript.GetPostBackEventReference(postBackOption, true));
                    }

                    writer.RenderBeginTag(HtmlTextWriterTag.Input);
                    writer.RenderEndTag();

                    writer.Write(li.Text);

                    writer.RenderEndTag();      // Label

                    if (rbl.RepeatDirection == RepeatDirection.Vertical)
                    {
                        writer.RenderEndTag();  // Div
                    }

                    if (rbl.Page != null)
                    {
                        rbl.Page.ClientScript.RegisterForEventValidation(rbl.UniqueID, li.Value);
                    }
                }

                control.RenderEndTag(writer);

                if (rbl.Page != null)
                {
                    rbl.Page.ClientScript.RegisterForEventValidation(rbl.UniqueID);
                }
            }
        }
Ejemplo n.º 51
0
        public static void DumpParsers(GameDataManager gameDataManager, Type parserType, string outputFilename)
        {
            List <BaseParser> parsedToDump = gameDataManager.ParsedData.Where(x => x.GetType() == parserType).ToList();

            PropertyInfo[] properties = parserType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy)
                                        .Where(x => !x.GetGetMethod().IsVirtual&& (x.GetAttribute <BrowsableAttribute>() == null || x.GetAttribute <BrowsableAttribute>().Browsable == true) && x.DeclaringType != typeof(BaseParser))
                                        .OrderBy(x => x.GetAttribute <Yggdrasil.Attributes.PrioritizedCategory>().Category)
                                        .ToArray();

            TextWriter writer = File.CreateText(outputFilename);

            using (WebUI.HtmlTextWriter html = new WebUI.HtmlTextWriter(writer))
            {
                html.WriteLine("<!DOCTYPE html>");
                html.RenderBeginTag(WebUI.HtmlTextWriterTag.Html);
                {
                    WriteHeader(html, string.Format("{0} Data Dump for {1}", System.Windows.Forms.Application.ProductName, parserType.GetAttribute <Yggdrasil.Attributes.ParserDescriptor>().Description));

                    html.RenderBeginTag(WebUI.HtmlTextWriterTag.Body);
                    {
                        html.AddAttribute(WebUI.HtmlTextWriterAttribute.Class, "container");
                        html.RenderBeginTag(WebUI.HtmlTextWriterTag.Div);
                        {
                            html.WriteEncodedText(string.Format("Data dump created by {0} {1}; dumping {2} entries of type '{3}'...",
                                                                System.Windows.Forms.Application.ProductName,
                                                                VersionManagement.CreateVersionString(System.Windows.Forms.Application.ProductVersion),
                                                                parsedToDump.Count,
                                                                parserType.GetAttribute <Yggdrasil.Attributes.ParserDescriptor>().Description));
                            html.WriteBreak();
                            html.WriteBreak();
                        }
                        html.RenderEndTag();

                        foreach (BaseParser parser in parsedToDump)
                        {
                            string parserId = string.Format("table-{0:D4}", parser.EntryNumber);

                            html.AddAttribute(WebUI.HtmlTextWriterAttribute.Class, "container");
                            html.RenderBeginTag(WebUI.HtmlTextWriterTag.Div);
                            {
                                html.AddAttribute(WebUI.HtmlTextWriterAttribute.Class, "header");
                                html.RenderBeginTag(WebUI.HtmlTextWriterTag.Div);
                                {
                                    html.AddAttribute(WebUI.HtmlTextWriterAttribute.Class, "header-text");
                                    html.RenderBeginTag(WebUI.HtmlTextWriterTag.Span);
                                    {
                                        html.WriteEncodedText(string.Format("Entry {0:D4}: {1}", parser.EntryNumber, parser.EntryDescription));
                                    }
                                    html.RenderEndTag();

                                    html.AddAttribute(WebUI.HtmlTextWriterAttribute.Class, "header-toggle");
                                    html.RenderBeginTag(WebUI.HtmlTextWriterTag.Span);
                                    {
                                        html.AddAttribute(WebUI.HtmlTextWriterAttribute.Href, string.Format("javascript:toggle('{0}');", parserId), false);
                                        html.RenderBeginTag(WebUI.HtmlTextWriterTag.A);
                                        {
                                            html.Write("+/-");
                                        }
                                        html.RenderEndTag();
                                    }
                                    html.RenderEndTag();
                                }
                                html.RenderEndTag();

                                html.AddAttribute(WebUI.HtmlTextWriterAttribute.Id, parserId);
                                html.RenderBeginTag(WebUI.HtmlTextWriterTag.Table);
                                {
                                    string lastCategory = string.Empty;
                                    foreach (PropertyInfo property in properties)
                                    {
                                        string propCategory = ((string)property.GetAttribute <Yggdrasil.Attributes.PrioritizedCategory>().Category).Replace("\t", "");
                                        if (propCategory != lastCategory)
                                        {
                                            lastCategory = propCategory;
                                            html.RenderBeginTag(WebUI.HtmlTextWriterTag.Tr);
                                            {
                                                html.AddAttribute(WebUI.HtmlTextWriterAttribute.Class, "header");
                                                html.AddAttribute(WebUI.HtmlTextWriterAttribute.Colspan, "2");
                                                html.RenderBeginTag(WebUI.HtmlTextWriterTag.Td);
                                                {
                                                    html.Write(propCategory);
                                                }
                                                html.RenderEndTag();
                                            }
                                            html.RenderEndTag();
                                        }
                                        html.RenderBeginTag(WebUI.HtmlTextWriterTag.Tr);
                                        {
                                            html.AddAttribute(WebUI.HtmlTextWriterAttribute.Class, "desc-column");
                                            html.RenderBeginTag(WebUI.HtmlTextWriterTag.Td);
                                            {
                                                DisplayNameAttribute displayName = property.GetAttribute <DisplayNameAttribute>();
                                                DescriptionAttribute description = property.GetAttribute <DescriptionAttribute>();

                                                html.AddAttribute(WebUI.HtmlTextWriterAttribute.Class, "tooltip");
                                                html.RenderBeginTag(WebUI.HtmlTextWriterTag.Span);
                                                {
                                                    html.WriteEncodedText(displayName.DisplayName);
                                                    if (description != null)
                                                    {
                                                        html.RenderBeginTag(WebUI.HtmlTextWriterTag.Span);
                                                        {
                                                            html.WriteEncodedText(description.Description);
                                                        }
                                                        html.RenderEndTag();
                                                    }
                                                }
                                                html.RenderEndTag();
                                            }
                                            html.RenderEndTag();

                                            html.RenderBeginTag(WebUI.HtmlTextWriterTag.Td);
                                            {
                                                object v = property.GetValue(parser, null);
                                                TypeConverterAttribute ca = (TypeConverterAttribute)property.GetCustomAttributes(typeof(TypeConverterAttribute), false).FirstOrDefault();
                                                TypeConverter          c  = new TypeConverter();
                                                if (ca != null)
                                                {
                                                    Type ct = Type.GetType(ca.ConverterTypeName);
                                                    if (ct == typeof(EnumConverter))
                                                    {
                                                        c = (TypeConverter)Activator.CreateInstance(ct, new object[] { property.PropertyType });
                                                    }
                                                    else
                                                    {
                                                        c = (TypeConverter)Activator.CreateInstance(ct);
                                                    }
                                                }
                                                var tmp = c.ConvertTo(v, typeof(string));
                                                html.WriteEncodedText(tmp as string);
                                            }
                                            html.RenderEndTag();
                                        }
                                        html.RenderEndTag();
                                    }
                                }
                                html.RenderEndTag();
                            }
                            html.RenderEndTag();
                        }
                    }
                    html.RenderEndTag();
                }
                html.RenderEndTag();
            }
            writer.Close();
        }
Ejemplo n.º 52
0
        /// <summary>
        /// Generates the target-specific inner markup for the Web control to which the control adapter is attached.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> containing methods to render the target-specific output.</param>
        protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
        {
            ListControl listControl = Control as ListControl;

            if (listControl != null)
            {
                string postBackEventReference = null;

                if (listControl.AutoPostBack)
                {
                    var postBackOption = new PostBackOptions(listControl, string.Empty);
                    if (listControl.CausesValidation && this.Page.GetValidators(listControl.ValidationGroup).Count > 0)
                    {
                        postBackOption.PerformValidation = true;
                        postBackOption.ValidationGroup   = listControl.ValidationGroup;
                    }

                    if (this.Page.Form != null)
                    {
                        postBackOption.AutoPostBack = true;
                    }

                    postBackEventReference = Page.ClientScript.GetPostBackEventReference(postBackOption, true);
                }


                bool   createInputDivClass;
                string inputTagType = GetInputTagType(listControl);

                if (GetRepeatDirection(listControl) == RepeatDirection.Horizontal)
                {
                    // if Horizontal, don't create a <div class="checkbox/radio"> wrapper
                    createInputDivClass = false;
                }
                else
                {
                    // if Vertical, reate a <div class="checkbox/radio"> wrapper
                    createInputDivClass = true;
                }

                int repeatColumns = GetRepeatColumns(listControl);

                bool wrapInRow = repeatColumns > 1;

                int itemIndex = 0;
                foreach (ListItem li in listControl.Items)
                {
                    if (createInputDivClass)
                    {
                        writer.WriteLine();
                        writer.Indent++;
                        writer.AddAttribute("class", inputTagType);
                        writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    }

                    // render checkbox/radio label tag which will contain the input and label text
                    string itemId = $"{listControl.ClientID}_{itemIndex}";

                    writer.WriteLine();
                    writer.Indent++;
                    string labelClass = GetLabelClass(listControl, li);
                    writer.AddAttribute("class", labelClass);
                    writer.AddAttribute("for", itemId);
                    writer.RenderBeginTag(HtmlTextWriterTag.Label);

                    writer.AddAttribute("id", itemId);
                    writer.AddAttribute("type", inputTagType);
                    var inputName = GetInputName(listControl, itemIndex);
                    itemIndex++;
                    writer.AddAttribute("name", inputName);
                    writer.AddAttribute("value", li.Value);
                    if (li.Selected)
                    {
                        writer.AddAttribute("checked", "checked");
                    }

                    if (!listControl.Enabled || !li.Enabled)
                    {
                        writer.AddAttribute("disabled", string.Empty);
                    }

                    foreach (var attributeKey in li.Attributes.Keys)
                    {
                        var key = attributeKey as string;
                        writer.AddAttribute(key, li.Attributes[key]);
                    }

                    if (postBackEventReference != null)
                    {
                        string itemPostBackEventReference = postBackEventReference.Replace(listControl.UniqueID, inputName);
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, itemPostBackEventReference);
                    }

                    writer.WriteLine();
                    writer.Indent++;
                    writer.RenderBeginTag(HtmlTextWriterTag.Input);
                    writer.RenderEndTag();
                    writer.Indent--;

                    writer.WriteLine();
                    writer.Indent++;
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "label-text");
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);

                    writer.Write(li.Text);

                    writer.RenderEndTag();      // Span
                    writer.Indent--;

                    writer.RenderEndTag();      // Label
                    writer.Indent--;

                    if (createInputDivClass)
                    {
                        writer.RenderEndTag();   // checkbox/radio div
                        writer.Indent--;
                    }

                    if (Page != null && Page.ClientScript != null)
                    {
                        Page.ClientScript.RegisterForEventValidation(listControl.UniqueID, li.Value);
                    }
                }


                if (Page != null && Page.ClientScript != null)
                {
                    Page.ClientScript.RegisterForEventValidation(listControl.UniqueID);
                }
            }
        }
Ejemplo n.º 53
0
 protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
 {
     writer.AddAttribute("onchange", "ActionDropDownList_Check(this, \'" + ActionText.Replace("\r\n", "\\n").Replace("\'", "\\").Replace("\t", "\\t") + "\')");
     base.AddAttributesToRender(writer);
 }
Ejemplo n.º 54
0
        //[Bindable(true)]
        //[Category("Appearance")]
        //[DefaultValue("Button")]
        //[Localizable(true)]
        //[Description("Text to be appear on the button")]
        //public override string Text {
        //    get {
        //        String s = (String)ViewState["Text"];
        //        return ((s == null) ? string.Empty : s);
        //    }

        //    set {
        //        ViewState["Text"] = value;
        //    }
        //}

        //protected override void RenderContents(HtmlTextWriter output) {
        //    StringBuilder sb = new StringBuilder();
        //    sb.AppendFormat("<span><span>&nbsp;{0}&nbsp;", Text);
        //    sb.Append("</span></span>");

        //    output.Write(sb.ToString());
        //}

        protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
        {
            writer.AddAttribute("class", "button blue");
            base.AddAttributesToRender(writer);
        }
Ejemplo n.º 55
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            if (!DesignMode)
            {
                System.IO.StringWriter str     = new System.IO.StringWriter();
                HtmlTextWriter         mwriter = new HtmlTextWriter(str);



                mwriter.AddAttribute("id", ClientID);
                if (!string.IsNullOrEmpty(CssClass))
                {
                    mwriter.AddAttribute("class", CssClass);
                }
                if (!string.IsNullOrEmpty(this.Style.Value))
                {
                    mwriter.AddAttribute("style", this.Style.Value);
                }
                mwriter.AddStyleAttribute(HtmlTextWriterStyle.Width, Width.ToString());
                mwriter.AddStyleAttribute(HtmlTextWriterStyle.Height, Height.ToString());



                _ScriptLine = "writeFlash(\'" + ClientID + "\'";



                if (Unit.Equals(ExpandedWidth, Unit.Empty) && Unit.Equals(ExpandedHeight, Unit.Empty))
                {
                    RenderFlashObject(mwriter);
                }
                else
                {
                    string w;
                    string h;
                    if (Unit.Equals(Width, Unit.Empty))
                    {
                        w = "auto";
                    }
                    else
                    {
                        w = Width.ToString();
                    }
                    if (Unit.Equals(Height, Unit.Empty))
                    {
                        h = "auto";
                    }
                    else
                    {
                        h = Height.ToString();
                    }



                    string exw;
                    string exh;
                    if (Unit.Equals(ExpandedWidth, Unit.Empty))
                    {
                        exw = w;
                    }
                    else
                    {
                        exw = ExpandedWidth.ToString();
                    }
                    if (Unit.Equals(ExpandedHeight, Unit.Empty))
                    {
                        exh = h;
                    }
                    else
                    {
                        exh = ExpandedHeight.ToString();
                    }

                    mwriter.AddAttribute("onmouseover", "this.style.clip = \'rect(0px " + exw + " " + exh + " 0px)\';");
                    mwriter.AddAttribute("onmouseout", "this.style.clip = \'rect(0px " + w + " " + h + " 0px)\';");
                    mwriter.AddStyleAttribute("clip", "rect(0px " + w + " " + h + " 0px)");
                    mwriter.RenderBeginTag(HtmlTextWriterTag.Div);
                    RenderFlashObject(mwriter);
                    mwriter.RenderEndTag();
                }
                writer.Write(str.ToString());
            }
            else //DesignMode
            {
                //adds div attributes on DesignMode.
                writer.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "center");
                writer.AddStyleAttribute("border", "solid 1px gray");
                writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(BackColor));

                string url = Page.ClientScript.GetWebResourceUrl(typeof(Configuration.Resources), Configuration.Resources.FlashJpg);
                writer.AddAttribute("src", url);
                writer.AddStyleAttribute("background-image", "url(" + url + ")");
                writer.AddStyleAttribute("background-repeat", "no-repeat");
                switch (Alignment)
                {
                case FlashAlign.TopLeft:
                    writer.AddStyleAttribute("background-position", "left top");
                    break;

                case FlashAlign.TopRight:
                    writer.AddStyleAttribute("background-position", "right top");
                    break;

                case FlashAlign.Top:
                    writer.AddStyleAttribute("background-position", "center top");
                    break;

                case FlashAlign.BottomLeft:
                    writer.AddStyleAttribute("background-position", "left bottom");
                    break;

                case FlashAlign.BottomRight:
                    writer.AddStyleAttribute("background-position", "right bottom");
                    break;

                case FlashAlign.Bottom:
                    writer.AddStyleAttribute("background-position", "center bottom");
                    break;

                case FlashAlign.Left:
                    writer.AddStyleAttribute("background-position", "left center");
                    break;

                case FlashAlign.Right:
                    writer.AddStyleAttribute("background-position", "right center");
                    break;

                default:
                    writer.AddStyleAttribute("background-position", "center");
                    break;
                }

                base.Render(writer);
            }
        }
Ejemplo n.º 56
0
 protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
 {
     base.AddAttributesToRender(writer);
     writer.AddAttribute("onclick", PreviewImage.GetOnClickClientScript(Page, this.FullSizedImageUrl, this.LoadingAnimation, this.Description, this.TransparencyLevel, this.TransparencyColor, HideObjects));
     writer.AddStyleAttribute("cursor", "pointer");
 }
Ejemplo n.º 57
0
        protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);
            //writer.AddAttribute(HtmlTextWriterAttribute.Class, Me.CssClass)

            writer.AddAttribute("sysimgpath", this.SystemImagesPath);
            if (!String.IsNullOrEmpty(this.Target))
            {
                writer.AddAttribute("target", this.Target);
            }

            //css attributes
            if (!String.IsNullOrEmpty(this.TextSuggestCssClass))
            {
                writer.AddAttribute("tscss", this.TextSuggestCssClass);
            }
            if (!String.IsNullOrEmpty(this.DefaultNodeCssClass))
            {
                writer.AddAttribute("css", this.DefaultNodeCssClass);
            }
            if (!String.IsNullOrEmpty(this.DefaultChildNodeCssClass))
            {
                writer.AddAttribute("csschild", this.DefaultChildNodeCssClass);
            }
            if (!String.IsNullOrEmpty(this.DefaultNodeCssClassOver))
            {
                writer.AddAttribute("csshover", this.DefaultNodeCssClassOver);
            }
            if (!String.IsNullOrEmpty(this.DefaultNodeCssClassSelected))
            {
                writer.AddAttribute("csssel", this.DefaultNodeCssClassSelected);
            }

            if (!String.IsNullOrEmpty(this.JSFunction))
            {
                writer.AddAttribute("js", this.JSFunction);
            }
            if (!String.IsNullOrEmpty(this.Delimiter.ToString()))
            {
                writer.AddAttribute("del", this.Delimiter.ToString());
            }
            switch (this.IDToken)
            {
            case eIDTokenChar.None:
                break;

            case eIDTokenChar.Brackets:
                writer.AddAttribute("idtok", "[~]");
                break;

            case eIDTokenChar.Paranthesis:
                writer.AddAttribute("idtok", "(~)");
                break;
            }

            if (this.MinCharacterLookup > 1)
            {
                writer.AddAttribute("minchar", this.MinCharacterLookup.ToString());
            }
            if (this.MaxSuggestRows != 10)
            {
                writer.AddAttribute("maxrows", this.MaxSuggestRows.ToString());
            }
            if (this.LookupDelay != 500)
            {
                writer.AddAttribute("ludelay", this.LookupDelay.ToString());
            }
            if (this.LostFocusDelay != 500)
            {
                writer.AddAttribute("lfdelay", this.LostFocusDelay.ToString());
            }

            if (this.CaseSensitive)
            {
                writer.AddAttribute("casesens", "1");
            }


            writer.AddAttribute("postback", ClientAPI.GetPostBackEventReference(this, "[TEXT]" + ClientAPI.COLUMN_DELIMITER + "Click"));

            if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XMLHTTP))
            {
                writer.AddAttribute("callback", ClientAPI.GetCallbackEventReference(this, "this.getText()", "this.callBackSuccess", "this", "this.callBackFail", "this.callBackStatus", CallBackType));
            }

            if (!String.IsNullOrEmpty(this.CallbackStatusFunction))
            {
                writer.AddAttribute("callbackSF", this.CallbackStatusFunction);
            }

            if (!String.IsNullOrEmpty(this.JSFunction))
            {
                writer.AddAttribute("js", this.JSFunction);
            }
        }
Ejemplo n.º 58
0
 protected override void Render(System.Web.UI.HtmlTextWriter writer)
 {
     writer.AddAttribute("id", ID);
     base.Render(writer);
 }
Ejemplo n.º 59
0
        private static void SelectorNotCheckBoxFooter(HtmlTextWriter writer, Editor editor)
        {
            writer.Write(editor.EditorModeHtmlLabel);
            writer.Write(NonBreakingSpace);
            writer.RenderEndTag();                       // SPAN
            writer.RenderEndTag();                       // TD
            writer.RenderEndTag();                       // TR
            writer.RenderEndTag();                       // TABLE
            writer.RenderEndTag();                       // TD

            writer.RenderBeginTag(HtmlTextWriterTag.Td); // TD

            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "1");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");

            if (editor.StartupMode == EditorMode.Preview)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "1");
                writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, BorderStyle.Solid.ToString());
                writer.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, Utils.Color2Hex(Color.Black));
                writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, Utils.Color2Hex(Color.White));
            }
            else
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "0");
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Table);          // TABLE
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);             // TR
            writer.RenderBeginTag(HtmlTextWriterTag.Td);             // TD
            writer.AddStyleAttribute(HtmlTextWriterStyle.FontFamily, "verdana");
            writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "11px");
            writer.RenderBeginTag(HtmlTextWriterTag.Span);             // SPAN

            if (!editor.TextMode)
            {
                writer.Write(NonBreakingSpace);
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Align, "absmiddle");
                writer.AddAttribute(HtmlTextWriterAttribute.Src,
                                    Utils.ConvertToImageDir(
                                        editor.IconsDirectory == "/"
                                                        ? editor.IconsDirectory = string.Empty
                                                        : editor.IconsDirectory,
                                        editor.EditorModePreviewIcon, TabPreview, editor.Page, editor.GetType()));
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
                writer.Write(NonBreakingSpace);
            }

            writer.Write(editor.EditorModePreviewLabel);
            writer.Write(NonBreakingSpace);
            writer.RenderEndTag();             // SPAN
            writer.RenderEndTag();             // TD
            writer.RenderEndTag();             // TR
            writer.RenderEndTag();             // TABLE
            writer.RenderEndTag();             // TD

            writer.RenderEndTag();             // TR
            writer.RenderEndTag();             // TABLE
        }
Ejemplo n.º 60
0
        public override void WriteHtml(System.Web.UI.HtmlTextWriter w)
        {
            /*
             * //set code language
             * if (Language == CompiledQuestion.LANGUAGE.CPP)
             * {
             * LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Cpp;
             * }
             * else if (Language == CompiledQuestion.LANGUAGE.CS)
             * {
             * LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Cpp;
             * }
             * else if (Language == CompiledQuestion.LANGUAGE.Delphi)
             * {
             * LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Delphi;
             * }
             * else if (Language == CompiledQuestion.LANGUAGE.Java)
             * {
             * LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Java;
             * }
             * */

            //<div>
            w.AddAttribute(HtmlAttribute.Id, Name);
            w.AddAttribute(HtmlAttribute.Name, "advancedCompiledTest");
            w.AddStyleAttribute(HtmlStyleAttribute.Position, "absolute");
            HtmlSerializeHelper <HtmlCompiledTest> .WriteRootElementAttributes(w, this);

            w.RenderBeginTag(HtmlTag.Div);

            //var ls = LanguageToHighlight.ToString().ToLower();

            //<span name="BeforeCode">//there will be lector code
            w.AddAttribute(HtmlAttribute.Id, "TextBoxBefore");
            w.AddStyleAttribute(HtmlStyleAttribute.Overflow, "scroll");
            w.AddStyleAttribute(HtmlStyleAttribute.Height, (Control as AdvancedCompiledTest).TextBoxBefore.Height.ToString());
            w.AddStyleAttribute(HtmlStyleAttribute.Width, (Control as AdvancedCompiledTest).TextBoxBefore.Width.ToString());
            w.RenderBeginTag(HtmlTag.Span);
            //w.AddAttribute(HtmlAttribute.Class, ls);
            //w.WriteFullBeginTag(string.Concat("pre><code class=\"", ls, "\""));
            w.WriteFullBeginTag(string.Concat("pre><code"));
            w.Write((Control as AdvancedCompiledTest).TextBoxBefore.Text.HttpEncode());
            w.WriteFullBeginTag("/code></pre");
            w.RenderEndTag();
            //</span>

            //<textarea>//there will be user code
            w.AddAttribute(HtmlAttribute.Id, "TextBoxUserCode");
            w.AddStyleAttribute(HtmlStyleAttribute.Width, (Control as AdvancedCompiledTest).TextBoxUserCode.Width.ToString());
            w.AddStyleAttribute(HtmlStyleAttribute.Height, (Control as AdvancedCompiledTest).TextBoxUserCode.Height.ToString());
            w.RenderBeginTag(HtmlTextWriterTag.Textarea);
            w.RenderEndTag();
            //</textarea>

            //<span name="AfterCode">//there will be lector code
            w.AddAttribute(HtmlAttribute.Id, "TextBoxAfter");
            w.AddStyleAttribute(HtmlStyleAttribute.Overflow, "scroll");
            w.AddStyleAttribute(HtmlStyleAttribute.Height, (Control as AdvancedCompiledTest).TextBoxAfter.Height.ToString());
            w.AddStyleAttribute(HtmlStyleAttribute.Width, (Control as AdvancedCompiledTest).TextBoxAfter.Width.ToString());
            w.RenderBeginTag(HtmlTag.Span);
            //w.AddAttribute(HtmlAttribute.Class, ls);
            //w.WriteFullBeginTag(string.Concat("pre><code class=\"", ls, "\""));
            w.WriteFullBeginTag(string.Concat("pre><code"));
            w.Write((Control as AdvancedCompiledTest).TextBoxAfter.Text.HttpEncode());
            w.WriteFullBeginTag("/code></pre");
            w.RenderEndTag();
            //</span>

            w.RenderEndTag();
            //</div>
        }