Exemplo n.º 1
0
            private string ObjectMatchHandler(Match m)
            {
                string OBJECT_PROC              = Util.GetLocalizedString("ProcessObject");
                string OBJECT_SKIN              = Util.GetLocalizedString("SkinObject");
                string OBJECT_PANE              = Util.GetLocalizedString("PaneObject");
                string OBJECT_FOUND             = Util.GetLocalizedString("ObjectFound");
                string CONTROL_FORMAT           = Util.GetLocalizedString("ControlFormat");
                string OBJECT_NOTFOUND          = Util.GetLocalizedString("ObjectNotFound");
                string EmbeddedObjectAttributes = m.Groups["token"].Value.Substring(0, m.Groups["token"].Value.IndexOf(">"));

                string[] Attributes    = EmbeddedObjectAttributes.Split(' ');
                string   AttributeNode = "";
                string   Token         = "";
                string   ControlName   = "";

                string[] Attribute;
                string   AttributeName;
                string   AttributeValue;

                foreach (string strAttribute in Attributes)
                {
                    if (strAttribute != string.Empty)
                    {
                        Attribute      = strAttribute.Split('=');
                        AttributeName  = Attribute[0].Trim();
                        AttributeValue = Attribute[1].Trim().Replace("\"", "");
                        switch (AttributeName.ToLower())
                        {
                        case "id":
                            ControlName = AttributeValue;
                            break;

                        case "codetype":
                            AttributeNode = AttributeValue;
                            break;

                        case "codebase":
                            Token = AttributeValue.ToUpper();
                            break;
                        }
                    }
                }
                if (AttributeNode.ToLower() == "dotnetnuke/server")
                {
                    this.Messages += SkinController.FormatMessage(OBJECT_PROC, Token, 2, false);
                    if (this.ControlList.ContainsKey(Token) == true || Token == "CONTENTPANE")
                    {
                        string SkinControl = "";
                        if (this.ControlList.ContainsKey(Token))
                        {
                            this.Messages += SkinController.FormatMessage(OBJECT_SKIN, (string)this.ControlList[Token], 2, false);
                        }
                        else
                        {
                            this.Messages += SkinController.FormatMessage(OBJECT_PANE, Token, 2, false);
                        }
                        string Parameters = m.Groups["token"].Value.Substring(m.Groups["token"].Value.IndexOf(">") + 1);
                        Parameters = Parameters.Replace("<param name=\"", "");
                        Parameters = Parameters.Replace("\" value", "");
                        Parameters = Parameters.Replace("/>", "");
                        Parameters = Regex.Replace(Parameters, "\\s+", " ");
                        if (this.ControlList.ContainsKey(Token))
                        {
                            SkinControl = "dnn:" + Token + " runat=\"server\" ";
                            if (!String.IsNullOrEmpty(ControlName))
                            {
                                SkinControl += "id=\"" + ControlName + "\" ";
                            }
                            SkinControl += Parameters;
                            string ControlRegistration = "<%@ Register TagPrefix=\"dnn\" TagName=\"" + Token + "\" Src=\"~/" + (string)this.ControlList[Token] + "\" %>" + Environment.NewLine;
                            if (RegisterList.Contains(ControlRegistration) == false)
                            {
                                RegisterList.Add(ControlRegistration);
                            }
                            this.Messages += SkinController.FormatMessage(CONTROL_FORMAT, "&lt;" + SkinControl + " /&gt;", 2, false);
                            SkinControl    = "<" + SkinControl + "/>";
                        }
                        else
                        {
                            SkinControl = "div runat=\"server\" ";
                            if (!String.IsNullOrEmpty(ControlName))
                            {
                                SkinControl += "id=\"" + ControlName + "\" ";
                            }
                            else
                            {
                                SkinControl += "id=\"ContentPane\" ";
                            }
                            SkinControl   += Parameters + "></div";
                            this.Messages += SkinController.FormatMessage(CONTROL_FORMAT, "&lt;" + SkinControl + "&gt;", 2, false);
                            SkinControl    = "<" + SkinControl + ">";
                        }
                        return(SkinControl);
                    }
                    else
                    {
                        this.Messages += SkinController.FormatMessage(OBJECT_NOTFOUND, Token, 2, false);
                        return("<object" + m.Groups["token"].Value + "</object>");
                    }
                }
                else
                {
                    return("<object" + m.Groups["token"].Value + "</object>");
                }
            }