예제 #1
0
        public void AddTemplate(ContentItem templateItem)
        {
            TemplateContainer templates = container.GetOrCreateBelowRoot((c) =>
            {
                c.Title     = "Templates";
                c.Name      = "Templates";
                c.Visible   = false;
                c.SortOrder = int.MaxValue - 1001000;
            });

            templateItem.Name = null;
            templateItem.AddTo(templates);
            persister.Save(templateItem);
        }
예제 #2
0
 public Items.MagicLocation AddLocation(ContentItem location, string discriminator, string templateKey, string title, string zone)
 {
     ContentItem wonderland = containers.GetOrCreateBelowRoot((container) =>
     {
         container.Title = WizardSettings.Title;
         container.Name = WizardSettings.Name;
         container.ZoneName = WizardSettings.ZoneName;
     });
     Items.MagicLocation ml = Context.Current.Resolve<ContentActivator>().CreateInstance<Items.MagicLocation>(wonderland);
     ml.Location = location;
     ml.ItemDiscriminator = discriminator;
     ml.ContentTemplate = templateKey;
     ml.Title = title;
     ml.ItemZoneName = zone;
     persister.Save(ml);
     return ml;
 }
예제 #3
0
        public TrashContainerItem GetTrashContainer(bool create)
        {
            if (!create)
            {
                container.GetBelowRoot();
            }

            return(container.GetOrCreateBelowRoot((trashContainer) =>
            {
                trashContainer.Name = TrashContainerName;
                trashContainer.Title = TrashContainerName;
                trashContainer.Visible = false;
                trashContainer.AuthorizedRoles.Add(new AuthorizedRole(trashContainer, "admin"));
                trashContainer.AuthorizedRoles.Add(new AuthorizedRole(trashContainer, "Editors"));
                trashContainer.AuthorizedRoles.Add(new AuthorizedRole(trashContainer, "Administrators"));
                trashContainer.SortOrder = int.MaxValue - 1000000;
            }));
        }
예제 #4
0
        public void AddTemplate(ContentItem templateItem)
        {
            TemplateContainer templates = container.GetOrCreateBelowRoot((c) =>
            {
                c.Title     = "Templates";
                c.Name      = "Templates";
                c.Visible   = false;
                c.SortOrder = int.MaxValue - 1001000;
            });

            templateItem.Name = null;
            templateItem.AddTo(templates);

            using (var tx = repository.BeginTransaction())
            {
                repository.SaveOrUpdate(templateItem);
                tx.Commit();
            }
        }