Exemplo n.º 1
0
        public override string GetDesignTimeHtml()
        {
            StringWriter   writer     = new StringWriter(CultureInfo.CurrentCulture);
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);

            NumberField c = (NumberField)this.Control;

            string width  = (c.Width != Unit.Empty) ? string.Format(" width: {0};", (c.Grow && c.GrowMin.Value > c.Width.Value) ? c.GrowMin.ToString() : c.Width.ToString()) : string.Empty;
            string height = (c.Height != Unit.Empty) ? string.Format(" height: {0};", c.Height.ToString()) : string.Empty;

            object[] args = new object[7];
            args[0] = c.ClientID;
            args[1] = (string.IsNullOrEmpty(c.Text)) ? c.EmptyText : c.Text;
            args[2] = c.InputType.ToString().ToLower();
            args[3] = width;
            args[4] = height;
            args[5] = c.StyleSpec;
            args[6] = "x-form-text x-form-field x-form-num-field " + ((string.IsNullOrEmpty(c.Text)) ? "x-form-empty-field " : string.Empty) + c.Cls;

            LiteralControl ctrl = new LiteralControl(string.Format(this.Html, args));

            ctrl.RenderControl(htmlWriter);

            return(writer.ToString());
        }
Exemplo n.º 2
0
        protected override void Render(HtmlTextWriter writer)
        {
            var headControl = Page.Header;

            if (headControl == null)
            {
                base.Render(writer);
                return;
            }
            try
            {
                var hrefServerPart = VirtualPathUtility.AppendTrailingSlash(PortalContext.Current.SiteUrl);
                var hrefPathPart   = PortalContext.Current.RequestedUri.GetComponents(UriComponents.Path, UriFormat.SafeUnescaped);
                var hrefString     = string.Concat(hrefServerPart, hrefPathPart);

                //note that if the original URI already contains a trailing slash, we do not remove it
                if (AppendTrailingSlash)
                {
                    hrefString = VirtualPathUtility.AppendTrailingSlash(hrefString);
                }

                var baseTag = new LiteralControl
                {
                    ID   = "baseTag",
                    Text = String.Format("<base href=\"//{0}\" />", hrefString)
                };

                baseTag.RenderControl(writer);
            }
            catch (Exception exc) //logged
            {
                Logger.WriteException(exc);
            }
        }
Exemplo n.º 3
0
        private void cbUpgrade_Callback(object sender, Controls.CallBackEventArgs e)
        {
            string upFilePath = Server.MapPath("~/desktopmodules/activeforums/upgrade4x.txt");
            string err        = "Success";

            try
            {
                if (System.IO.File.Exists(upFilePath))
                {
                    string s = Utilities.GetFileContent(upFilePath);
                    err = DotNetNuke.Entities.Portals.PortalSettings.ExecuteScript(s);
                    System.IO.File.Delete(upFilePath);
                }
            }
            catch (Exception ex)
            {
                if (ex is UnauthorizedAccessException && string.IsNullOrEmpty(err))
                {
                    err = "<span style=\"font-size:14px;font-weight:bold;\">The forum data was upgraded successfully, but you must manually delete the following file:<br /><br />" + upFilePath + "<br /><br />The upgrade is not complete until you delete the file indicated above.</span>";
                }
                else
                {
                    err = "<span style=\"font-size:14px;font-weight:bold;\">Upgrade Failed - Please go to the <a href=\"http://www.activemodules.com/community/helpdesk.aspx\">Active Modules Help Desk</a> to report the error indicated below:<br /><br />" + ex.Message + "</span>";
                }
            }
            LiteralControl lit = new LiteralControl();

            if (string.IsNullOrEmpty(err))
            {
                err = "<script type=\"text/javascript\">LoadView('home');</script>";
            }
            lit.Text = err;
            lit.RenderControl(e.Output);
        }
Exemplo n.º 4
0
        private void RenderButtonRange(int start, int end, HtmlTextWriter writer)
        {
            for (int i = start; i < end; i++)
            {
                if (PageIndex == i)
                {
                    Literal l = new Literal();
                    l.Text = "<font color =red>" + (i + 1).ToString() + "</font>";

                    l.RenderControl(writer);
                }
                else
                {
                    pagingLinkButtons[i].RenderControl(writer);
                }
                if (i < (end - 1))
                {
                    writer.Write("&nbsp;");
                }
            }

            LiteralControl l1 = new LiteralControl("&nbsp;");

            l1.RenderControl(writer);
        }
Exemplo n.º 5
0
        void RenderPrevious(HtmlTextWriter writer)
        {
            previousButton.RenderControl(writer);

            LiteralControl l = new LiteralControl("&nbsp;");

            l.RenderControl(writer);
        }
Exemplo n.º 6
0
        void RenderCountLabel(HtmlTextWriter writer)
        {
            countLabel.RenderControl(writer);

            LiteralControl l = new LiteralControl("&nbsp;");

            l.RenderControl(writer);
        }
Exemplo n.º 7
0
        void RenderLast(HtmlTextWriter writer)
        {
            lastButton.RenderControl(writer);

            LiteralControl l = new LiteralControl("&nbsp;");

            l.RenderControl(writer);
        }
Exemplo n.º 8
0
        public override void RenderControl(HtmlTextWriter writer)
        {
            base.RenderControl(writer);
            HtmlData = MarkupExtensionProcessor.Instance.Process(HtmlData);
            LiteralControl lit = new LiteralControl(HtmlData);

            lit.RenderControl(writer);
        }
Exemplo n.º 9
0
 /// <summary>
 /// Overrides <see cref="HtmlControl.Render"/>.
 /// </summary>
 protected override void Render(HtmlTextWriter writer)
 {
     base.Render(writer);
     if (master != null)
     {
         LiteralControl script = new LiteralControl("\r\n<script language='javascript'>\r\nRowSelectorColumn_Register('" + master.ClientID + "', '" + this.ClientID + "')\r\n</script>");
         script.RenderControl(writer);
     }
 }
Exemplo n.º 10
0
 protected override void Render(HtmlTextWriter writer)
 {
     writer.Write("<div id=\"container" + ID + "\" class=\"macroeditor\">");
     _delete.RenderControl(writer);
     writer.Write("<h4>Macro:</h4>");
     _macroSelectDropdown.RenderControl(writer);
     writer.Write(" ");//<a style=\"color: red;\" href=\"javascript:deletemacro('" + _macroSelectDropdown.ClientID + "','"+ID+"container' )\">Delete</a>");
     propertiesHeader.RenderControl(writer);
     _formTable.RenderControl(writer);
     writer.Write("</div>");
 }
Exemplo n.º 11
0
        void RenderFirst(HtmlTextWriter writer)
        {
            int totalPages = CalculateTotalPages();

            if ((PageIndex >= 3) && (totalPages > 5))
            {
                firstButton.RenderControl(writer);

                LiteralControl l = new LiteralControl("&nbsp;...&nbsp;");
                l.RenderControl(writer);
            }
        }
Exemplo n.º 12
0
        void RenderLast(HtmlTextWriter writer)
        {
            int totalPages = CalculateTotalPages();

            if (((PageIndex + 3) < totalPages) && (totalPages > 5))
            {
                LiteralControl l = new LiteralControl("&nbsp;...&nbsp;");
                l.RenderControl(writer);

                lastButton.RenderControl(writer);
            }
        }
Exemplo n.º 13
0
        public override void RenderControl(HtmlTextWriter writer)
        {
            base.RenderControl(writer);

            LiteralControl scriptLit = new LiteralControl(scriptTag);

            scriptLit.RenderControl(writer);

            LiteralControl recaptchaLit = new LiteralControl(recaptchaTag);

            recaptchaLit.RenderControl(writer);
        }
Exemplo n.º 14
0
        public override string XGetDesignTimeHtml(DesignerRegionCollection regions)
        {
            EditableDesignerRegion region = new EditableDesignerRegion(this, "Body", false);

            regions.Add(region);

            StringWriter   writer     = new StringWriter(CultureInfo.CurrentCulture);
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);

            FieldSet c = (FieldSet)this.Control;

            string width  = " width: {0};".FormatWith(c.Width.ToString());
            string height = " height: {0}px;".FormatWith((c.Height.Value - 39).ToString());

            string buttons = "";

            buttons += (c.CheckboxToggle && !c.Collapsible) ? "<input name=\"ext-comp-1002-checkbox\" type=\"checkbox\">" : "";
            buttons += (c.Collapsible && !c.CheckboxToggle) ? "<div class=\"x-tool x-tool-toggle\">&nbsp;</div>" : "";

            /*
             * 0 - ClientID
             * 1 - Title
             * 2 - Width
             * 3 - Height
             * 4 - Buttons
             * 5 - BodyStyle
             */

            object[] args = new object[6];
            args[0] = c.ClientID;
            args[1] = c.Title;
            args[2] = width;
            args[3] = height;
            args[4] = buttons;
            args[5] = c.BodyStyle;

            LiteralControl topCtrl = new LiteralControl(string.Format(this.HtmlBegin, args));

            topCtrl.RenderControl(htmlWriter);

            HtmlGenericControl div = (HtmlGenericControl)c.ContentContainer;

            div.Attributes[DesignerRegion.DesignerRegionAttributeName] = "0";
            div.InnerHtml = this.GetEditableDesignerRegionContent(region);
            div.RenderControl(htmlWriter);

            LiteralControl bottomCtrl = new LiteralControl(this.HtmlEnd);

            bottomCtrl.RenderControl(htmlWriter);

            return(writer.ToString());
        }
Exemplo n.º 15
0
        public override string GetDesignTimeHtml()
        {
            StringWriter   writer     = new StringWriter(CultureInfo.CurrentCulture);
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);

            DateField c = (DateField)this.Control;

            string width  = (c.Width != Unit.Empty) ? string.Format(" width: {0};", c.Width.ToString()) : string.Empty;
            string height = (c.Height != Unit.Empty) ? string.Format(" height: {0};", c.Height.ToString()) : string.Empty;

            object[] args = new object[9];
            args[0] = c.ClientID;

            if (c.SelectedDate != DateTime.MinValue && c.SelectedDate != DateTime.MaxValue)
            {
                args[1] = c.SelectedDate.ToString(c.Format);
            }
            else
            {
                args[1] = "";
            }

            args[2] = width;
            args[3] = height;
            args[4] = c.StyleSpec;
            args[5] = "x-form-text x-form-field " + ((c.IsNull) ? "x-form-empty-field " : string.Empty) + c.Cls;
            args[6] = "x-form-trigger x-form-date-trigger " + c.TriggerClass;

            ScriptManager sm = c.ScriptManager;

            if (sm != null)
            {
                args[7] = c.ScriptManager.BLANK_IMAGE_URL;
            }
            else
            {
                args[7] = "";
            }
            args[8] = string.Format(" width: {0};", (c.Width != Unit.Empty) ? (c.Width.Value + 20) + "px" : "144px");

            LiteralControl ctrl = new LiteralControl(string.Format(this.Html, args));

            ctrl.RenderControl(htmlWriter);

            return(writer.ToString());
        }
Exemplo n.º 16
0
        public override string GetDesignTimeHtml()
        {
            StringWriter   writer     = new StringWriter(CultureInfo.CurrentCulture);
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);

            HtmlEditor c = (HtmlEditor)this.Control;

            string width  = string.Format(" width: {0};", (c.Width != Unit.Empty) ? c.Width.ToString() : "504px");
            string height = string.Format(" height: {0};", (c.Height != Unit.Empty) ? c.Height.ToString() : "275px");

            /*
             * 0 - ClientID
             * 1 - Text
             * 2 - Width
             * 3 - Height
             * 4 - Font
             * 5 - Format
             * 6 - FontSize
             * 7 - Colors
             * 8 - Alignments
             * 9 - Links
             * 10 - Lists
             * 11- SourceEdit
             */

            object[] args = new object[12];
            args[0]  = c.ClientID;
            args[1]  = c.Text;
            args[2]  = width;
            args[3]  = height;
            args[4]  = (c.EnableFont) ? this.Font : string.Empty;
            args[5]  = (c.EnableFormat) ? this.Format : string.Empty;
            args[6]  = (c.EnableFontSize) ? this.FontSize : string.Empty;
            args[7]  = (c.EnableColors) ? this.Colors : string.Empty;
            args[8]  = (c.EnableAlignments) ? this.Alignments : string.Empty;
            args[9]  = (c.EnableLinks) ? this.Links : string.Empty;
            args[10] = (c.EnableLists) ? this.Lists : string.Empty;
            args[11] = (c.EnableSourceEdit) ? this.SourceEdit : string.Empty;

            LiteralControl ctrl = new LiteralControl(string.Format(this.Html, args));

            ctrl.RenderControl(htmlWriter);

            return(writer.ToString());
        }
Exemplo n.º 17
0
        public override string GetDesignTimeHtml()
        {
            StringWriter writer = new StringWriter(CultureInfo.CurrentCulture);
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);

            Radio c = (Radio)this.Control;

            object[] args = new object[7];
            args[0] = c.ClientID;
            args[1] = c.Checked.ToString().ToLower();
            args[5] = c.StyleSpec;
            args[6] = "x-form-radio x-form-field " + c.Cls;
            
            LiteralControl ctrl = new LiteralControl(string.Format(this.Html, args));
            ctrl.RenderControl(htmlWriter);

            return writer.ToString();
        }
Exemplo n.º 18
0
        public override string XGetDesignTimeHtml()
        {
            StringWriter   writer     = new StringWriter(CultureInfo.CurrentCulture);
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);

            DatePicker c = (DatePicker)this.Control;

            string width  = (c.Width != Unit.Empty) ? " width: {0};".FormatWith(c.Width.ToString()) : "";
            string height = (c.Height != Unit.Empty) ? " height: {0};".FormatWith(c.Height.ToString()) : "";

            object[] args = new object[3];
            args[0] = c.ClientID;
            args[1] = DateTime.Today.ToString("MMMM yyyy");
            args[2] = c.TodayText;

            LiteralControl ctrl = new LiteralControl(string.Format(this.Html, args));

            ctrl.RenderControl(htmlWriter);

            return(writer.ToString());
        }
Exemplo n.º 19
0
        private void cbMyFiles_Callback(object sender, Modules.ActiveForums.Controls.CallBackEventArgs e)
        {
            string attachIds = e.Parameters[1].ToString();

            switch (e.Parameters[0].ToLowerInvariant())
            {
            case "del":
                if (SimulateIsNumeric.IsNumeric(e.Parameters[2]))
                {
                    int aid = Convert.ToInt32(e.Parameters[2]);
                    Data.AttachController ac = new Data.AttachController();
                    int uid = -1;
                    if (SimulateIsNumeric.IsNumeric(e.Parameters[3]))
                    {
                        uid = Convert.ToInt32(e.Parameters[3]);
                    }
                    if ((uid == this.UserId && !(this.UserId == -1)) | Permissions.HasPerm(ForumInfo.Security.ModDelete, ForumUser.UserRoles) || UserInfo.IsSuperUser)
                    {
                        ac.Attach_Delete(aid, -1, uid);
                    }
                }


                break;
            }
            PendingAttach = 0;
            plhMyFiles.Controls.Clear();
            BindMyFiles();
            System.IO.StringWriter stringWriter = new System.IO.StringWriter();
            HtmlTextWriter         htmlWriter   = new HtmlTextWriter(stringWriter);

            plhMyFiles.RenderControl(htmlWriter);
            string html = stringWriter.GetStringBuilder().ToString();

            html = Utilities.LocalizeControl(html);
            LiteralControl lit = new LiteralControl();

            lit.Text = html;
            lit.RenderControl(e.Output);
        }
Exemplo n.º 20
0
        /// <summary>
        /// render control.
        /// </summary>
        /// <param name="writer"></param>
        protected override void Render(HtmlTextWriter writer)
        {
            AddAttributesToRender(writer);

            literalJScript.RenderControl(writer);

            writer.AddAttribute(
                HtmlTextWriterAttribute.Cellpadding,
                "1", false);
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            dateLabel.RenderControl(writer);

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

            dateTextBox.RenderControl(writer);

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

            dateValidator.RenderControl(writer);

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

            //submitButton.RenderControl(writer);

            writer.RenderEndTag();

            writer.RenderEndTag();

            writer.RenderEndTag();
        }
Exemplo n.º 21
0
        public override string XGetDesignTimeHtml()
        {
            StringWriter   writer     = new StringWriter(CultureInfo.CurrentCulture);
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);

            TextArea c = (TextArea)this.Control;

            string width  = (c.Width != Unit.Empty) ? " width: {0};".FormatWith(c.Width.ToString()) : "";
            string height = (c.Height != Unit.Empty) ? " height: {0};".FormatWith(c.Height.ToString()) : "";

            object[] args = new object[7];
            args[0] = c.ClientID;
            args[1] = c.Text.IsEmpty() ? c.EmptyText : c.Text;
            args[2] = width;
            args[3] = height;
            args[4] = c.StyleSpec;
            args[5] = "x-form-textarea x-form-field " + (c.Text.IsEmpty() ? "x-form-empty-field " : "") + c.Cls;

            LiteralControl ctrl = new LiteralControl(string.Format(this.Html, args));

            ctrl.RenderControl(htmlWriter);

            return(writer.ToString());
        }
Exemplo n.º 22
0
        /// <summary>
        /// Render the Custom made CheckboxControl parses the content of
        /// List Items and Render the Items
        /// </summary>
        /// <param name="htmlTextWriter">HtmlTextWriter</param>
        protected void RenderCustomCheckBox(HtmlTextWriter htmlTextWriter)
        {
            htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Class, "UserGenericText");
            using (new HtmlBlock(HtmlTextWriterTag.Table, 1, htmlTextWriter))
            {
                if (!String.IsNullOrEmpty(SlkUtilities.Trim(this.HeaderText)))
                {
                    using (new HtmlBlock(HtmlTextWriterTag.Tr, 1, htmlTextWriter))
                    {
                        htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
                        htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
                        using (new HtmlBlock(HtmlTextWriterTag.Td, 1, htmlTextWriter))
                        {
                            LiteralControl ltrl = new LiteralControl(SlkUtilities.GetHtmlEncodedText(this.HeaderText));
                            ltrl.RenderControl(htmlTextWriter);
                        }
                    }
                }

                //for each item in  the collection of SlkCheckBoxItem objects render
                //Checkbox and Associated label Control.
                foreach (SlkCheckBoxItem item in this.Items)
                {
                    using (new HtmlBlock(HtmlTextWriterTag.Tr, 1, htmlTextWriter))
                    {
                        CheckBox checkBox = ControlToRepeat;
                        htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Width, "1%");
                        htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
                        using (new HtmlBlock(HtmlTextWriterTag.Td, 1, htmlTextWriter))
                        {
                            checkBox.ID      = item.Value;
                            checkBox.ToolTip = item.ToolTip;
                            checkBox.Checked = item.Selected;

                            if (this.HasAttributes)
                            {
                                foreach (string text1 in this.Attributes.Keys)
                                {
                                    checkBox.Attributes[text1] = this.Attributes[text1];
                                }
                            }

                            checkBox.RenderControl(htmlTextWriter);
                        }

                        htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
                        htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
                        htmlTextWriter.AddAttribute(HtmlTextWriterAttribute.Style, "border-top: none; padding-top:2px");
                        using (new HtmlBlock(HtmlTextWriterTag.Td, 1, htmlTextWriter))
                        {
                            Label label = ControlToAssociate;
                            label.ToolTip             = item.ToolTip;
                            label.Text                = item.Text;
                            label.AssociatedControlID = item.Value;
                            label.RenderControl(htmlTextWriter);
                        }
                    }
                }
            }
        }
Exemplo n.º 23
0
        private void Add(HtmlTextWriter w, string html)
        {
            LiteralControl lit = new LiteralControl(html);

            lit.RenderControl(w);
        }
        private void cbSecurityToggle_Callback(object sender, CallBackEventArgs e)
        {
            string action   = e.Parameters[0].ToString();
            int    pId      = PermissionsId;
            string secId    = e.Parameters[2].ToString();
            int    secType  = Convert.ToInt32(e.Parameters[3].ToString());
            string key      = e.Parameters[4].ToString();
            string returnId = e.Parameters[5].ToString();

            Data.Common db   = new Data.Common();
            string      sOut = string.Empty;

            if (action == "delete")
            {
                Permissions.RemoveObjectFromAll(secId, secType, pId);
            }
            else if (action == "addobject")
            {
                if (secType == 1)
                {
                    UserController uc = new UserController();
                    User           ui = uc.GetUser(PortalId, ModuleId, secId);
                    if (ui != null)
                    {
                        secId = ui.UserId.ToString();
                    }
                    else
                    {
                        secId = string.Empty;
                    }
                }
                else
                {
                    if (secId.Contains(":"))
                    {
                        secType = 2;
                    }
                }
                if (!(string.IsNullOrEmpty(secId)))
                {
                    string permSet = db.GetPermSet(pId, "View");
                    permSet = Permissions.AddPermToSet(secId, secType, permSet);
                    db.SavePermSet(pId, "View", permSet);
                }
            }
            else
            {
                string permSet = db.GetPermSet(pId, key);
                if (action == "remove")
                {
                    permSet = Permissions.RemovePermFromSet(secId, secType, permSet);
                }
                else
                {
                    permSet = Permissions.AddPermToSet(secId, secType, permSet);
                }
                db.SavePermSet(pId, key, permSet);
                sOut = action + "|" + returnId;
            }
            LiteralControl lit = new LiteralControl(sOut);

            lit.RenderControl(e.Output);
        }
Exemplo n.º 25
0
        protected virtual void RenderEmptyZoneText(HtmlTextWriter writer)
        {
            var emptyText = new LiteralControl(EmptyZoneText);

            emptyText.RenderControl(writer);
        }
Exemplo n.º 26
0
        void MyRender(HtmlTextWriter writer, string s)
        {
            LiteralControl l = new LiteralControl(s);

            l.RenderControl(writer);
        }
Exemplo n.º 27
0
        public override string XGetDesignTimeHtml(DesignerRegionCollection regions)
        {
            Window c = (Window)this.Control;

            designerRegions = regions;

            EditableDesignerRegion region = new EditableDesignerRegion(this, "Body", false);

            regions.Add(region);

            StringWriter   writer     = new StringWriter(CultureInfo.CurrentCulture);
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);

            string width  = " width: {0};".FormatWith(c.Width.ToString());
            string height = " height: {0}px;".FormatWith((c.Height.Value - 30).ToString());

            string buttons = "";

            buttons += (c.Closable) ? "<div class=\"x-tool x-tool-close\">&nbsp;</div>" : "";
            buttons += (c.Maximizable) ? "<div class=\"x-tool x-tool-maximize\">&nbsp;</div>" : "";
            buttons += (c.Minimizable) ? "<div class=\"x-tool x-tool-minimize\">&nbsp;</div>" : "";
            buttons += (c.Collapsible) ? "<a {0}><div class=\"x-tool x-tool-toggle\">&nbsp;</div></a>" : "";


            if (c.Collapsible)
            {
                buttons = string.Format(buttons, GetDesignerRegionAttribute(WindowClickAction.Toggle));
            }
            else
            {
                // for prevent shifting regions
                designerRegions.Add(new DesignerRegion(this.CurrentDesigner, "Empty", false));
            }

            /*
             * 0 - ClientID
             * 1 - Title
             * 2 - Width
             * 3 - Height
             * 4 - Buttons
             * 5 - BodyStyle
             */

            object[] args = new object[9];
            args[0] = c.ClientID;
            args[1] = c.Title.IsEmpty() ? "&nbsp;" : c.Title;
            args[2] = width;
            args[3] = height;
            args[4] = buttons;
            args[5] = c.BodyStyle;
            args[6] = c.IconClsProxy.IsNotEmpty() ? "x-panel-icon " + c.IconClsProxy : "";
            args[7] = c.Collapsed && c.Collapsible ? "x-panel-collapsed" : "";
            args[8] = (c.Collapsed && c.Collapsible) ? "display: none;" : "display: block;";

            // NOTE: Make sure you add to the object[SIZE] above if adding to the args array.

            this.AddIcon(c.Icon);

            LiteralControl topCtrl = new LiteralControl(string.Format(this.HtmlBegin, args) + this.GetIconStyleBlock());

            topCtrl.RenderControl(htmlWriter);

            if (!(c.Collapsed && c.Collapsible))
            {
                HtmlGenericControl div = (HtmlGenericControl)c.ContentContainer;
                div.Attributes[DesignerRegion.DesignerRegionAttributeName] = "0";
                div.Style["height"] = "100%";
                div.RenderControl(htmlWriter);
            }


            LiteralControl bottomCtrl = new LiteralControl(string.Format(this.HtmlEnd, args[8]));

            bottomCtrl.RenderControl(htmlWriter);

            string temp = writer.ToString();

            return(temp);
        }
Exemplo n.º 28
0
        public static String GetFASRowHTML(this DataRow dr, Boolean IsPreferred = false)
        {
            StringWriter sw = new StringWriter();

            using (HtmlTextWriter htw = new HtmlTextWriter(sw))
            {
                htw.AddAttribute(HtmlTextWriterAttribute.Class, "resultrow graydiv");
                htw.RenderBeginTag(HtmlTextWriterTag.Tr); //Table Row definition

                htw.AddAttribute(HtmlTextWriterAttribute.Class, "tdfirst graydiv PRAC");
                htw.AddStyleAttribute(HtmlTextWriterStyle.Width, "323px");
                htw.RenderBeginTag(HtmlTextWriterTag.Td); //Facility Name TD
                htw.AddStyleAttribute(HtmlTextWriterStyle.Cursor, "pointer");
                //htw.AddAttribute("nav",this.Nav);

                htw.RenderBeginTag(HtmlTextWriterTag.A);   //Link Facility Link button
                htw.AddAttribute(HtmlTextWriterAttribute.Class, "readmore result");
                htw.RenderBeginTag(HtmlTextWriterTag.Div); // Facility link DIV
                htw.Write(dr.Field <dynamic>("PracticeName"));
                htw.RenderEndTag();                        // End Facility link DIV
                htw.RenderEndTag();                        //End Facility Name Link
                htw.AddStyleAttribute(HtmlTextWriterStyle.MarginLeft, "19px");
                htw.RenderBeginTag(HtmlTextWriterTag.Div); //City Div
                htw.Write(dr.Field <dynamic>("LocationCity"));
                htw.RenderEndTag();                        //End City Div
                htw.RenderEndTag();                        // End Facility Name TD

                htw.AddAttribute(HtmlTextWriterAttribute.Class, "graydiv DIST");
                htw.AddStyleAttribute(HtmlTextWriterStyle.Width, "97px");
                htw.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
                htw.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
                htw.RenderBeginTag(HtmlTextWriterTag.Td);   //Distance TD
                htw.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "center");
                htw.RenderBeginTag(HtmlTextWriterTag.Div);  // Distance DIV
                htw.RenderBeginTag(HtmlTextWriterTag.Span); //Distance SPAN
                htw.RenderEndTag();                         // End Distance SPAN
                htw.RenderEndTag();                         // End Distance DIV
                htw.RenderEndTag();                         // End Distance TD

                htw.AddAttribute(HtmlTextWriterAttribute.Class, "graydiv EC");
                htw.AddStyleAttribute(HtmlTextWriterStyle.Width, "162px");
                htw.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
                htw.RenderBeginTag(HtmlTextWriterTag.Td);  // Total Estimated Cost TD
                htw.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "center");
                htw.RenderBeginTag(HtmlTextWriterTag.Div); // Total Estimated Cost DIV
                if (dr.Field <dynamic>("AntiTransparency"))
                {
                    using (LiteralControl lc = new LiteralControl("<b>Undisclosed</b>&nbsp;"))
                        lc.RenderControl(htw);

                    using (Panel learnMore = new Panel())
                    {
                        learnMore.CssClass = "learnmore";
                        learnMore.RenderBeginTag(htw);

                        htw.AddAttribute(HtmlTextWriterAttribute.Title, "Learn More");
                        htw.RenderBeginTag(HtmlTextWriterTag.A); //Render learnmore Title A

                        using (Image i = new Image())
                        {
                            i.AlternateText = "Learn More";
                            i.Width         = new Unit(12, UnitType.Pixel);
                            i.Height        = new Unit(13, UnitType.Pixel);
                            i.BorderWidth   = new Unit(0, UnitType.Pixel);
                            //i.Style[HtmlTextWriterStyle.Width] = "13px";
                            //i.Style[HtmlTextWriterStyle.Height] = "13px";
                            //i.Style[HtmlTextWriterStyle.ZIndex] = "1030";
                            i.ImageUrl = "~/Images/icon_question_mark.png";
                            i.RenderControl(htw); //Render Learnmore Question Mark Image
                        }

                        htw.RenderEndTag(); //Close Title A

                        using (Panel moreInfo = new Panel())
                        {
                            moreInfo.CssClass = "moreinfo";
                            moreInfo.Style[HtmlTextWriterStyle.ZIndex] = "1031";
                            moreInfo.RenderBeginTag(htw);

                            using (Image i = new Image())
                            {
                                i.AlternateText = "Close";
                                i.Width         = new Unit(14, UnitType.Pixel);
                                i.Height        = new Unit(14, UnitType.Pixel);
                                i.BorderWidth   = new Unit(0, UnitType.Pixel);
                                i.ImageAlign    = ImageAlign.Right;
                                i.Style[HtmlTextWriterStyle.Cursor] = "pointer";
                                //i.Style[HtmlTextWriterStyle.Width] = "14px";
                                //i.Style[HtmlTextWriterStyle.Height] = "14px";
                                i.ImageUrl = "~/Images/icon_x_sm.png";
                                i.RenderControl(htw); //Render MoreInfo close image
                            }

                            htw.RenderBeginTag(HtmlTextWriterTag.P);                                                                                                                                          //Render MoreInfo Title Paragraph
                            htw.AddAttribute(HtmlTextWriterAttribute.Class, "upper");
                            htw.RenderBeginTag(HtmlTextWriterTag.B);                                                                                                                                          //Render MoreInfo Title Bold
                            htw.Write("Anti-Transparency Providers");                                                                                                                                         //Add MoreInfo Title text
                            htw.RenderEndTag();                                                                                                                                                               //Close MoreInfo Title Bold
                            htw.RenderEndTag();                                                                                                                                                               //Close MoreInfo Title Paragraph
                            htw.RenderBeginTag(HtmlTextWriterTag.P);                                                                                                                                          //Render MoreInfo Text Paragraph
                            htw.Write("This provider has chosen not to show prices to patients.  Please note that in some instances, refusal to show this information can be an indication of high prices."); //Write Text
                            htw.RenderEndTag();                                                                                                                                                               //Close MoreInfo Text Paragraph

                            moreInfo.RenderEndTag(htw);
                        }

                        learnMore.RenderEndTag(htw);
                    }
                }
                else
                {
                    htw.AddAttribute(HtmlTextWriterAttribute.Class, "alignright");
                    htw.RenderBeginTag(HtmlTextWriterTag.B); //Range Min B
                    htw.Write(String.Format("{0:c0}", dr.Field <dynamic>("RangeMin")));
                    htw.RenderEndTag();                      // End RangeMin B
                    //  ------------------------------------------------------------------
                    //  lam, 20130402, MSF-293
                    if (dr.Field <dynamic>("RangeMin") != dr.Field <dynamic>("RangeMax"))
                    {
                        //  ------------------------------------------------------------------
                        htw.AddAttribute(HtmlTextWriterAttribute.Class, "dashcol");
                        htw.RenderBeginTag(HtmlTextWriterTag.B); //DashCol B
                        htw.Write("-");
                        htw.RenderEndTag();                      // End DashCol B
                        htw.AddAttribute(HtmlTextWriterAttribute.Class, "alignleft");
                        htw.RenderBeginTag(HtmlTextWriterTag.B); //Range Max B
                        htw.Write(String.Format("{0:c0}", dr.Field <dynamic>("RangeMax")));
                        htw.RenderEndTag();                      // End RangeMax B
                    }
                }
                htw.RenderEndTag(); // End RangeMax DIV
                htw.RenderEndTag(); // End RangeMax TD

                htw.AddAttribute(HtmlTextWriterAttribute.Class, "graydiv YC");
                htw.AddStyleAttribute(HtmlTextWriterStyle.Width, "0px");
                htw.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
                htw.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
                htw.RenderBeginTag(HtmlTextWriterTag.Td);  // Your Estimated Cost TD
                htw.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "center");
                htw.RenderBeginTag(HtmlTextWriterTag.Div); // Your Estimated Cost DIV
                if (dr.Field <dynamic>("AntiTransparency"))
                {
                    using (LiteralControl lc = new LiteralControl("<b>Undisclosed</b>&nbsp;"))
                        lc.RenderControl(htw);

                    using (Panel learnMore = new Panel())
                    {
                        learnMore.CssClass = "learnmore";
                        learnMore.RenderBeginTag(htw);

                        htw.AddAttribute(HtmlTextWriterAttribute.Title, "Learn More");
                        htw.RenderBeginTag(HtmlTextWriterTag.A); //Render learnmore Title A

                        using (Image i = new Image())
                        {
                            i.AlternateText = "Learn More";
                            i.Width         = new Unit(12, UnitType.Pixel);
                            i.Height        = new Unit(13, UnitType.Pixel);
                            i.BorderWidth   = new Unit(0, UnitType.Pixel);
                            //i.Style[HtmlTextWriterStyle.Width] = "13px";
                            //i.Style[HtmlTextWriterStyle.Height] = "13px";
                            //i.Style[HtmlTextWriterStyle.ZIndex] = "1030";
                            i.ImageUrl = "~/Images/icon_question_mark.png";
                            i.RenderControl(htw); //Render Learnmore Question Mark Image
                        }

                        htw.RenderEndTag(); //Close Title A

                        using (Panel moreInfo = new Panel())
                        {
                            moreInfo.CssClass = "moreinfo";
                            moreInfo.Style[HtmlTextWriterStyle.ZIndex] = "1031";
                            moreInfo.RenderBeginTag(htw);

                            using (Image i = new Image())
                            {
                                i.AlternateText = "Close";
                                i.Width         = new Unit(14, UnitType.Pixel);
                                i.Height        = new Unit(14, UnitType.Pixel);
                                i.BorderWidth   = new Unit(0, UnitType.Pixel);
                                i.ImageAlign    = ImageAlign.Right;
                                i.Style[HtmlTextWriterStyle.Cursor] = "pointer";
                                //i.Style[HtmlTextWriterStyle.Width] = "14px";
                                //i.Style[HtmlTextWriterStyle.Height] = "14px";
                                i.ImageUrl = "~/Images/icon_x_sm.png";
                                i.RenderControl(htw); //Render MoreInfo close image
                            }

                            htw.RenderBeginTag(HtmlTextWriterTag.P);                                                                                                                                          //Render MoreInfo Title Paragraph
                            htw.AddAttribute(HtmlTextWriterAttribute.Class, "upper");
                            htw.RenderBeginTag(HtmlTextWriterTag.B);                                                                                                                                          //Render MoreInfo Title Bold
                            htw.Write("Anti-Transparency Providers");                                                                                                                                         //Add MoreInfo Title text
                            htw.RenderEndTag();                                                                                                                                                               //Close MoreInfo Title Bold
                            htw.RenderEndTag();                                                                                                                                                               //Close MoreInfo Title Paragraph
                            htw.RenderBeginTag(HtmlTextWriterTag.P);                                                                                                                                          //Render MoreInfo Text Paragraph
                            htw.Write("This provider has chosen not to show prices to patients.  Please note that in some instances, refusal to show this information can be an indication of high prices."); //Write Text
                            htw.RenderEndTag();                                                                                                                                                               //Close MoreInfo Text Paragraph

                            moreInfo.RenderEndTag(htw);
                        }

                        learnMore.RenderEndTag(htw);
                    }
                }
                else
                {
                    htw.AddAttribute(HtmlTextWriterAttribute.Class, "alignright");
                    htw.RenderBeginTag(HtmlTextWriterTag.B); //Range Min B
                    htw.Write(String.Format("{0:c0}", dr.Field <dynamic>("YourCostMin")));
                    htw.RenderEndTag();                      // End RangeMin B
                    //  ------------------------------------------------------------------
                    //  lam, 20130402, MSF-293
                    if (dr.Field <dynamic>("YourCostMin") != dr.Field <dynamic>("YourCostMax"))
                    {
                        //  ------------------------------------------------------------------
                        htw.AddAttribute(HtmlTextWriterAttribute.Class, "dashcol");
                        htw.RenderBeginTag(HtmlTextWriterTag.B); //DashCol B
                        htw.Write("-");
                        htw.RenderEndTag();                      // End DashCol B
                        htw.AddAttribute(HtmlTextWriterAttribute.Class, "alignleft");
                        htw.RenderBeginTag(HtmlTextWriterTag.B); //Range Max B
                        htw.Write(String.Format("{0:c0}", dr.Field <dynamic>("YourCostMax")));
                        htw.RenderEndTag();                      // End RangeMax B
                    }
                }
                htw.RenderEndTag(); // End RangeMax DIV
                htw.RenderEndTag(); // End RangeMax TD

                htw.AddAttribute(HtmlTextWriterAttribute.Class, "tdcheck graydiv FP");
                htw.AddStyleAttribute(HtmlTextWriterStyle.Width, "88px");
                htw.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
                htw.AddAttribute(HtmlTextWriterAttribute.Align, "center");
                htw.RenderBeginTag(HtmlTextWriterTag.Td); // Fair Price TD
                htw.AddStyleAttribute(HtmlTextWriterStyle.Width, "23px");
                htw.AddStyleAttribute(HtmlTextWriterStyle.Height, "23px");
                htw.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "0px");
                htw.AddAttribute(HtmlTextWriterAttribute.Alt, "FairPrice?");
                if (dr.GetData <bool>("FairPrice"))  //(dr.Field<dynamic>("FairPrice"))  lam, 20130308, MSF-278, 279
                {
                    htw.AddAttribute(HtmlTextWriterAttribute.Src, "../Images/check_green.png");
                }
                else
                {
                    htw.AddAttribute(HtmlTextWriterAttribute.Src, "../Images/s.gif");
                }
                htw.RenderBeginTag(HtmlTextWriterTag.Img); //Fair Price Images
                htw.RenderEndTag();                        // End Fair Price TD

                htw.AddAttribute(HtmlTextWriterAttribute.Class, "tdcheck graydiv HG");
                htw.AddStyleAttribute(HtmlTextWriterStyle.Width, "137px");
                htw.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "middle");
                htw.AddAttribute(HtmlTextWriterAttribute.Align, "center");
                htw.RenderBeginTag(HtmlTextWriterTag.Td); // HGRecognized TD
                if (dr.Field <dynamic>("HGDocCount") == 0)
                {
                    htw.Write("N/A");
                }
                else
                if (IsPreferred && dr.Field <dynamic>("HGRecognizedDocCount") == 0)
                {
                    htw.Write("N/A");
                }
                else
                {
                    htw.Write(String.Format("{0}/{1} physicians",
                                            dr.Field <dynamic>("HGRecognizedDocCount"),
                                            dr.Field <dynamic>("HGDocCount")));
                }

                htw.RenderEndTag(); // End HGRecognized TD

                htw.RenderEndTag(); //End Table Row
            }
            return(sw.ToString()
                   .Replace("\r", String.Empty)
                   .Replace("\n", String.Empty)
                   .Replace("\t", String.Empty));
        }
Exemplo n.º 29
0
        public override string GetDesignTimeHtml(DesignerRegionCollection regions)
        {
            designerRegions = regions;
            Panel c = (Panel)this.Control;

            StringWriter   writer     = new StringWriter(CultureInfo.CurrentCulture);
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);

            string width  = string.Format(" width: {0};", (c.Width == Unit.Empty) ? "auto" : c.Width.ToString());
            string height = string.Format(" height: {0};", (c.Height == Unit.Empty) ? "auto" : (c.Height.Value - 27).ToString() + "px");

            string buttons = string.Empty;

            buttons += (c.Collapsible) ? "<a {0}><div class=\"x-tool x-tool-toggle\">&nbsp;</div></a>" : string.Empty;

            if (this.Layout.HasValue && this.Layout.Value != LayoutType.Border || !this.Layout.HasValue)
            {
                if (!string.IsNullOrEmpty(buttons))
                {
                    buttons = string.Format(buttons, GetDesignerRegionAttribute(PanelClickAction.Toggle));
                }
                else
                {
                    // for prevent shifting regions
                    designerRegions.Add(new DesignerRegion(CurrentDesigner, "Empty", false));
                }
            }

            if (this.Layout.HasValue)
            {
                if (!Width.IsEmpty)
                {
                    width = string.Format(" width: {0};", (Width == Unit.Empty) ? "auto" : Width.ToString());
                }

                if (!Height.IsEmpty)
                {
                    if (Height.Type == UnitType.Pixel)
                    {
                        height = string.Format(" height: {0}px;", Height.Value - 27);
                    }
                    else
                    {
                        height = string.Format(" height: {0};", Height);
                    }
                }

                if (this.Layout.Value == LayoutType.Border)
                {
                    if (BorderRegion.Collapsible && BorderRegion.Region != RegionPosition.Center)
                    {
                        buttons = string.Format("<a {1}><div class=\"x-tool x-tool-toggle x-tool-collapse-{0}\">&nbsp;</div></a>", BorderRegion.Region.ToString().ToLower(), GetDesignerRegionAttribute(BorderRegion.Region, BorderLayoutDesigner.BorderLayoutClickAction.Collapse));
                    }
                    else
                    {
                        // for prevent shifting regions
                        designerRegions.Add(new DesignerRegion(CurrentDesigner, "Empty", false));
                        buttons = string.Empty;
                    }
                }
            }

            string iconCls = string.Empty;

            this.AddIcon(c.Icon);

            if (!string.IsNullOrEmpty(c.IconCls))
            {
                if (c.Frame)
                {
                    iconCls = "x-panel-icon " + c.IconCls;
                }
                else
                {
                    iconCls = string.Format("<img src=\"{0}\" class=\"x-panel-inline-icon {1}\" />", c.ScriptManager.BLANK_IMAGE_URL, c.IconCls);
                }
            }

            string header = "";

            if (c.Header)
            {
                /*
                 * 0  - x-panel-header-noborder
                 * 1  - IconCls
                 * 2  - Title
                 * 3  - Buttons
                 */

                object[] headerArgs = new object[4];
                headerArgs[0] = !c.Border ? "x-panel-header-noborder" : string.Empty;
                headerArgs[1] = iconCls;
                headerArgs[2] = c.Title;
                headerArgs[3] = buttons;

                header = string.Format(this.HtmlHeader, headerArgs);
            }

            /*
             * 0  - Width
             * 1  - x-panel-noborder
             * 2  - Collapsed style
             * 3  - Collapsed  display: block;
             * 4  - BodyStyle
             * 5  - Height
             * 6  - x-panel-body-noborder
             * 7  - HEADER
             */

            object[] args = new object[8];
            args[0] = width;
            args[1] = !c.Border ? "x-panel-noborder" : string.Empty;
            args[2] = c.Collapsed && c.Collapsible ? "x-panel-collapsed" : string.Empty;
            args[3] = (c.Collapsed) ? "display: none;" : "display: block;";
            args[4] = c.BodyStyle;
            args[5] = height;
            args[6] = !c.Border ? "x-panel-body-noborder" : string.Empty;
            args[7] = header;

            LiteralControl topCtrl = new LiteralControl(string.Format(this.HtmlBegin, args) + this.GetIconStyleBlock());

            topCtrl.RenderControl(htmlWriter);

            HtmlGenericControl     div    = (HtmlGenericControl)c.BodyContainer;
            EditableDesignerRegion region = new EditableDesignerRegion(CurrentDesigner, ContentRegionName, false);

            designerRegions.Add(region);
            if ((!c.Collapsible) || (c.Collapsible && !c.Collapsed) || (this.Layout.HasValue && this.Layout.Value == LayoutType.Border))
            {
                div.Attributes[DesignerRegion.DesignerRegionAttributeName] = (designerRegions.Count - 1).ToString();
                div.Style["height"]   = "100%";
                div.Style["overflow"] = "hidden";
                div.RenderControl(htmlWriter);
            }

            LiteralControl bottomCtrl = new LiteralControl(this.HtmlEnd);

            bottomCtrl.RenderControl(htmlWriter);

            return(writer.ToString());
        }
Exemplo n.º 30
0
        private void cbAttach_Callback(object sender, Modules.ActiveForums.Controls.CallBackEventArgs e)
        {
            string attachIds = e.Parameters[1].ToString();

            switch (e.Parameters[0].ToLowerInvariant())
            {
            case "delcont":
            {
                if (SimulateIsNumeric.IsNumeric(e.Parameters[2]))
                {
                    int aid = Convert.ToInt32(e.Parameters[2]);
                    int uid = -1;
                    if (SimulateIsNumeric.IsNumeric(e.Parameters[3]))
                    {
                        uid = Convert.ToInt32(e.Parameters[3]);
                    }
                    if ((uid == this.UserId && !(this.UserId == -1)) | Permissions.HasPerm(ForumInfo.Security.ModDelete, ForumUser.UserRoles) || UserInfo.IsSuperUser)
                    {
                        Data.AttachController adb = new Data.AttachController();
                        adb.Attach_Delete(aid, ContentId);
                        //ac.Attach_Delete(aid, -1, uid)
                    }
                }
                break;
            }

            case "thumb":
            {
                if (SimulateIsNumeric.IsNumeric(e.Parameters[2]))
                {
                    int aid = Convert.ToInt32(e.Parameters[2]);
                    Data.AttachController ac = new Data.AttachController();
                    int uid = -1;
                    if (SimulateIsNumeric.IsNumeric(e.Parameters[3]))
                    {
                        uid = Convert.ToInt32(e.Parameters[3]);
                    }
                    AttachInfo ai = ac.Attach_Get(aid, -1, uid, false);
                    if (ai != null)
                    {
                        int w = Convert.ToInt32(e.Parameters[4]);
                        int h = Convert.ToInt32(e.Parameters[5]);
                        System.IO.MemoryStream imgStream = new System.IO.MemoryStream();
                        string fpath       = string.Empty;
                        int    fileSize    = 0;
                        string tmpFilename = string.Empty;
                        if (ai.FileData != null)
                        {
                            byte[] bindata = null;
                            bindata = (byte[])ai.FileData;
                            System.IO.MemoryStream memStream = new System.IO.MemoryStream(bindata);
                            imgStream   = (System.IO.MemoryStream)(Images.CreateImageForDB(memStream, h, w));
                            fileSize    = Convert.ToInt32(imgStream.Length);
                            tmpFilename = "thumb_" + ai.Filename;
                        }
                        else
                        {
                            fpath = Server.MapPath(PortalSettings.HomeDirectory + "activeforums_Attach/");
                            //fpath &= "thumb_" & ai.Filename
                            tmpFilename = "thumb_" + ai.Filename;
                            string sFullFile = fpath + tmpFilename;
                            int    i         = 0;

                            while (File.Exists(sFullFile))
                            {
                                i          += 1;
                                tmpFilename = i.ToString().PadLeft(3, '0') + "_thumb_" + ai.Filename;
                                sFullFile   = fpath + tmpFilename;
                            }
                            File.Copy(fpath + ai.Filename, sFullFile);
                            Images.CreateImage(sFullFile, h, w);
                            fileSize = (int)new FileInfo(sFullFile).Length;
                        }
                        AttachInfo aiThumb = new AttachInfo();
                        aiThumb.ContentId   = -1;
                        aiThumb.UserID      = ai.UserID;
                        aiThumb.Filename    = tmpFilename;
                        aiThumb.ContentType = "image/x-png";
                        aiThumb.FileSize    = fileSize;
                        if (ForumInfo.AttachStore == AttachStores.DATABASE)
                        {
                            aiThumb.FileData = imgStream.ToArray();
                            //File.Delete(fpath & "thumb_" & ai.Filename)
                        }
                        aiThumb.ParentAttachId = aid;
                        int thumbId = ac.Attach_Save(aiThumb);
                        attachIds += thumbId.ToString() + ";";
                        BindMyFiles();
                        if (Convert.ToBoolean(e.Parameters[4]))
                        {
                            string strHost = DotNetNuke.Common.Globals.AddHTTP(DotNetNuke.Common.Globals.GetDomainName(Request)) + "/";
                            string s       = "<script type=\"text/javascript\">";
                            string sInsert = string.Empty;
                            if (ForumInfo.AllowHTML && ForumInfo.EditorType != EditorTypes.TEXTBOX)
                            {
                                sInsert = "<a href=\"" + strHost + "DesktopModules/ActiveForums/viewer.aspx?portalid=" + PortalId + "&moduleid=" + ModuleId + "&attachid=" + aid + "\" target=\"_blank\"><img src=" + strHost + "DesktopModules/ActiveForums/viewer.aspx?portalid=" + PortalId + "&moduleid=" + ModuleId + "&attachid=" + thumbId + " border=0 /></a>";
                            }
                            else
                            {
                                sInsert = "[THUMBNAIL:" + thumbId.ToString() + ":" + aid + "]";
                            }

                            s += "amaf_insertHTML('" + sInsert + "');";
                            s += "</script>";
                            LiteralControl litScript = new LiteralControl();
                            litScript.Text = s;
                            plhAttach.Controls.Add(litScript);
                        }
                    }
                }
                break;
            }

            case "inline":
            {
                if (SimulateIsNumeric.IsNumeric(e.Parameters[2]))
                {
                    int aid = Convert.ToInt32(e.Parameters[2]);
                    Data.AttachController ac = new Data.AttachController();
                    int uid = -1;
                    if (SimulateIsNumeric.IsNumeric(e.Parameters[3]))
                    {
                        uid = Convert.ToInt32(e.Parameters[3]);
                    }
                    AttachInfo ai = ac.Attach_Get(aid, -1, uid, false);
                    if (ai != null)
                    {
                        int opt = Convert.ToInt32(e.Parameters[4]);
                        if (opt == 0)
                        {
                            ai.DisplayInline = true;
                            ai.AllowDownload = false;
                        }
                        else
                        {
                            if (ai.AllowDownload)
                            {
                                ai.DisplayInline = true;
                                ai.AllowDownload = false;
                            }
                            else
                            {
                                ai.DisplayInline = false;
                                ai.AllowDownload = true;
                            }
                        }


                        ac.Attach_Save(ai);
                    }
                }
                break;
            }
            }

            BindAttach(attachIds);
            System.IO.StringWriter stringWriter = new System.IO.StringWriter();
            HtmlTextWriter         htmlWriter   = new HtmlTextWriter(stringWriter);

            plhAttach.RenderControl(htmlWriter);
            string html = stringWriter.GetStringBuilder().ToString();

            html = Utilities.LocalizeControl(html);
            LiteralControl lit = new LiteralControl();

            lit.Text = html;
            lit.RenderControl(e.Output);
        }