예제 #1
0
        public InjectionInfoCollection GetActiveInjectionContents(int moduleId)
        {
            var collInj = new InjectionInfoCollection();

            collInj.Fill(DataProvider.Instance().GetActiveInjectionContents(moduleId));
            return(collInj);
        }
예제 #2
0
        public InjectionInfoCollection GetInjectionContents(int ModuleId)
        {
            InjectionInfoCollection collInj = new InjectionInfoCollection();

            collInj.Fill(DataProvider.Instance().GetInjectionContents(ModuleId));
            return(collInj);
        }
예제 #3
0
        public string ExportModule(int ModuleID)
        {
            StringBuilder           sb      = new StringBuilder(150);
            InjectionInfoCollection collInj = new InjectionInfoCollection();

            collInj = GetInjectionContents(ModuleID);

            sb.Append("<WillStrohl><injectionContents>");
            foreach (InjectionInfo obj in collInj)
            {
                sb.Append("<injectionContent>");
                sb.AppendFormat("<injectionId>{0}</injectionId>", XmlUtils.XMLEncode(obj.InjectionId.ToString()));
                sb.AppendFormat("<moduleId>{0}</moduleId>", XmlUtils.XMLEncode(obj.ModuleId.ToString()));
                sb.AppendFormat("<injectTop>{0}</injectTop>", XmlUtils.XMLEncode(obj.InjectTop.ToString()));
                sb.AppendFormat("<injectName>{0}</injectName>", XmlUtils.XMLEncode(obj.InjectName));
                sb.AppendFormat("<injectContent>{0}</injectContent>", XmlUtils.XMLEncode(obj.InjectContent));
                sb.AppendFormat("<isEnabled>{0}</isEnabled>", XmlUtils.XMLEncode(obj.IsEnabled.ToString()));
                sb.AppendFormat("<orderShown>{0}</orderShown>", XmlUtils.XMLEncode(obj.OrderShown.ToString()));
                sb.AppendFormat("<customProperties>{0}</customProperties>", XmlUtils.XMLEncode(obj.CustomProperties.ToJson()));
                sb.Append("</injectionContent>");
            }
            sb.Append("</injectionContents>");
            // later on, will probably need to add module settings here
            sb.Append("</WillStrohl>");

            return(sb.ToString());
        }
예제 #4
0
        private void ExecutePageInjection()
        {
            var ctlModule = new InjectionController();
            var collInj   = new InjectionInfoCollection();

            collInj = ctlModule.GetActiveInjectionContents(ModuleId);

            if (collInj.Count <= 0)
            {
                return;
            }

            p_Header = string.Format("<!-- {0} -->", GetLocalizedString("HeaderHeader"));
            p_Footer = string.Format("<!-- {0} -->", GetLocalizedString("FooterHeader"));

            foreach (var injection in collInj)
            {
                var injectionType = InjectionController.GetInjectionType(injection);
                var priority      = InjectionController.GetCrmPriority(injection);
                var provider      = InjectionController.GetCrmProvider(injection);

                switch (injectionType)
                {
                case InjectionType.CSS:
                    RegisterStyleSheet(injection.InjectContent, priority, provider);
                    break;

                case InjectionType.JavaScript:
                    RegisterScript(injection.InjectContent, priority, provider);
                    break;

                case InjectionType.HtmlBottom:
                    p_Footer = string.Concat(p_Footer, Server.HtmlDecode(injection.InjectContent));
                    break;

                case InjectionType.HtmlTop:
                    p_Header = string.Concat(p_Header, Server.HtmlDecode(injection.InjectContent));
                    break;
                }
            }

            p_Header = string.Concat(p_Header, string.Format("<!-- {0} -->", GetLocalizedString("HeaderFooter")));
            p_Footer = string.Concat(p_Footer, string.Format("<!-- {0} -->", GetLocalizedString("FooterFooter")));

            // add the injection content to the header
            if (!string.IsNullOrEmpty(HeaderInjection))
            {
                Parent.Page.Header.Controls.Add(new LiteralControl(HeaderInjection));
            }

            // add the injection content to the footer
            if (!string.IsNullOrEmpty(FooterInjection))
            {
                Page.LoadComplete += new EventHandler(InjectIntoFooter);
            }
        }
        private void ExecutePageInjection()
        {
            var ctlModule = new InjectionController();
            var collInj = new InjectionInfoCollection();

            collInj = ctlModule.GetActiveInjectionContents(ModuleId);

            if (collInj.Count <= 0) return;

            p_Header = string.Format("<!-- {0} -->", GetLocalizedString("HeaderHeader"));
            p_Footer = string.Format("<!-- {0} -->", GetLocalizedString("FooterHeader"));

            foreach (var injection in collInj)
            {
                var injectionType = InjectionController.GetInjectionType(injection);
                var priority = InjectionController.GetCrmPriority(injection);
                var provider = InjectionController.GetCrmProvider(injection);

                switch (injectionType)
                {
                    case InjectionType.CSS:
                        RegisterStyleSheet(injection.InjectContent, priority, provider);
                        break;
                    case InjectionType.JavaScript:
                        RegisterScript(injection.InjectContent, priority, provider);
                        break;
                    case InjectionType.HtmlBottom:
                        p_Footer = string.Concat(p_Footer, Server.HtmlDecode(injection.InjectContent));
                        break;
                    case InjectionType.HtmlTop:
                        p_Header = string.Concat(p_Header, Server.HtmlDecode(injection.InjectContent));
                        break;
                }
            }

            p_Header = string.Concat(p_Header, string.Format("<!-- {0} -->", GetLocalizedString("HeaderFooter")));
            p_Footer = string.Concat(p_Footer, string.Format("<!-- {0} -->", GetLocalizedString("FooterFooter")));

            // add the injection content to the header
            if (!string.IsNullOrEmpty(HeaderInjection))
            {
                Parent.Page.Header.Controls.Add(new LiteralControl(HeaderInjection));
            }

            // add the injection content to the footer
            if (!string.IsNullOrEmpty(FooterInjection))
            {
                Page.LoadComplete += new EventHandler(InjectIntoFooter);
            }
        }
 public InjectionInfoCollection GetInjectionContents(int ModuleId)
 {
     InjectionInfoCollection collInj = new InjectionInfoCollection();
     collInj.Fill(DataProvider.Instance().GetInjectionContents(ModuleId));
     return collInj;
 }
 public InjectionInfoCollection GetActiveInjectionContents(int moduleId)
 {
     var collInj = new InjectionInfoCollection();
     collInj.Fill(DataProvider.Instance().GetActiveInjectionContents(moduleId));
     return collInj;
 }
        public string ExportModule(int ModuleID)
        {
            StringBuilder sb = new StringBuilder(150);
            InjectionInfoCollection collInj = new InjectionInfoCollection();
            collInj = GetInjectionContents(ModuleID);

            sb.Append("<WillStrohl><injectionContents>");
            foreach (InjectionInfo obj in collInj)
            {
                sb.Append("<injectionContent>");
                sb.AppendFormat("<injectionId>{0}</injectionId>", XmlUtils.XMLEncode(obj.InjectionId.ToString()));
                sb.AppendFormat("<moduleId>{0}</moduleId>", XmlUtils.XMLEncode(obj.ModuleId.ToString()));
                sb.AppendFormat("<injectTop>{0}</injectTop>", XmlUtils.XMLEncode(obj.InjectTop.ToString()));
                sb.AppendFormat("<injectName>{0}</injectName>", XmlUtils.XMLEncode(obj.InjectName));
                sb.AppendFormat("<injectContent>{0}</injectContent>", XmlUtils.XMLEncode(obj.InjectContent));
                sb.AppendFormat("<isEnabled>{0}</isEnabled>", XmlUtils.XMLEncode(obj.IsEnabled.ToString()));
                sb.AppendFormat("<orderShown>{0}</orderShown>", XmlUtils.XMLEncode(obj.OrderShown.ToString()));
                sb.AppendFormat("<customProperties>{0}</customProperties>", XmlUtils.XMLEncode(obj.CustomProperties.ToJson()));
                sb.Append("</injectionContent>");
            }
            sb.Append("</injectionContents>");
            // later on, will probably need to add module settings here
            sb.Append("</WillStrohl>");

            return sb.ToString();
        }