コード例 #1
0
        public Html5ModuleTokenReplace(Page page, string html5File, ModuleInstanceContext moduleContext, ModuleActionCollection moduleActions)
            : base(page)
        {
            AccessingUser  = moduleContext.PortalSettings.UserInfo;
            DebugMessages  = moduleContext.PortalSettings.UserMode != Entities.Portals.PortalSettings.Mode.View;
            ModuleId       = moduleContext.ModuleId;
            PortalSettings = moduleContext.PortalSettings;

            PropertySource["moduleaction"]  = new ModuleActionsPropertyAccess(moduleContext, moduleActions);
            PropertySource["resx"]          = new ModuleLocalizationPropertyAccess(moduleContext, html5File);
            PropertySource["modulecontext"] = new ModuleContextPropertyAccess(moduleContext);
            PropertySource["request"]       = new RequestPropertyAccess(page.Request);

            // DNN-7750
            var bizClass = moduleContext.Configuration.DesktopModule.BusinessControllerClass;

            var businessController = GetBusinessController(bizClass);

            if (businessController != null)
            {
                var tokens = businessController.GetTokens(page, moduleContext);
                foreach (var token in tokens)
                {
                    PropertySource.Add(token.Key, token.Value);
                }
            }
        }
コード例 #2
0
        public TokenReplace(DynamicEntity Content, DynamicEntity Presentation, DynamicEntity ListContent, DynamicEntity ListPresentation, Dictionary <string, string> List, App app) : base()
        {
            if (HttpContext.Current != null)
            {
                HttpRequest request = HttpContext.Current.Request;
                PropertySource.Add("querystring", new FilteredNameValueCollectionPropertyAccess(request.QueryString));
                PropertySource.Add("form", new FilteredNameValueCollectionPropertyAccess(request.Form));
                PropertySource.Add("server", new FilteredNameValueCollectionPropertyAccess(request.ServerVariables));

                // Add our expando, requires that we convert it to a string/string table
                if (Content != null)
                {
                    /*Dictionary<string, object> ContentDictionary = new Dictionary<string, object>(Content.Dictionary);*/
                    PropertySource.Add("content", new DynamicEntityPropertyAccess("content", Content));
                }
                if (Presentation != null)
                {
                    /*Dictionary<string, object> PresentationDictionary = new Dictionary<string, object>(Presentation.Dictionary);*/
                    PropertySource.Add("presentation", new DynamicEntityPropertyAccess("presentation", Presentation));
                }
                if (ListContent != null)
                {
                    /*Dictionary<string, object> ContentDictionary = new Dictionary<string, object>(ListContent.Dictionary);*/
                    PropertySource.Add("listcontent", new DynamicEntityPropertyAccess("listcontent", ListContent));
                }
                if (ListPresentation != null)
                {
                    /*Dictionary<string, object> PresentationDictionary = new Dictionary<string, object>(ListPresentation.Dictionary);*/
                    PropertySource.Add("listpresentation", new DynamicEntityPropertyAccess("listpresentation", ListPresentation));
                }

                PropertySource.Add("app", new AppPropertyAccess("app", app));
                if (app.Settings != null)
                {
                    PropertySource.Add("appsettings", new DynamicEntityPropertyAccess("appsettings", app.Settings));
                }
                if (app.Resources != null)
                {
                    PropertySource.Add("appresources", new DynamicEntityPropertyAccess("appresources", app.Resources));
                }
                PropertySource.Add("list", new DictionaryPropertyAccess(List));
            }
        }