Exemplo n.º 1
0
 /// <summary>
 /// Constructor for DI, you must always call Init(...) afterwards
 /// </summary>
 public DnnEnvironment(IHttp http, ITenant tenant, IPagePublishing publishing, IZoneMapper zoneMapper) : base("DNN.Enviro")
 {
     _http          = http;
     _tenant        = tenant;
     PagePublishing = publishing.Init(Log);
     ZoneMapper     = zoneMapper.Init(Log);
 }
Exemplo n.º 2
0
        internal Dictionary <Guid, int> SaveInPagePublishing(
            IBlock blockOrNull,
            int appId,
            List <BundleWithHeader <IEntity> > items,
            bool partOfPage,
            Func <bool, Dictionary <Guid, int> > internalSaveMethod,
            IMultiPermissionCheck permCheck
            )
        {
            var allowWriteLive = permCheck.UserMayOnAll(GrantSets.WritePublished);
            var forceDraft     = !allowWriteLive;

            Log.Add($"allowWrite: {allowWriteLive} forceDraft: {forceDraft}");

            // list of saved IDs
            Dictionary <Guid, int> postSaveIds = null;

            // The internal call which will be used further down
            var appIdentity = State.Identity(null, appId);
            var groupList   = _contentGroupList.Init(appIdentity, Log, Context.UserMayEdit);

            Dictionary <Guid, int> SaveAndSaveGroupsInnerCall(Func <bool, Dictionary <Guid, int> > call,
                                                              bool forceSaveAsDraft)
            {
                var ids = call.Invoke(forceSaveAsDraft);

                // now assign all content-groups as needed
                groupList.IfChangesAffectListUpdateIt(blockOrNull, items, ids);
                return(ids);
            }

            // use dnn versioning if partOfPage
            if (partOfPage)
            {
                Log.Add("partOfPage - save with publishing");
                var versioning = _pagePublishing.Init(Log);
                versioning.DoInsidePublishing(Context,
                                              args => postSaveIds = SaveAndSaveGroupsInnerCall(internalSaveMethod, forceDraft));
            }
            else
            {
                Log.Add("partOfPage false, save without publishing");
                postSaveIds = SaveAndSaveGroupsInnerCall(internalSaveMethod, forceDraft);
            }

            Log.Add(() => $"post save IDs: {string.Join(",", postSaveIds.Select(psi => psi.Key + "(" + psi.Value + ")"))}");
            return(postSaveIds);
        }
Exemplo n.º 3
0
 public ListsBackendBase(IPagePublishing publishing, Lazy <CmsManager> cmsManagerLazy, IContextResolver ctxResolver) : base("Bck.Lists")
 {
     CtxResolver     = ctxResolver;
     _cmsManagerLazy = cmsManagerLazy;
     _publishing     = publishing.Init(Log);
 }
Exemplo n.º 4
0
 public ListsBackendBase(IPagePublishing publishing) : base("Bck.Lists")
 {
     _publishing = publishing.Init(Log);
 }
Exemplo n.º 5
0
 public ContentBlockBackend(IServiceProvider sp, IPagePublishing publishing, Lazy <CmsManager> cmsManagerLazy, IContextResolver ctxResolver)
     : base(sp, cmsManagerLazy, ctxResolver, "Bck.FldLst")
 {
     _publishing = publishing.Init(Log);
 }