Beispiel #1
0
 public virtual IEnumerable <Page> RelationsPages(Models.View view)
 {
     if (view.Exists())
     {
         view = view.AsActual();
         var pageRepository = (IPageProvider)Providers.ProviderFactory.GetRepository <IProvider <Page> >();
         return(pageRepository.ByView(view));
     }
     return(new Page[0]);
 }
Beispiel #2
0
        public override IEnumerable <RelationModel> Relations(Models.View view)
        {
            view = view.AsActual();
            var pageRepository = (IPageProvider)Providers.ProviderFactory.GetProvider <IProvider <Page> >();

            return(pageRepository.ByView(view).Select(it => new RelationModel()
            {
                DisplayName = it.FriendlyName,
                ObjectUUID = it.FullName,
                RelationObject = it,
                RelationType = "Page"
            }));
        }
Beispiel #3
0
        public virtual void Localize(string name, Site targetSite, string userName = null)
        {
            var target = new Models.View(targetSite, name);
            var source = target.LastVersion();

            if (target.Site != source.Site)
            {
                ((IViewProvider)Provider).Localize(source, targetSite);
                target = target.AsActual();
                if (target != null)
                {
                    target.UserName = userName;
                    Update(targetSite, target, target);
                }
            }
        }
Beispiel #4
0
        private IEnumerable <DataRuleSetting> AggregateDataRules(Site site, Page page)
        {
            page = page.AsActual();
            IEnumerable <DataRuleSetting> datarules = page.DataRules ?? new List <DataRuleSetting>();

            if (page.PagePositions != null)
            {
                var viewPositions = page.PagePositions.Where(it => it is ViewPosition).OrderBy(it => it.Order);
                foreach (ViewPosition viewPosition in viewPositions)
                {
                    var view = new Models.View(site, viewPosition.ViewName).LastVersion();

                    if (view.Exists())
                    {
                        datarules = datarules.Concat(view.AsActual().DataRules ?? new List <DataRuleSetting>());
                    }
                }
            }

            return(datarules);
        }
Beispiel #5
0
 public PagePositionContext(Models.View view, IDictionary <string, object> parameters, ViewDataDictionary viewData)
 {
     this.View       = view.AsActual();
     this.Parameters = new DynamicDictionary(View.CombineDefaultParameters(parameters));
     this.ViewData   = viewData;
 }