private PageNode CreatePageTemplateHierarchy(ref Guid templateId1, ref Guid templateId2)
        {
            var widgetName    = "ContentBlock";
            var widgetName1   = "News widget";
            var widgetName2   = "Blog post widget";
            var template1Name = "Template1";
            var template2Name = "Template2";

            templateId1 = ServerOperationsFeather.TemplateOperations().DuplicatePageTemplate(PageTemplateName, template1Name);
            var mvcWidget1 = new Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy();

            mvcWidget1.ControllerName = typeof(NewsController).FullName;
            mvcWidget1.Settings       = new Telerik.Sitefinity.Mvc.Proxy.ControllerSettings(new NewsController());
            ServerOperationsFeather.TemplateOperations().AddControlToTemplate(templateId1, mvcWidget1, "Contentplaceholder1", widgetName1);

            templateId2 = ServerOperationsFeather.TemplateOperations().CreatePageTemplate(template2Name, templateId1);
            var mvcWidget2 = new Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy();

            mvcWidget2.ControllerName = typeof(BlogPostController).FullName;
            mvcWidget2.Settings       = new Telerik.Sitefinity.Mvc.Proxy.ControllerSettings(new BlogPostController());
            mvcWidget2.ID             = widgetName2.Replace(" ", string.Empty);
            ServerOperationsFeather.TemplateOperations().AddControlToTemplate(templateId2, mvcWidget2, "Contentplaceholder1", widgetName2);

            var pageId      = ServerOperations.Pages().CreatePage("TestPage1", templateId2);
            var pageNodeId  = ServerOperations.Pages().GetPageNodeId(pageId);
            var pageManager = Telerik.Sitefinity.Modules.Pages.PageManager.GetManager();
            var pageNode    = pageManager.GetPageNode(pageNodeId);

            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(pageNodeId, widgetName, "Contentplaceholder1");

            return(pageNode);
        }
        public void OnBeforeTestsStarts()
        {
            var mvcProxy = new MvcControllerProxy();

            mvcProxy.ControllerName = typeof(EventSchedulerController).FullName;

            var templateId = ServerOperations.Templates().CreateHybridMVCPageTemplate(CaptionCalendar);

            ServerOperationsFeather.TemplateOperations().AddControlToTemplate(templateId, mvcProxy, PlaceHolderId, CaptionCalendar);

            ServerOperations.Events().CreateEvent(Event1Title, string.Empty, false, this.eventStart, this.eventEnd);
            var event1Item = EventsManager.GetManager()
                             .GetEvents()
                             .Where <Event>(ni => ni.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && ni.Title == Event1Title)
                             .FirstOrDefault();

            ServerArrangementContext.GetCurrent().Values.Add("event1Id", event1Item.Id.ToString());

            ServerOperations.Events().CreateEvent(Event2Title, string.Empty, false, this.eventStart, this.eventEnd);
            var event2Item = EventsManager.GetManager()
                             .GetEvents().Where <Event>(ni => ni.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && ni.Title == Event2Title)
                             .FirstOrDefault();

            ServerArrangementContext.GetCurrent().Values.Add("event2Id", event2Item.Id.ToString());
        }
Exemplo n.º 3
0
        public void CreatePages()
        {
            Guid templateId = ServerOperationsFeather.TemplateOperations().GetTemplateIdByTitle(PageTemplateName);

            ServerOperations.Pages().CreatePage(Page1, templateId);
            ServerOperations.Pages().CreatePage(Page2, templateId);
        }
        public void GetTemplateId()
        {
            var templateId = ServerOperationsFeather.TemplateOperations().GetTemplateIdByTitle(TemplateTitle);

            ServerOperations.Pages().CreatePage(PageName, templateId);

            ServerArrangementContext.GetCurrent().Values.Add("templateId", templateId.ToString());
        }
Exemplo n.º 5
0
        public void SetUp()
        {
            ServerOperations.Templates().CreatePureMVCPageTemplate(PageTemplateName);
            Guid templateId = ServerOperationsFeather.TemplateOperations().GetTemplateIdByTitle(PageTemplateName);

            ServerOperations.Pages().CreatePage(PageName, templateId);

            Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Images().CreateLibrary(ImageLibraryTitle);
            Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Images().Upload(ImageLibraryTitle, ImageTitle, ImageResource1);
        }
Exemplo n.º 6
0
        public void TearDown()
        {
            Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages();

            string folderPath = Path.Combine(ServerOperationsFeather.TemplateOperations().SfPath, "JavaScriptTest");
            string filePath   = Path.Combine(folderPath, FileName);

            File.Delete(filePath);
            Directory.Delete(folderPath);
        }
        private PageNode CreatePageOnTemplateWithCustomWigdet(out Guid templateId)
        {
            var templateName = "TestTemplate1";

            templateId = ServerOperationsFeather.TemplateOperations().DuplicatePageTemplate(PageTemplateName, templateName);
            var customWidget = new MvcControllerProxy();

            customWidget.ControllerName = typeof(TestController).FullName;
            customWidget.Settings       = new ControllerSettings(new TestController());
            ServerOperationsFeather.TemplateOperations().AddControlToTemplate(templateId, customWidget, "Contentplaceholder1", typeof(TestController).Name);

            var pageTitle   = "TestPage1";
            var pageId      = ServerOperations.Pages().CreatePage(pageTitle, templateId);
            var pageNodeId  = ServerOperations.Pages().GetPageNodeId(pageId);
            var pageManager = Telerik.Sitefinity.Modules.Pages.PageManager.GetManager();
            var pageNode    = pageManager.GetPageNode(pageNodeId);

            return(pageNode);
        }
Exemplo n.º 8
0
        public void SetUp()
        {
            Guid templateId = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);
            Guid pageId     = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(PageName, templateId);

            pageId = ServerOperations.Pages().GetPageNodeId(pageId);

            ServerOperationsFeather.Pages().AddProfileWidgetToPage(pageId, PlaceHolderId);
            ServerOperationsFeather.Pages().AddJavaScriptWidgetToPage(pageId, PlaceHolderId);

            string folderPath = Path.Combine(ServerOperationsFeather.TemplateOperations().SfPath, "JavaScriptTest");

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }

            string filePath = Path.Combine(folderPath, FileName);

            ServerOperationsFeather.DynamicModules().AddNewResource(JavaScriptFileResource, filePath);
        }