예제 #1
0
 protected override void Render(System.Web.UI.HtmlTextWriter writer)
 {
   //"SelectTagsPanel", "/sitecore/shell/Applications/Taxonomy/Ribbon/SelectTagsPanel.js"
   //ScriptFile tagsBoxScript = new ScriptFile();
   //tagsBoxScript.Type = "text/javascript";
   //tagsBoxScript.Key = Control.GetUniqueID("TagsBoxScript");
   //tagsBoxScript.Src = "/sitecore/shell/Applications/Taxonomy/Ribbon/SelectTagsPanel.js";
   //var currentScriptManager = AjaxScriptManager.Current;
   //if (currentScriptManager!=null)
   //{
   //  currentScriptManager.PageScriptManager.ScriptFiles.Add(tagsBoxScript);
   //}
   //else
   //{
   //  Sitecore.Context.ClientPage.PageScriptManager.ScriptFiles.Add(tagsBoxScript);
   //}
   //writer.WriteBeginTag("script");
   //writer.WriteAttribute("type","text/javascript");
   //writer.WriteAttribute("key", "TagsBoxScript");
   //writer.WriteAttribute("src", "/sitecore/shell/Applications/Taxonomy/Ribbon/SelectTagsPanel.js");
   //writer.WriteEndTag("script");
   //writer.Write(
   //  "<script type=\"text/javascript\" key=\"TagsBoxScript\" src=\"/sitecore/shell/Applications/Taxonomy/Ribbon/SelectTagsPanel.js\"></script>");
   writer.Write(
     "<script type=\"text/javascript\" key=\"TagsBoxScript\">function Tags_KeyPressed() {alert('test');}</script>");
   TextBox tagsBox = new TextBox
     { TextMode = TextBoxMode.MultiLine, Width = Unit.Pixel(500), Height = Unit.Pixel(38) };
   tagsBox.Attributes.Add("onKeyPress", "Tags_KeyPressed();");
   tagsBox.RenderControl(writer);
   base.Render(writer);
 }
예제 #2
0
        /// <summary>
        /// Renders control.
        /// </summary>
        /// <param name="writer">The HtmlTextWriter to render content to.</param>
        protected override void Render(HtmlTextWriter writer)
        {
            if (writer == null)
            {
                return;
            }

            bool renderSecondRow = ((Required || (RangeValidation && ValidationType != CustomValidationDataType.String) || RegularExpressionValidation) &&
                                    Enabled && (!ReadOnly));

            if (this.Theme != MasterPageTheme.Modern)
            {
                BaseValidatedControl.RenderValidatedControlBeginTag(Required && ShowRequired, writer, this.Width);
            }

            if (Masked)
            {
                if (!this.Width.IsEmpty)
                {
                    m_RadMaskedTextBox.Width = ((this.Theme == MasterPageTheme.Modern) ? this.Width : Unit.Percentage(100));
                }
                m_RadMaskedTextBox.RenderControl(writer);
            }
            else
            {
                if (!this.Width.IsEmpty)
                {
                    m_TextBox.Width = ((this.Theme == MasterPageTheme.Modern) ? this.Width : Unit.Percentage(100));
                }
                if (MultiLineMode && (MaxLength > 0))
                {
                    m_TextBox.Attributes.Add("maxLength", MaxLength.ToString(CultureInfo.CurrentCulture));
                }
                m_TextBox.RenderControl(writer);

                if (LengthInfoEnabled)
                {
                    string lengthInfoStringFormat = ((MaxLength > 0) ? Resources.TextBox_LengthInfoStringFormat2 : Resources.TextBox_LengthInfoStringFormat1);
                    writer.Write("<br />");
                    m_Span.RenderControl(writer);
                    writer.Write(string.Format(CultureInfo.CurrentCulture, " " + lengthInfoStringFormat, MaxLength));
                }
            }

            if (this.Theme != MasterPageTheme.Modern)
            {
                BaseValidatedControl.RenderValidatedControlMiddleTag(renderSecondRow, writer);
            }

            this.RenderValidators(writer);

            if (this.Theme != MasterPageTheme.Modern)
            {
                BaseValidatedControl.RenderValidatedControlEndTag(renderSecondRow, writer);
            }
        }
예제 #3
0
        public void RenderBindingObject(HtmlTextWriter output)
        {
            if (this.BindingObject == null)
            {
                return;
            }
            TableMapAttribute     tableAttribute = DomainObjectUtility.GetTableMapAttribute(this.BindingObject);
            Hashtable             hs             = DomainObjectUtility.GetAttributeMemberInfos(this.BindingObject);
            IDictionaryEnumerator myEnumerator   = hs.GetEnumerator();
            int cols  = 0;
            int perTd = 100 / (this.Columns * 2);

            while (myEnumerator.MoveNext())
            {
                if ((cols % this.Columns) == 0)
                {
                    if (cols != 0)
                    {
                        output.RenderEndTag();
                    }
                    output.RenderBeginTag(HtmlTextWriterTag.Tr);
                }

                output.AddStyleAttribute(HtmlTextWriterStyle.Width, perTd.ToString() + "%");
                output.AddAttribute(HtmlTextWriterAttribute.Align, "right");
                output.RenderBeginTag(HtmlTextWriterTag.Td);

                System.Web.UI.WebControls.Label lbl = new System.Web.UI.WebControls.Label();
                lbl.ID   = "lbl" + ((FieldMapAttribute)myEnumerator.Key).FieldName;
                lbl.Text = ((MemberInfo)myEnumerator.Value).Name;
                lbl.RenderControl(output);
                output.RenderEndTag();

                output.AddStyleAttribute(HtmlTextWriterStyle.Width, perTd.ToString() + "%");
                output.AddAttribute(HtmlTextWriterAttribute.Align, "left");
                output.RenderBeginTag(HtmlTextWriterTag.Td);

                Type type1 = ((MemberInfo)myEnumerator.Value is FieldInfo) ? ((FieldInfo)myEnumerator.Value).FieldType : ((PropertyInfo)myEnumerator.Value).PropertyType;

                System.Web.UI.WebControls.TextBox txtBox = new System.Web.UI.WebControls.TextBox();
                txtBox.ID = "txt" + ((FieldMapAttribute)myEnumerator.Key).FieldName;
                //txtBox.Text		= DomainObjectUtility.XMLEncodeValue(((FieldMapAttribute)myEnumerator.Key).DataType, type1, DomainObjectUtility.GetValue(this.BindingObject , ((MemberInfo)myEnumerator.Value), null));
                txtBox.RenderControl(output);
                output.RenderEndTag();
                cols = cols + 1;
            }

            if (((cols - 1) % this.Columns) != 0)
            {
                if (cols > 0)
                {
                    output.RenderEndTag();
                }
            }
        }
        protected override void Render(HtmlTextWriter writer)
        {
#if !V2
            bool DesignMode = this.Context == null;
#endif
            if (!DesignMode)
            {
                Anthem.Manager.WriteBeginControlMarker(writer, "span", this);
            }
            if (Visible)
            {
                if (!DesignMode && _showTextbox)
                {
                    // Non-IE browsers get a textbox for editing.
                    ASP.TextBox textbox = new ASP.TextBox();
                    textbox.ID   = this.ClientID;
                    textbox.Text = Text;
                    textbox.ApplyStyle(GetStyle());
#if V2
                    textbox.EnableTheming = this.EnableTheming;
#endif
                    textbox.Attributes["onblur"] = string.Format("editLabelSave(this,{0},'{1}','{2}','{3}',{4},{5},{6},{7});",
                                                                 "false",
                                                                 string.Empty,
                                                                 string.Empty,
                                                                 this.TextDuringCallBack,
                                                                 this.EnabledDuringCallBack ? "true" : "false",
                                                                 this.PreCallBackFunction == null || this.PreCallBackFunction.Length == 0 ? "null" : this.PreCallBackFunction,
                                                                 this.PostCallBackFunction == null || this.PostCallBackFunction.Length == 0 ? "null" : this.PostCallBackFunction,
                                                                 this.CallBackCancelledFunction == null || this.CallBackCancelledFunction.Length == 0 ? "null" : this.CallBackCancelledFunction
                                                                 );
                    textbox.Attributes["onkeypress"] = "return editLabelCheckKey(event);";
                    textbox.RenderControl(writer);
                }
                else
                {
                    base.Render(writer);
                }
            }
            if (!DesignMode)
            {
                Anthem.Manager.WriteEndControlMarker(writer, "span", this);
            }
        }
		//--- This class allows us to render the design time mode with custom HTML ---'
		public override string GetDesignTimeHtml()
		{
			// Component is the instance of the component or control that
			// this designer object is associated with. This property is 
			// inherited from System.ComponentModel.ComponentDesigner.
			DNNTextSuggest objTextSuggest = (DNNTextSuggest)Component;

			if (objTextSuggest.ID.Length > 0)
			{
				StringWriter sw = new StringWriter();
				HtmlTextWriter tw = new HtmlTextWriter(sw);
				TextBox objText = new TextBox();
				objText.Text = objTextSuggest.Text;
				objText.RenderControl(tw);
				return sw.ToString();
			}
			else
			{
				return null;
			}
		}
        private void RenderRow(HtmlTextWriter writer, string label, TextBox textBox, BaseValidator validator1, BaseValidator validator2)
        {
            // Row
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "Normal");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Label
            writer.AddAttribute(HtmlTextWriterAttribute.Wrap, "false");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderBeginTag(HtmlTextWriterTag.B);
            writer.Write(string.Format("{0}&nbsp;&nbsp;", label));
            writer.RenderEndTag();	// B
            writer.RenderEndTag();	// Td

            // Text box
            writer.AddAttribute(HtmlTextWriterAttribute.Wrap, "false");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            textBox.RenderControl(writer);
            writer.RenderEndTag();	// Td

            // Gap
            writer.AddAttribute(HtmlTextWriterAttribute.Wrap, "false");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("&nbsp;&nbsp;");
            writer.RenderEndTag();	// Td

            // Validator
            writer.AddAttribute(HtmlTextWriterAttribute.Wrap, "false");
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            validator1.RenderControl(writer);
            if (validator2 != null)
                validator2.RenderControl(writer);
            writer.RenderEndTag();	// Td

            // Close out row
            writer.RenderEndTag();	// Tr
        }
예제 #7
0
        /// <summary>
        /// Renderメソッドは、
        /// ・RenderBeginTag(開始のタグ)
        /// ・RenderContents(中間の部分)
        /// ・RenderEndTag(終了のタグ)
        /// の各メソッドをこの順に呼び出して、
        /// コントロールをクライアントに送信する。
        /// </summary>
        /// <param name="output">コントロールの内容を受け取る HtmlTextWriter のオブジェクト</param>
        /// <remarks>
        /// このメソッドは、表示中にページによって自動的に呼び出される。
        /// また、このメソッドは、主にコントロールの開発者によって使用される。
        /// 
        /// WebControl.Renderメソッド
        /// http://msdn.microsoft.com/ja-jp/library/system.web.ui.webcontrols.webcontrol.render.aspx
        /// </remarks>
        protected override void Render(HtmlTextWriter output)
        {
            // Render処理を作り込む。

            //if (false)
            //{
            //    // Renderxの順次呼び出し
            //    // ・RenderBeginTag(開始のタグ)
            //    // ・RenderContents(中間の部分)
            //    // ・RenderEndTag(終了のタグ)

            //    // 独自にWriteでも良い。
            //    output.Write("xxxx");
            //}
            //else
            //{
            //    // 通常通りのRender
            //    base.Render(output);
            //}

            // Creating a Read Only DropDownList - CodeProject
            // http://www.codeproject.com/Articles/26642/Creating-a-Read-Only-DropDownList
            // cpol Code Project Open License - CodeProject
            // http://www.codeproject.com/info/cpol10.aspx

            if (this.ReadOnly)
            {
                // 出力をテキスト・ボックスに変換。
                TextBox tb = new TextBox();
                tb.Text = this.SelectedItem.Text;
                tb.ReadOnly = true;

                // 色は要カスタマイズ。
                tb.BackColor = Color.LightGray;
                
                // テキスト・ボックスのレンダーに変換。
                tb.RenderControl(output);
            }
            else
            {
                base.Render(output);
            }

        }
예제 #8
0
파일: IntBox.cs 프로젝트: htawab/wiscms
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override string GetDesignTimeHtml()
        {
            StringWriter sw = new StringWriter();
            HtmlTextWriter tw = new HtmlTextWriter(sw);

            TextBox tb = new TextBox();
            tb.BackColor = System.Drawing.Color.LightSeaGreen;
            tb.RenderControl(tw);

            return sw.ToString();
        }
예제 #9
0
        protected override void Render(HtmlTextWriter output)
        {
            #region Test for Errors

            if (clip == null)
            {
                RenderException(output, "The requested content could not be found.");
                return;
            }

            if (!adminView)
            {
                if (!clip.ParentCatalog.Enabled)
                {
                    RenderException(output, "The content's requested catalog is disabled.");
                    return;
                }

                if (clip.ExpirationDate < DateTime.Now)
                {
                    RenderException(output, "The requested content is expired.");
                    return;
                }

                if (clip.PublishDate > DateTime.Now)
                {
                    RenderException(output, "The requested content is awaiting publishing.");
                    return;
                }
            }

            #endregion

            #region Editor Rendering

            if (userEditor != null && userEditor.Visible)
            //if (caEditor != null && caEditor.Visible)
            //if (ftbEditor != null && ftbEditor.Visible)
            {
                output.Write("<div style=\"margin-bottom:5px\">Title:</div><div style=\"margin-bottom:5px\">");
                tbTitle.RenderControl(output);
                output.Write("</div><div style=\"margin-bottom:5px\">Description:</div><div style=\"margin-bottom:5px\">");
                tbDescription.RenderControl(output);
                output.Write("</div><div style=\"margin-bottom:5px\">");
                userEditor.RenderControl(output);
                //ftbEditor.RenderControl(output);
                output.Write("</div><div>");
                btSave.RenderControl(output);
                output.Write("&nbsp;");
                btCancel.RenderControl(output);
                output.Write("</div>");
                return;
            }

            #endregion

            #region Content Rendering

            if (_contentOnly)
            {
                // Resolve home references! Whahoo!
                output.Write(clip.Body.Replace("=\"~", Page.ResolveUrl("~")));

                // Display Edit Link
                if (btEdit != null && btEdit.Visible)
                {
                    output.Write("<br>");
                    btEdit.RenderControl(output);
                }

                return;
            }

            #endregion

            // Compile Clip
            Amns.GreyFox.Content.Support.ContentBuilder b = new Amns.GreyFox.Content.Support.ContentBuilder(clip);
            b.Compile();

            this.renderTextTag(output, _titleCssClass, "h3", clip.Title);

            if (clip.Authors.Count != 0)
            {
                output.WriteBeginTag("h4");
                if (_contributorsCssClass != "")
                {
                    output.WriteAttribute("class", _contributorsCssClass);
                }
                output.Write(HtmlTextWriter.TagRightChar);
                for (int i = 0; i < clip.Authors.Count; i++)
                {
                    output.Write(clip.Authors[i].Contact.ConstructName("P F L S"));
                    if (i + 1 < clip.Authors.Count)
                    {
                        output.Write(", ");
                    }
                }
                output.WriteEndTag("h4");

                // Output Dates
                this.renderTextTag(output, _publishDateCssClass, "h5", clip.PublishDate.ToString("MMMM yyyy"));
            }

            output.WriteBeginTag("div");
            if (_bodyCssClass != string.Empty)
            {
                output.WriteAttribute("class", _bodyCssClass);
            }
            output.Write(HtmlTextWriter.TagRightChar);

            #region Reference, Administrator and Additional Side Panels

            output.WriteBeginTag("div");
            output.WriteAttribute("style", "float:right;");
            output.Write(HtmlTextWriter.TagRightChar);

            #region Reference Panel

            if (clip.References.Count != 0)
            {
                output.WriteBeginTag("table");
                output.WriteAttribute("border", "0");
                output.WriteAttribute("cellPadding", "5");
                output.WriteAttribute("cellSpacing", "0");
                output.WriteAttribute("width", "150px");
                if (_referenceTableCssClass != string.Empty)
                {
                    output.WriteAttribute("class", _referenceTableCssClass);
                }
                output.Write(HtmlTextWriter.TagRightChar);
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                if (_referenceTitleCssClass != string.Empty)
                {
                    output.WriteAttribute("class", _referenceTitleCssClass);
                }
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write("References");
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
                foreach (DbContentClip reference in clip.References)
                {
                    output.WriteFullBeginTag("tr");
                    output.WriteFullBeginTag("td");
                    output.WriteBeginTag("a");
                    if (reference.OverrideUrl != string.Empty)
                    {
                        output.WriteAttribute("href", reference.OverrideUrl);
                    }
                    else
                    {
                        output.WriteAttribute("href", Page.ResolveUrl(string.Format(_linkFormat, reference.ID)));
                    }
                    if (reference.MenuTooltip != string.Empty)
                    {
                        output.WriteAttribute("title", reference.MenuTooltip);
                    }
                    output.Write(HtmlTextWriter.TagRightChar);
                    output.Write(reference.Title);
                    output.WriteEndTag("a");
                    output.WriteEndTag("td");
                    output.WriteEndTag("tr");
                }
                output.WriteEndTag("table");
            }

            #endregion

            #region Administration Panel

            if (btEdit != null && btEdit.Visible)
            {
                output.WriteBeginTag("table");
                output.WriteAttribute("border", "0");
                output.WriteAttribute("cellPadding", "5");
                output.WriteAttribute("cellSpacing", "0");
                output.WriteAttribute("width", "150px");
                if (_referenceTableCssClass != string.Empty)
                {
                    output.WriteAttribute("class", _referenceTableCssClass);
                }
                output.Write(HtmlTextWriter.TagRightChar);
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                if (_referenceTitleCssClass != string.Empty)
                {
                    output.WriteAttribute("class", _referenceTitleCssClass);
                }
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write("Administration");
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
                output.WriteFullBeginTag("tr");
                output.WriteFullBeginTag("td");
                btEdit.RenderControl(output);
                output.WriteEndTag("td");
                output.WriteEndTag("tr");

                #region Hit Counter Display

                // TODO: Finish Counter
                int totalHits  = 0;
                int uniqueHits = 0;

                DbContentHitManager    hm   = new DbContentHitManager();
                DbContentHitCollection hits = hm.GetCollection("RequestContentID=" + clip.ID.ToString(), "RequestDate", null);

                totalHits = hits.Count;

                // =================================================
                // BAR GRAPH
                // =================================================

                DateTime now = DateTime.Now;

                DateTime weekStart6 = DateManipulator.FirstOfWeek(now);
                DateTime weekStart5 = DateManipulator.FirstOfWeek(now.Subtract(TimeSpan.FromDays(7)));
                DateTime weekStart4 = DateManipulator.FirstOfWeek(now.Subtract(TimeSpan.FromDays(14)));
                DateTime weekStart3 = DateManipulator.FirstOfWeek(now.Subtract(TimeSpan.FromDays(21)));
                DateTime weekStart2 = DateManipulator.FirstOfWeek(now.Subtract(TimeSpan.FromDays(28)));
                DateTime weekStart1 = DateManipulator.FirstOfWeek(now.Subtract(TimeSpan.FromDays(35)));

                int[] weekCounts = new int[6];

                // Count Unique Hits
                foreach (DbContentHit hit in hits)
                {
                    if (hit.IsUnique)
                    {
                        if (hit.RequestDate > weekStart1 & hit.RequestDate < weekStart2)
                        {
                            weekCounts[0]++;
                        }
                        if (hit.RequestDate > weekStart2 & hit.RequestDate < weekStart3)
                        {
                            weekCounts[1]++;
                        }
                        if (hit.RequestDate > weekStart3 & hit.RequestDate < weekStart4)
                        {
                            weekCounts[2]++;
                        }
                        if (hit.RequestDate > weekStart4 & hit.RequestDate < weekStart5)
                        {
                            weekCounts[3]++;
                        }
                        if (hit.RequestDate > weekStart5 & hit.RequestDate < weekStart6)
                        {
                            weekCounts[4]++;
                        }
                        if (hit.RequestDate > weekStart6)
                        {
                            weekCounts[5]++;
                        }

                        uniqueHits++;
                    }
                }

                int graphWidth   = 138;
                int graphHeight  = 100;
                int graphPadding = 1;
                int plotWidth    = graphWidth - (graphPadding * 2);
                int plotHeight   = graphHeight - (graphPadding * 2);
                int maxBarHeight = plotHeight;
                int minBarHeight = 20;
                int barMargin    = 2;
                int barWidth     = 21;

                // Find Highest Count
                int maxCount = 0;
                for (int i = 0; i < weekCounts.Length; i++)
                {
                    if (weekCounts[i] > maxCount)
                    {
                        maxCount = weekCounts[i];
                    }
                }

                // Find Height per Unit
                double pixelUnit = Convert.ToDouble(maxBarHeight) / Convert.ToDouble(maxCount);

                output.WriteFullBeginTag("tr");
                output.WriteFullBeginTag("td");
                output.Write("<strong>Hits:</strong>");
                output.WriteEndTag("td");
                output.WriteEndTag("tr");

                output.WriteFullBeginTag("tr");
                output.WriteFullBeginTag("td");

                output.WriteFullBeginTag("style");
                output.WriteLine("#vertgraph { width : " + graphWidth.ToString() + "px; " +
                                 "height: " + graphHeight.ToString() + "px; " +
                                 "position: relative; " +
                                 "padding: " + graphPadding.ToString() + "px; " +
                                 "background: #aaaaaa; }");
                output.WriteLine("#vertgraph .graph-area { width: " + plotWidth.ToString() + "px; " +
                                 "height: " + plotHeight.ToString() + "px; " +
                                 "padding: 0; " +
                                 "margin: 0; " +
                                 "position: relative; " +
                                 "overflow: hidden; } ");
                output.WriteLine("#vertgraph ul { width: " + plotWidth.ToString() + "px; " +
                                 "height: " + plotHeight.ToString() + "px; " +
                                 "margin: 0; " +
                                 "padding: 0; " +
                                 "position: absolute; " +
                                 "bottom: 0; " +
                                 "list-style-type: none; }");
                output.Write("#vertgraph ul li { position: absolute; " +
                             "width: " + barWidth.ToString() + "px; " +
                             "height: " + maxBarHeight.ToString() + "px; " +
                             "bottom: 0; " +
                             "padding 0; " +
                             "margin 0; " +
                             "background: no-repeat; " +
                             "writing-mode:tb-rl; " +
                             "text-align: center; " +
                             "font-size: xx-small; " +
                             //					"font-weight: bold; " +
                             "vertical-align: middle; " +
                             "color: white; }");
                output.WriteLine("#vertgraph li.week1 { background: #999999; left: 0px; }");
                output.WriteLine("#vertgraph li.week2 { background: #888888; left: " + ((barMargin + barWidth) * 1).ToString() + "px; }");
                output.WriteLine("#vertgraph li.week3 { background: #777777; left: " + ((barMargin + barWidth) * 2).ToString() + "px; }");
                output.WriteLine("#vertgraph li.week4 { background: #666666; left: " + ((barMargin + barWidth) * 3).ToString() + "px; }");
                output.WriteLine("#vertgraph li.week5 { background: #555555; left: " + ((barMargin + barWidth) * 4).ToString() + "px; }");
                output.WriteLine("#vertgraph li.week6 { background: #444444; left: " + ((barMargin + barWidth) * 5).ToString() + "px; }");
                output.WriteEndTag("style");

                output.WriteBeginTag("div");
                output.WriteAttribute("id", "vertgraph");
                output.Write(HtmlTextWriter.TagRightChar);
                output.WriteBeginTag("div");
                output.WriteAttribute("id", "graph-area");
                output.Write(HtmlTextWriter.TagRightChar);
                output.WriteFullBeginTag("ul");

                int    barHeight;
                double barHeightD = 0;

                for (int i = 0; i < 6; i++)
                {
                    barHeightD = Convert.ToDouble(weekCounts[i]) * pixelUnit;
                    if (barHeightD < minBarHeight)
                    {
                        barHeight = minBarHeight;
                    }
                    else if (double.IsNaN(barHeightD))
                    {
                        barHeight = minBarHeight;
                    }
                    else
                    {
                        barHeight = Convert.ToInt32(barHeightD);
                    }

                    output.WriteBeginTag("li");
                    output.WriteAttribute("class", "week" + (i + 1).ToString());
                    output.WriteAttribute("style", "height: " + barHeight + "px;");
                    output.Write(HtmlTextWriter.TagRightChar);
                    output.Write(weekCounts[i]);
                    output.WriteEndTag("li");
                    output.WriteLine();
                }

                output.WriteEndTag("ul");
                output.WriteEndTag("div");
                output.WriteEndTag("div");

                output.WriteEndTag("td");
                output.WriteEndTag("tr");
                // ===============================================
                // END BAR GRAPH
                // ===============================================

                output.WriteFullBeginTag("tr");
                output.WriteFullBeginTag("td");
                output.Write("<strong>Unique Hits:</strong><br />");
                output.Write(uniqueHits);
                output.WriteEndTag("td");
                output.WriteEndTag("tr");

                output.WriteFullBeginTag("tr");
                output.WriteFullBeginTag("td");
                output.Write("<strong>Total Hits:</strong><br />");
                output.Write(totalHits);
                output.WriteEndTag("td");
                output.WriteEndTag("tr");

                if (hits.Count > 0)
                {
                    output.WriteFullBeginTag("tr");
                    output.WriteFullBeginTag("td");
                    output.Write("<strong>Last Hit:</strong><br />");
                    output.Write(hits[hits.Count - 1].RequestDate.ToString());
                    output.WriteEndTag("td");
                    output.WriteEndTag("tr");
                }

                #endregion

                #region Update Display

                output.WriteFullBeginTag("tr");
                output.WriteFullBeginTag("td");
                output.Write("<strong>Last Updated:</strong><br />");
                output.Write(clip.ModifyDate.ToString());
                output.WriteEndTag("td");
                output.WriteEndTag("tr");

                #endregion

                #region Admin Notices

                output.WriteFullBeginTag("tr");
                output.WriteFullBeginTag("td");

                if (!clip.ParentCatalog.Enabled)
                {
                    output.Write(string.Format("<div><font color=\"ff0000\">Admin Notice: The requested clip's parent catalog '{0}' is disabled.</font></div>", clip.ParentCatalog.Title));
                }
                if (clip.ExpirationDate < DateTime.Now)
                {
                    output.Write(string.Format("<div><font color=\"ff0000\">Admin Notice: The requested clip expired on {0}.</font></div>", clip.ExpirationDate));
                }
                if (clip.PublishDate > DateTime.Now)
                {
                    output.Write(string.Format("<div><font color=\"ff0000\">Admin Notice: The requested clip will be published on {0}.</font></div>", clip.PublishDate));
                }

                output.WriteEndTag("td");
                output.WriteEndTag("tr");

                #endregion

                output.WriteEndTag("table");
            }

            #endregion

            #region Gloss Word Panel

            if (b.FaqCompiled)
            {
                output.Write("\r\n" +
                             "<script language=\"javascript\">\r\n" +
                             "function gfx_faqToggle(id) {\r\n" +
                             "	q = new getObj(id); \r\n"+
                             "	if(q.style.display == 'block') \r\n"+
                             "		q.style.display = 'none'; \r\n"+
                             "	else \r\n"+
                             "		q.style.display = 'block'; \r\n"+
                             "}\r\n" +
                             "</script>\r\n");
            }

            if (b.GlossWordsCompiled)
            {
                output.Write("\r\n" +
                             "<script language=\"javascript\">\r\n" +
                             "function gfx_glossCopy(id) {\r\n" +
                             "	document.getElementById('glosscontainer').innerHTML = \r\n"+
                             "		document.getElementById(id).innerHTML;\r\n"+
                             "}\r\n" +
                             "</script>\r\n");

                output.WriteBeginTag("table");
                output.WriteAttribute("border", "0");
                output.WriteAttribute("cellPadding", "5");
                output.WriteAttribute("cellSpacing", "0");
                output.WriteAttribute("width", "150px");
                if (_glossTableCssClass != string.Empty)
                {
                    output.WriteAttribute("class", _glossTableCssClass);
                }
                output.Write(HtmlTextWriter.TagRightChar);
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                if (_glossTitleCssClass != string.Empty)
                {
                    output.WriteAttribute("class", _glossTitleCssClass);
                }
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write("Glossary");
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
                output.WriteFullBeginTag("tr");
                output.WriteFullBeginTag("td");
                output.WriteBeginTag("div");
                output.WriteAttribute("id", "glosscontainer");
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write("Please hover over a keyword to view glossary content.");
                output.WriteEndTag("div");
                output.Write(b.GlossBlock);
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
                output.WriteEndTag("table");
            }

            #endregion

            output.WriteEndTag("div");

            #endregion

            output.Write(b.Output);

            output.WriteEndTag("div");

            // DO NOT RECORD HITS ON ADMIN VIEW OR IF USER HAS ALREADY
            // HIT THIS PAGE UNIQUELY.
            if (!adminView & _hitCounterEnabled)
            {
                if (Page.Session["GFX_HIT_" + clip.ID.ToString()] == null)
                {
                    clip.SaveHit(Page.Request, true);
                    Page.Session["GFX_HIT_" + clip.ID.ToString()] = true;
                }
                else
                {
                    clip.SaveHit(Page.Request, false);
                }
            }
        }
예제 #10
0
파일: RangeBox.cs 프로젝트: htawab/wiscms
        public override string GetDesignTimeHtml()
        {
            StringWriter sw = new StringWriter();
            HtmlTextWriter tw = new HtmlTextWriter(sw);

            TextBox tb = new TextBox();
            tb.Text = "RangeBox";
            tb.ControlStyle.BackColor = System.Drawing.Color.Red;
            tb.RenderControl(tw);

            return sw.ToString();
        }
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            try
            {
                if (Utility.HtmlIsHidden(HideFromAgents))
                    return;
                if (WriteCachedOuput(writer))
                    return;

                if (string.IsNullOrEmpty(XslName))
                {
                    Trace.WriteLine("No XSL name specified");
                    return;
                }

                if (XslName.ToLower() == "blank.xsl")
                    return;

                if (Document == null)
                {
                    Trace.WriteLine(CacheKey + ": Document is NULL...Unable to render");
                    return;
                }

                if (this.ShowXml)
                {
                    TextBox showxml = new TextBox();
                    showxml.EnableViewState = false;
                    showxml.ID = this.UniqueID + "_showxml";
                    showxml.TextMode = TextBoxMode.MultiLine;
                    showxml.Wrap = true;
                    showxml.Rows = 10;
                    showxml.Columns = 30;
                    XmlDocument showXmlDoc = (XmlDocument)this.Document;
                    showxml.Text = showXmlDoc.InnerXml;
                    showxml.CssClass = "showxml";
                    showxml.RenderControl(writer);
                }
                else
                {
                    XmlDocument oXsl = new XmlDocument();
                    object oXslTransform = null;

                    if (!SPContext.Current.Web.UserIsWebAdmin)
                        oXslTransform = HttpContext.Current.Cache[XslCacheKey];

                    XslCompiledTransform oTransform = null;

                    if (oXslTransform == null)
                    {
                        string sXSLLibrary = XslLibrary;
                        string sXslString = SPContext.Current.Site.RootWeb.GetFileAsString(sXSLLibrary + XslName);
                        oXsl.LoadXml(sXslString);

                        oTransform = new XslCompiledTransform();
                        oTransform.Load(oXsl);

                        HttpContext.Current.Cache.Add(XslCacheKey, oTransform, null,
                            DateTime.Now.AddMinutes(this.CacheDuration),
                            System.Web.Caching.Cache.NoSlidingExpiration,
                            System.Web.Caching.CacheItemPriority.AboveNormal, null);
                    }
                    else
                        oTransform = (XslCompiledTransform)oXslTransform;

                    if (CacheOutput)
                        TransformAndCache(writer, oTransform);
                    else
                    {
                        if (System.Configuration.ConfigurationManager.AppSettings["EncryptXSL"] != null && System.Configuration.ConfigurationManager.AppSettings["EncryptXSL"].ToString().Contains(XslName.ToLower()))
                        {
                            System.IO.StringWriter sw = new System.IO.StringWriter();
                            HtmlTextWriter tw = new HtmlTextWriter(sw);

                            oTransform.Transform(Document, BuildArguments(), tw);

                            //Encrypt
                            string enc = Utility.EncryptText(sw.ToString());
                            writer.Write(enc);
                        }
                        else
                        {
                            oTransform.Transform(Document, BuildArguments(), writer);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(XslCacheKey);
                Trace.Write(ex);
            }

            base.Render(writer);
        }
예제 #12
0
        protected override void Render(HtmlTextWriter writer)
        {
#if !V2
            bool DesignMode = this.Context == null;
#endif
            if (!DesignMode)
            {
                Anthem.Manager.WriteBeginControlMarker(writer, "span", this);
            }
            if (Visible)
            {
                if (!DesignMode && _showTextbox)
                {
                    // Non-IE browsers get a textbox for editing.
                    ASP.TextBox textbox = new ASP.TextBox();
                    textbox.ID = this.ClientID;
                    textbox.Text = Text;
                    textbox.ApplyStyle(GetStyle());
#if V2
                    textbox.EnableTheming = this.EnableTheming;
#endif
                    textbox.Attributes["onblur"] = string.Format("editLabelSave(this,{0},'{1}','{2}','{3}',{4},{5},{6},{7});",
                        "false",
                        string.Empty,
                        string.Empty,
                        this.TextDuringCallBack,
                        this.EnabledDuringCallBack ? "true" : "false",
                        this.PreCallBackFunction == null || this.PreCallBackFunction.Length == 0 ? "null" : this.PreCallBackFunction,
                        this.PostCallBackFunction == null || this.PostCallBackFunction.Length == 0 ? "null" : this.PostCallBackFunction,
                        this.CallBackCancelledFunction == null || this.CallBackCancelledFunction.Length == 0 ? "null" : this.CallBackCancelledFunction
                    );
                    textbox.Attributes["onkeypress"] = "return editLabelCheckKey(event);";
                    textbox.RenderControl(writer);
                }
                else
                {
                    base.Render(writer);
                }
            }
            if (!DesignMode)
            {
                Anthem.Manager.WriteEndControlMarker(writer, "span", this);
            }
        }
예제 #13
0
        protected virtual void RenderContentsInternal(HtmlTextWriter writer, TextBox ctl, bool reenterPassword)
        {
            if (this.RenderMode == FieldControlRenderMode.InlineEdit)
            {
                var titleText = String.Concat(this.Field.DisplayName, " ", this.Field.Description);
                ctl.Attributes.Add("Title", titleText);
            }

            if (this.Field.ReadOnly)
                writer.Write(ctl.Text);
            else if (this.ReadOnly)
            {
                ctl.Enabled = !this.ReadOnly;
                ctl.EnableViewState = false;
                ctl.RenderControl(writer);
            }
            else
                ctl.RenderControl(writer);
        }