public AppAndDataHelpers(SxcInstance sexy, ModuleInfo module, Log parentLog) : base("Sxc.AppHlp", parentLog ?? sexy?.Log) { // ModuleInfo module = sexy.ModuleInfo; // Init things than require module-info or similar, but not 2sxc Dnn = new DnnHelper(module); Link = new DnnLinkHelper(Dnn); // todo: maybe init App & App.Data, as they don't really require a working 2sxc if (sexy == null) { return; } ViewDataSource data = sexy.Data; _sxcInstance = sexy; App = sexy.App; // app; Data = sexy.Data; // data; Sxc = new SxcHelper(sexy); Edit = new InPageEditingHelper(sexy); // If PortalSettings is null - for example, while search index runs - HasEditPermission would fail // But in search mode, it shouldn't show drafts, so this is ok. // Note that app could be null, if a user is in admin-ui of a module which hasn't actually be configured yet App?.InitData(PortalSettings.Current != null && sexy.Environment.Permissions.UserMayEditContent, sexy.Environment.PagePublishing /*new Environment.Dnn7.PagePublishing(Log)*/.IsEnabled(module.ModuleID), data.ConfigurationProvider); #region Assemble the mapping of the data-stream "default"/Presentation to the List object and the "ListContent" too List = new List <Element>(); if (data != null && sexy.Template != null) { if (data.Out.ContainsKey("Default")) { var entities = data.List.Select(e => e.Value); var elements = entities.Select(GetElementFromEntity).ToList(); List = elements; if (elements.Any()) { Content = elements.First().Content; //Presentation = elements.First().Presentation; } } if (data.Out.ContainsKey(AppConstants.ListContent)) { var listEntity = data[AppConstants.ListContent].List.Select(e => e.Value).FirstOrDefault(); var listElement = listEntity != null?GetElementFromEntity(listEntity) : null; if (listElement != null) { ListContent = listElement.Content; // ListPresentation = listElement.Presentation; } } } #endregion }
internal SxcInstance(IContentBlock cb, SxcInstance runtimeInstance) { ContentBlock = cb; ModuleInfo = runtimeInstance.ModuleInfo; // Build up the environment. If we know the module context, then use permissions from there Environment.Permissions = runtimeInstance.Environment.Permissions; // url-override of view / data CheckTemplateOverrides(); // allow view change on apps }
internal SxcInstance(IContentBlock cb, SxcInstance runtimeInstance) { ContentBlock = cb; // Inherit various context information from the original SxcInstance ModuleInfo = runtimeInstance.ModuleInfo; Parameters = runtimeInstance.Parameters; Environment.Permissions = runtimeInstance.Environment.Permissions; // url-override of view / data CheckTemplateOverrides(); // allow view change on apps }
/// <summary>s /// Process View if a Template has been set /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_PreRender(object sender, EventArgs e) { try { // check things if it's a module of this portal (ensure everything is ok, etc.) var isSharedModule = ModuleConfiguration.PortalID != ModuleConfiguration.OwnerPortalID; if (!isSharedModule && !SxcInstance.ContentBlock.ContentGroupExists && SxcInstance.App != null) { new DnnStuffToRefactor().EnsureTenantIsConfigured(SxcInstance, Server, ControlPath); } var renderNaked = Request.QueryString["standalone"] == "true"; if (renderNaked) { SxcInstance.RenderWithDiv = false; } var renderedTemplate = SxcInstance.Render().ToString(); // call this after rendering templates, because the template may change what resources are registered RegisterResources(); // optional detailed logging try { if (Request.QueryString["debug"] == "true") { // only attach debug, if it has been enabled for the current time period if (UserInfo.IsSuperUser || Logging.EnableLogging(GlobalConfiguration.Configuration .Properties)) { renderedTemplate += HtmlLog(); } } } catch { /* ignore */ } // If standalone is specified, output just the template without anything else if (renderNaked) { SendStandalone(renderedTemplate); } else { phOutput.Controls.Add(new LiteralControl(renderedTemplate)); } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
protected AppAndDataHelpersBase(SxcInstance sxcInstance, ITenant tenant, Log parentLog) : base("Sxc.AppHlp", parentLog ?? sxcInstance?.Log) { if (sxcInstance == null) { return; } SxcInstance = sxcInstance; _tenant = tenant; App = sxcInstance.App; Data = sxcInstance.Data; Sxc = new SxcHelper(sxcInstance); Edit = new InPageEditingHelper(sxcInstance, Log); }
public AppAndDataHelpers(SxcInstance sexy) { ModuleInfo module = sexy.ModuleInfo; ViewDataSource data = sexy.Data; _sxcInstance = sexy; App = sexy.App; // app; Data = sexy.Data; // data; Dnn = new DnnHelper(module); Link = new DnnLinkHelper(Dnn); Sxc = new SxcHelper(sexy); Edit = new InPageEditingHelper(sexy); // If PortalSettings is null - for example, while search index runs - HasEditPermission would fail // But in search mode, it shouldn't show drafts, so this is ok. App.InitData(PortalSettings.Current != null && sexy.Environment.Permissions.UserMayEditContent /*SecurityHelpers.HasEditPermission(module)*/, data.ConfigurationProvider); #region Assemble the mapping of the data-stream "default"/Presentation to the List object and the "ListContent" too List = new List <Element>(); if (data != null && sexy.Template != null) { if (data.Out.ContainsKey("Default")) { var entities = data.List.Select(e => e.Value); var elements = entities.Select(GetElementFromEntity).ToList(); List = elements; if (elements.Any()) { Content = elements.First().Content; Presentation = elements.First().Presentation; } } if (data.Out.ContainsKey("ListContent")) { var listEntity = data["ListContent"].List.Select(e => e.Value).FirstOrDefault(); var listElement = listEntity != null?GetElementFromEntity(listEntity) : null; if (listElement != null) { ListContent = listElement.Content; ListPresentation = listElement.Presentation; } } } #endregion }
public AppAndDataHelpers(SxcInstance sexy, ModuleInfo module, Log parentLog) : base("Sxc.AppHlp", parentLog ?? sexy?.Log) { // Init things than require module-info or similar, but not 2sxc Dnn = new DnnHelper(module); Link = new DnnLinkHelper(Dnn); if (sexy == null) { return; } _sxcInstance = sexy; App = sexy.App; Data = sexy.Data; Sxc = new SxcHelper(sexy); Edit = new InPageEditingHelper(sexy); // If PortalSettings is null - for example, while search index runs - HasEditPermission would fail // But in search mode, it shouldn't show drafts, so this is ok. // Note that app could be null, if a user is in admin-ui of a module which hasn't actually be configured yet App?.InitData(PortalSettings.Current != null && sexy.Environment.Permissions.UserMayEditContent, PortalSettings.Current != null && sexy.Environment.PagePublishing.IsEnabled(module.ModuleID), Data.ConfigurationProvider); }
public SxcHelper(SxcInstance sexy) { _sexy = sexy; }
} // must be internal for further use cases /// <summary> /// Constructor with EntityModel and DimensionIds /// </summary> public DynamicEntity(ToSic.Eav.Interfaces.IEntity entityModel, string[] dimensions, SxcInstance sexy) { Entity = entityModel; _dimensions = dimensions; SxcInstance = sexy; }
public SxcHelper(SxcInstance sexy) { _sexy = sexy; }
public AppAndDataHelpers(SxcInstance sexy) : this(sexy, sexy.ModuleInfo, null) { }
internal SxcInstance SxcInstance { get; } // must be internal for further use cases /// <summary> /// Constructor with EntityModel and DimensionIds /// </summary> public DynamicEntity(IEntity entityModel, string[] dimensions, SxcInstance sexy) { Entity = entityModel; _dimensions = dimensions; SxcInstance = sexy; }
} // must be internal for further use cases /// <summary> /// Constructor with EntityModel and DimensionIds /// </summary> public DynamicEntity(IEntity entityModel, string[] dimensions, SxcInstance sexy) { Entity = entityModel; _dimensions = dimensions; SxcInstance = sexy; }
internal SxcInstance(IContentBlock cb, SxcInstance runtimeInstance) { ContentBlock = cb; // Inherit various context information from the original SxcInstance ModuleInfo = runtimeInstance.ModuleInfo; Parameters = runtimeInstance.Parameters; Environment.Permissions = runtimeInstance.Environment.Permissions; // url-override of view / data CheckTemplateOverrides(); // allow view change on apps }
public SxcHelper(SxcInstance sxcInstance) { SxcInstance = sxcInstance; }