Exemple #1
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)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "note-editor");
            writer.AddAttribute("rel", this.NoteId.ToStringSafe());
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // Edit Mode HTML...
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel panel-noteentry");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-body");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            _tbNote.RenderControl(writer);

            // Options
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "settings clearfix");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "options pull-left");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            if (ShowAlertCheckBox)
            {
                _cbAlert.RenderControl(writer);
            }

            if (ShowPrivateCheckBox)
            {
                _cbPrivate.RenderControl(writer);
            }

            writer.RenderEndTag();

            if (ShowSecurityButton)
            {
                _sbSecurity.EntityId = this.NoteId;
                _sbSecurity.Title    = this.Label;
                _sbSecurity.RenderControl(writer);
            }

            writer.RenderEndTag();  // settings div
            writer.RenderEndTag();  // panel body

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-footer");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _lbSaveNote.RenderControl(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "edit-note-cancel btn btn-xs");
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.Write("Cancel");
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderEndTag();  // note-entry div

            // View Mode HTML...
            writer.AddAttribute(HtmlTextWriterAttribute.Class, ArticleClass);
            writer.RenderBeginTag("article");

            writer.AddAttribute(HtmlTextWriterAttribute.Class, IconClass);
            writer.RenderBeginTag(HtmlTextWriterTag.I);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "details");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // Heading
            writer.RenderBeginTag(HtmlTextWriterTag.H5);
            writer.Write(Caption.EncodeHtmlThenConvertCrLfToHtmlBr());
            if (CreatedDateTime.HasValue)
            {
                writer.Write(" ");
                writer.AddAttribute("class", "date");
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                writer.Write(CreatedDateTime.Value.ToRelativeDateString(6));
                writer.RenderEndTag();
            }
            writer.RenderEndTag();

            writer.Write(Text.EncodeHtmlThenConvertCrLfToHtmlBr());

            writer.RenderEndTag();  // Details Div

            if (CanEdit)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "actions rollover-item");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                _lbDeleteNote.RenderControl(writer);

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "edit-note");
                writer.AddAttribute(HtmlTextWriterAttribute.Href, "#");
                writer.RenderBeginTag(HtmlTextWriterTag.A);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "fa fa-pencil");
                writer.RenderBeginTag(HtmlTextWriterTag.I);
                writer.RenderEndTag();
                writer.RenderEndTag();  // A


                writer.RenderEndTag();  // actions
            }

            writer.RenderEndTag();  // article

            writer.RenderEndTag();
        }