예제 #1
0
        private string SiteTemplateCheck(bool blocker)
        {
            if (WebTemplate.Equals("STS#0", StringComparison.InvariantCultureIgnoreCase) || WebTemplate.Equals("DEV#0", StringComparison.InvariantCultureIgnoreCase))
            {
                // We're good with these
                return(null);
            }
            else if (WebTemplate.Equals("BICENTERSITE#0", StringComparison.InvariantCultureIgnoreCase) || WebTemplate.Equals("BLANKINTERNET#0", StringComparison.InvariantCultureIgnoreCase) ||
                     WebTemplate.Equals("ENTERWIKI#0", StringComparison.InvariantCultureIgnoreCase) || WebTemplate.Equals("SRCHCEN#0", StringComparison.InvariantCultureIgnoreCase) ||
                     WebTemplate.Equals("SRCHCENTERLITE#0", StringComparison.InvariantCultureIgnoreCase) || WebTemplate.Equals("POINTPUBLISHINGHUB#0", StringComparison.InvariantCultureIgnoreCase) ||
                     WebTemplate.Equals("POINTPUBLISHINGTOPIC#0", StringComparison.InvariantCultureIgnoreCase) || WebTemplate.Equals("CMSPUBLISHING#0", StringComparison.InvariantCultureIgnoreCase) ||
                     SiteColUrl.EndsWith("/sites/contenttypehub", StringComparison.InvariantCultureIgnoreCase))
            {
                // Block these
                if (blocker)
                {
                    return("IncompatibleWebTemplate");
                }
            }
            else
            {
                // Provide a warning
                if (!blocker)
                {
                    return("DefaultHomePageImpacted");
                }
            }

            return(null);
        }
예제 #2
0
        protected WebTemplate GenerateSidebarSurface()
        {
            const string surfaceName = "TestSidebarTemplate";
            var          surface     = Db.SQL <WebTemplate>("SELECT wt FROM Simplified.Ring6.WebTemplate wt WHERE wt.Name = ?", surfaceName).First;

            if (surface != null)
            {
                return(surface);
            }

            surface = new WebTemplate
            {
                Name = surfaceName,
                Html = "/Website/templates/SidebarTemplate.html"
            };

            new WebSection
            {
                Template = surface,
                Name     = "Left",
                Default  = false
            };
            new WebSection
            {
                Template = surface,
                Name     = "Right",
                Default  = true
            };

            return(surface);
        }
예제 #3
0
        /// <summary>
        /// Helper method for loading the portal items
        /// </summary>
        /// <param name="bw"></param>
        private void LoadPortalItems(BackgroundWorker bw, bool isLegacyPortal)
        {
            portalItems = new List <EditablePortalItem>();
            bw.ReportProgress(0, "Loading Web pages...");
            portalItems.AddRange(WebPage.GetItems(Service));
            bw.ReportProgress(0, "Loading Entity forms...");
            portalItems.AddRange(EntityForm.GetItems(Service, ref isLegacyPortal));
            bw.ReportProgress(0, "Loading Entity lists...");
            portalItems.AddRange(EntityList.GetItems(Service, ref isLegacyPortal));
            bw.ReportProgress(0, "Loading Web templates...");
            portalItems.AddRange(WebTemplate.GetItems(Service, ref isLegacyPortal));
            bw.ReportProgress(0, "Loading Web files...");
            portalItems.AddRange(WebFile.GetItems(Service));
            bw.ReportProgress(0, "Loading Web form steps...");
            portalItems.AddRange(WebFormStep.GetItems(Service));
            bw.ReportProgress(0, "Loading Content Snippets...");
            portalItems.AddRange(ContentSnippet.GetItems(Service, ref isLegacyPortal));

            if (!isLegacyPortal)
            {
                bw.ReportProgress(0, "Loading Portal languages...");
                ctvf.Languages = Service.RetrieveMultiple(new QueryExpression("adx_websitelanguage")
                {
                    ColumnSet = new ColumnSet(true)
                }).Entities.ToList();
            }
        }
예제 #4
0
        public void GenerateDefaultSurface()
        {
            var surface = new WebTemplate()
            {
                Name = "DefaultTemplate",
                Html = "/Website/templates/DefaultTemplate.html"
            };

            var topbar = new WebSection()
            {
                Template = surface,
                Name     = "TopBar",
                Default  = false
            };

            var main = new WebSection()
            {
                Template = surface,
                Name     = "Main",
                Default  = true
            };

            var catchAllUrl = new WebUrl()
            {
                Template = surface,
                Url      = null,
                IsFinal  = true
            };

            new WebMap()
            {
                Section = topbar, ForeignUrl = "/signin/user", SortNumber = 1
            };
        }
예제 #5
0
        public void GenerateSidebarSurface()
        {
            var surface = new WebTemplate()
            {
                Name = "SidebarTemplate",
                Html = "/Website/templates/SidebarTemplate.html"
            };

            var sidebarLeft = new WebSection()
            {
                Template = surface,
                Name     = "Left",
                Default  = false
            };

            new WebSection()
            {
                Template = surface,
                Name     = "Right",
                Default  = true
            };

            var templatesUrl = new WebUrl()
            {
                Template = surface,
                Url      = "/website/cms/surfaces"
            };

            new WebMap()
            {
                Url = templatesUrl, Section = sidebarLeft, ForeignUrl = "/website/help?topic=surfaces", SortNumber = 1
            };
        }
예제 #6
0
        public void GenerateLauncherSurface()
        {
            var surface = new WebTemplate()
            {
                Name = "LauncherTemplate",
                Html = "/Website/templates/LauncherTemplate.html"
            };

            var topbar = new WebSection()
            {
                Template = surface,
                Name     = "TopBar",
                Default  = false
            };

            var leftbar = new WebSection()
            {
                Template = surface,
                Name     = "LeftBar",
                Default  = false
            };

            var main = new WebSection()
            {
                Template = surface,
                Name     = "Main",
                Default  = true
            };

            new WebMap()
            {
                Section = topbar, ForeignUrl = "/signin/user", SortNumber = 1
            };
        }
예제 #7
0
        private static void CreateLoginLayout()
        {
            WebTemplate loginSurface = CreateSurface("LoginSurface", "LoginSurface");

            CreateCatchUri(loginSurface, "/signin/signinuser");
            WebSection logoBp   = CreateBlendingPoint(loginSurface, "Logo");
            WebSection footerBp = CreateBlendingPoint(loginSurface, "Footer");

            CreateBlendingPoint(loginSurface, "SignIn", isBlendingPointDefault: true);

            CreatePinningRule(logoBp, CreateWrappedHtmlUrl("Logo"), 0);
            CreatePinningRule(logoBp, CreateWrappedHtmlUrl("Slogan"), 1);
            CreatePinningRule(footerBp, CreateWrappedHtmlUrl("TermsAndConditionsLink"));

            var compositionKey = "/sc/htmlmerger?SignIn=/SignIn/viewmodels/SignInFormPage.html";
            var composition    = HTMLComposition.GetUsingKey(compositionKey) ?? new HTMLComposition()
            {
                Key = compositionKey
            };

            // ReSharper disable once AssignNullToNotNullAttribute this should always work, because it's compiled into the assembly
            using (var streamReader = new StreamReader(typeof(MainHandlers).Assembly.GetManifestResourceStream("SampleWebsiteTheme.wwwroot.SampleWebsiteTheme.html.SignInComposition.html")))
            {
                composition.Value = streamReader.ReadToEnd();
            }
        }
예제 #8
0
 /// <summary>
 /// Initializes the new instance of <see cref="SPClient.SPClientWebTemplatePipeBind"/> class.
 /// </summary>
 /// <param name="webTemplate">the site template.</param>
 public SPClientWebTemplatePipeBind(WebTemplate webTemplate)
 {
     if (webTemplate == null)
     {
         throw new ArgumentNullException("webTemplate");
     }
     this.webTemplate = webTemplate;
 }
예제 #9
0
        private void LoadItems()
        {
            ctv.Enabled = false;
            WorkAsync(new WorkAsyncInfo
            {
                Message = "Loading portal items...",
                Work    = (bw, e) =>
                {
                    portalItems = new List <EditablePortalItem>();
                    bw.ReportProgress(0, "Loading Web pages...");
                    portalItems.AddRange(WebPage.GetItems(Service));
                    bw.ReportProgress(0, "Loading Entity forms...");
                    portalItems.AddRange(EntityForm.GetItems(Service, ref isLegacyPortal));
                    bw.ReportProgress(0, "Loading Entity lists...");
                    portalItems.AddRange(EntityList.GetItems(Service, ref isLegacyPortal));
                    bw.ReportProgress(0, "Loading Web templates...");
                    portalItems.AddRange(WebTemplate.GetItems(Service, ref isLegacyPortal));
                    bw.ReportProgress(0, "Loading Web files...");
                    portalItems.AddRange(WebFile.GetItems(Service));
                    bw.ReportProgress(0, "Loading Web form steps...");
                    portalItems.AddRange(WebFormStep.GetItems(Service));
                    bw.ReportProgress(0, "Loading Content Snippets...");
                    portalItems.AddRange(ContentSnippet.GetItems(Service, ref isLegacyPortal));

                    portalItems.SelectMany(p => p.Items).ToList().ForEach(i => i.StateChanged += CodeItem_StateChanged);
                },
                ProgressChanged = e =>
                {
                    SetWorkingMessage(e.UserState.ToString());
                },
                PostWorkCallBack = e =>
                {
                    if (e.Error != null)
                    {
                        if (((FaultException <OrganizationServiceFault>)e.Error).Detail.ErrorCode == -2147217149)
                        {
                            MessageBox.Show(e.Error.ToString());

                            var message =
                                "Unable to load code items: Please ensure you are targeting an organization linked to a Microsoft Portal (not a legacy Adxstudio one)";
                            MessageBox.Show(this, message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            LogError(message);
                        }
                        else
                        {
                            MessageBox.Show(this, $"An error occured while loading code items: {e.Error.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            LogError($"An error occured while loading code items: {e.Error.ToString()}");
                        }
                    }

                    ctv.DisplayCodeItems(portalItems, isLegacyPortal);
                    ctv.Enabled = true;
                }
            });
        }
예제 #10
0
 /// <summary>
 /// Returns the site template.
 /// </summary>
 /// <param name="web">the parent site.</param>
 /// <param name="lcid">the locale id.</param>
 public WebTemplate GetWebTemplate(Web web, uint lcid)
 {
     if (this.webTemplate == null && this.webTemplateName != null)
     {
         var webTemplates = web.GetAvailableWebTemplates(lcid, true);
         web.Context.Load(webTemplates);
         web.Context.ExecuteQuery();
         this.webTemplate = webTemplates.Single(item => item.Name == this.webTemplateName);
     }
     return(this.webTemplate);
 }
예제 #11
0
        public ActionResult SaveWebTemplate(string html, string name)
        {
            WebTemplate item = new WebTemplate();

            item.Html = html;
            item.Name = name;
            WebTemplateRepository.SaveOrUpdate(item);
            var model = new TinymceInitSettingsModel();

            model.templates = GetTemplatesList();
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
예제 #12
0
        private static WebUrl CreateCatchUri(WebTemplate surface, string uri)
        {
            var catchUri = surface.Pages
                           .FirstOrDefault(url => url.Template.Key == surface.Key) ?? new WebUrl()
            {
                Template = surface,
            };

            catchUri.Url     = uri;
            catchUri.IsFinal = true;
            return(catchUri);
        }
예제 #13
0
        private static void CreateDesktopLayout()
        {
            WebTemplate desktopSurface = CreateSurface("DesktopSurface", "DesktopSurface");

            CreateCatchUri(desktopSurface, null);

            WebSection appTitleBlendingPoint = CreateBlendingPoint(desktopSurface, "AppTitle");
            WebSection mainMenuBlendingPoint = CreateBlendingPoint(desktopSurface, "MainMenu");
            WebSection logoBlendingPoint     = CreateBlendingPoint(desktopSurface, "Logo");
            WebSection topBarBlendingPoint   = CreateBlendingPoint(desktopSurface, "TopBar");

            CreateBlendingPoint(desktopSurface, "Main", isBlendingPointDefault: true);

            var content = Db.SQL <Content>($"SELECT c FROM {typeof(Content).FullName} c WHERE {nameof(Content.URL)} = ?", DefaultSystemLogoContentUrl).First;

            if (content == null)
            {
                content = new Content()
                {
                    Name     = DefaultSystemLogoContentName,
                    URL      = DefaultSystemLogoContentUrl,
                    MimeType = DefaultSystemLogoContentMimeType
                };
            }

            var concept = Db.SQL <Something>($"SELECT s FROM {typeof(Something).FullName} s WHERE {nameof(Something.Name)} = ?", DefaultSystemLogoName).First;

            if (concept == null)
            {
                concept = new Something()
                {
                    Name = DefaultSystemLogoName
                };
            }

            if (concept.Illustration == null)
            {
                new Illustration()
                {
                    WhatIs = content,
                    ToWhat = concept
                };
            }

            CreatePinningRule(logoBlendingPoint, $"/images/partials/somethings-single-static/{concept.GetObjectID()}");
            CreatePinningRule(appTitleBlendingPoint, "/DisplayAppTitle");
            CreatePinningRule(mainMenuBlendingPoint, "/Launchpad");
            CreatePinningRule(topBarBlendingPoint, "/signin/user");
        }
예제 #14
0
        private static WebSection CreateBlendingPoint(
            WebTemplate surface,
            string blendingPointName,
            bool isBlendingPointDefault = false)
        {
            var blendingPoint = surface.Sections
                                .FirstOrDefault(section => section.Name == blendingPointName)
                                ?? new WebSection()
            {
                Name     = blendingPointName,
                Template = surface
            };

            blendingPoint.Default = isBlendingPointDefault;
            return(blendingPoint);
        }
예제 #15
0
        private bool DefineAsPublishingPortal()
        {
            // Check web template
            if (WebTemplate.Equals("BICENTERSITE#0", StringComparison.InvariantCultureIgnoreCase) || WebTemplate.Equals("BLANKINTERNET#0", StringComparison.InvariantCultureIgnoreCase) ||
                WebTemplate.Equals("ENTERWIKI#0", StringComparison.InvariantCultureIgnoreCase) || WebTemplate.Equals("SRCHCEN#0", StringComparison.InvariantCultureIgnoreCase) ||
                WebTemplate.Equals("SRCHCENTERLITE#0", StringComparison.InvariantCultureIgnoreCase) || WebTemplate.Equals("POINTPUBLISHINGHUB#0", StringComparison.InvariantCultureIgnoreCase) ||
                WebTemplate.Equals("POINTPUBLISHINGTOPIC#0", StringComparison.InvariantCultureIgnoreCase) || WebTemplate.Equals("CMSPUBLISHING#0", StringComparison.InvariantCultureIgnoreCase))
            {
                return(true);
            }

            // Check publishing page library usage
            if (PublishingPagesUsed)
            {
                return(true);
            }

            return(false);
        }
예제 #16
0
        /// <summary>
        /// Create a sub site.
        /// </summary>
        /// <param name="siteUrl">
        /// The site url.
        /// </param>
        /// <param name="templateName">
        /// The SharePoint template name.
        /// </param>
        /// <param name="title">
        /// The title.
        /// </param>
        /// <param name="description">
        /// The description.
        /// </param>
        /// <param name="clientContext">
        /// The client context.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public string CreateSubSite(string siteUrl, string templateName, string title, string description, ClientContext clientContext)
        {
            // Currently only english, could be extended to be configurable based on language pack usage
            // Lookup the web template, need the name from the title
            WebTemplateCollection templates = clientContext.Web.GetAvailableWebTemplates(1033, false);

            clientContext.Load(templates);
            clientContext.ExecuteQuery();
            WebTemplate template = templates.FirstOrDefault(t => t.Title.Contains(templateName));

            if (template == null)
            {
                throw new ArgumentException(
                          string.Format(
                              "The project site template '{0}' was not found in the available solutions.\r\n  Check the App settings and the sites solutions for a matching template name.",
                              templateName));
            }

            // Create web creation configuration
            WebCreationInformation information = new WebCreationInformation
            {
                WebTemplate = template.Name,
                Description = description,
                Title       = title,
                Url         = siteUrl,
                Language    = 1033
            };

            // Load host web and add new web to it.
            Web web    = clientContext.Web;
            Web newWeb = web.Webs.Add(information);

            clientContext.ExecuteQuery();
            clientContext.Load(newWeb);
            clientContext.ExecuteQuery();

            // All done, let's return the URL of the newly created site
            return(newWeb.Url);
        }
예제 #17
0
        public void UpdateWebTemplates(string inputPath, string websitePrimaryKey)
        {
            Logger.Trace(CultureInfo.InvariantCulture, TraceMessageHelper.EnteredMethod, SystemTypeName, MethodBase.GetCurrentMethod().Name);

            if (string.IsNullOrWhiteSpace(inputPath))
            {
                throw new ArgumentNullException(nameof(inputPath));
            }
            Logger.Info(CultureInfo.InvariantCulture, "Input path: {0}.", inputPath);

            if (!Directory.Exists(Path.GetDirectoryName(inputPath)))
            {
                throw new FileNotFoundException("The input file path does not exist.");
            }

            if (string.IsNullOrWhiteSpace(websitePrimaryKey))
            {
                throw new ArgumentNullException(nameof(websitePrimaryKey));
            }
            Logger.Info(CultureInfo.InvariantCulture, "Web site primary key: {0}.", websitePrimaryKey);

            bool isValid = Guid.TryParse(websitePrimaryKey, out Guid websiteId);

            if (!isValid)
            {
                throw new ArgumentException("The web site primary key is not valid");
            }

            IList <FileInfo> files = new List <FileInfo>();

            EnumerateFiles(inputPath, files);

            IList <WebTemplate> webTemplates = CrmService.GetWebTemplates(websiteId);

            OrganizationServiceContext.ClearChanges();

            foreach (FileInfo file in files)
            {
                Logger.Info(CultureInfo.InvariantCulture, "Processing file {0}.", file.FullName);

                string fileName = file.Name.ToUpperInvariant().Replace(".HTML", string.Empty);

                WebTemplate webTemplate = webTemplates.SingleOrDefault(x => x.Name.ToUpperInvariant().Equals(fileName));

                if (webTemplate == null)
                {
                    Logger.Warn(CultureInfo.InvariantCulture, "There is no portal web template entity for the file {0}.", file.Name);
                    continue;
                }

                string source = File.ReadAllText(file.FullName);
                if (source.Equals(webTemplate.Source))
                {
                    continue;
                }

                var updatedWebTemplate = new WebTemplate
                {
                    Id     = webTemplate.Id,
                    Source = source
                };

                OrganizationServiceContext.Attach(updatedWebTemplate);
                OrganizationServiceContext.UpdateObject(updatedWebTemplate);
            }

            CrmService.SaveChanges(OrganizationServiceContext, SaveChangesOptions.None);

            Logger.Trace(CultureInfo.InvariantCulture, TraceMessageHelper.ExitingMethod, SystemTypeName, MethodBase.GetCurrentMethod().Name);
        }
예제 #18
0
        public void GenerateHolyGrailSurface()
        {
            var surface = new WebTemplate()
            {
                Name = "HolyGrailTemplate",
                Html = "/Website/templates/HolyGrailTemplate.html"
            };

            var content = new WebSection()
            {
                Template = surface,
                Name     = "Content",
                Default  = true
            };

            var header = new WebSection()
            {
                Template = surface,
                Name     = "Header",
                Default  = false
            };

            var left = new WebSection()
            {
                Template = surface,
                Name     = "Left",
                Default  = false
            };

            var right = new WebSection()
            {
                Template = surface,
                Name     = "Right",
                Default  = false
            };

            var footer = new WebSection()
            {
                Template = surface,
                Name     = "Footer",
                Default  = false
            };

            var homeUrl = new WebUrl()
            {
                Template = surface,
                Url      = "/content/dynamic/apps",
                IsFinal  = true
            };

            var appsUrl = new WebUrl()
            {
                Template = surface,
                Url      = "/content/dynamic/apps/wanted-apps",
                IsFinal  = true
            };

            var profileUrl = new WebUrl()
            {
                Template = surface,
                Url      = "/content/dynamic/userprofile",
                IsFinal  = true
            };

            new WebMap()
            {
                Section = header, ForeignUrl = "/signin/user", SortNumber = 1
            };
            new WebMap()
            {
                Section = header, ForeignUrl = "/content/dynamic/navigation", SortNumber = 2,
            };
            new WebMap()
            {
                Url = homeUrl, Section = header, ForeignUrl = "/content/dynamic/index/header", SortNumber = 3
            };
            new WebMap()
            {
                Url = homeUrl, Section = header, ForeignUrl = "/signin/signinuser", SortNumber = 4
            };
            new WebMap()
            {
                Url = homeUrl, Section = header, ForeignUrl = "/registration", SortNumber = 5
            };
            new WebMap()
            {
                Url = homeUrl, Section = header, ForeignUrl = "/content/dynamic/index/registration", SortNumber = 6
            };

            new WebMap()
            {
                Url = homeUrl, Section = left, ForeignUrl = "/content/dynamic/index/left", SortNumber = 1
            };

            new WebMap()
            {
                Url = homeUrl, Section = right, ForeignUrl = "/content/dynamic/index/right", SortNumber = 1
            };

            new WebMap()
            {
                Url = homeUrl, Section = footer, ForeignUrl = "/content/dynamic/index/footer", SortNumber = 1
            };

            new WebMap()
            {
                Url = appsUrl, Section = header, ForeignUrl = "/content/dynamic/apps/header", SortNumber = 1
            };
            new WebMap()
            {
                Url = appsUrl, Section = header, ForeignUrl = "/content/dynamic/apps/footer", SortNumber = 2
            };

            new WebMap()
            {
                Url = profileUrl, Section = header, ForeignUrl = "/content/dynamic/userprofile/header", SortNumber = 1
            };
            new WebMap()
            {
                Url = profileUrl, Section = content, ForeignUrl = "/userprofile", SortNumber = 2
            };
            new WebMap()
            {
                Url = profileUrl, Section = footer, ForeignUrl = "/content/dynamic/userprofile/footer", SortNumber = 3
            };
        }
예제 #19
0
        public ProcessingResult Process(RequestContext context)
        {
            //it's a public request, work out what they want
            // / = list servers
            // /[0-9]+/ = server home page including chat log
            // /[0-9]+/map = Google Map
            // /[0-9]+/renders = c10t renders

            Regex regRoot          = new Regex(@"^/$");
            Regex regServerList    = new Regex(@"^/servers/$");
            Regex regServerHome    = new Regex(@"^/servers/([0-9]+)/$");
            Regex regServerGMap    = new Regex(@"^/servers/([0-9]+)/map/");
            Regex regServerRenders = new Regex(@"^/servers/([0-9]+)/renders/");

            if (regServerGMap.Match(context.Request.Uri.AbsolutePath).Success || regServerRenders.Match(context.Request.Uri.AbsolutePath).Success)
            {
                return(ProcessingResult.Continue);
            }
            else
            {
                string strTemplate = "No matching Template";
                Dictionary <string, string> dicTags = new Dictionary <string, string>();

                if (regRoot.Match(context.Request.Uri.AbsolutePath).Success)
                {
                    //Server Root
                    strTemplate = File.ReadAllText(Core.RootFolder + @"\web\templates\root.html");
                    dicTags.Add("PageTitle", "YAMS Hosted Server");
                    dicTags.Add("PageBody", "test");
                }
                else if (regServerList.Match(context.Request.Uri.AbsolutePath).Success)
                {
                    //List of Servers
                    strTemplate = File.ReadAllText(Core.RootFolder + @"\web\templates\server-list.html");
                    dicTags.Add("PageTitle", "Server List");
                    dicTags.Add("PageBody", "test");
                }
                else if (regServerHome.Match(context.Request.Uri.AbsolutePath).Success)
                {
                    //Individual Server home
                    Match    matServerHome = regServerHome.Match(context.Request.Uri.AbsolutePath);
                    int      intServerID   = Convert.ToInt32(matServerHome.Groups[1].Value);
                    MCServer s             = Core.Servers[intServerID];

                    string strOverviewer = "";
                    string strTectonicus = "";
                    string strImages     = "";
                    string strBackups    = "";

                    if (File.Exists(s.ServerDirectory + @"\renders\overviewer\output\index.html"))
                    {
                        strOverviewer = "<h3>Overviewer Map</h3><div><a href=\"renders/overviewer/output/index.html\">Click here to open map</a>";
                    }
                    if (File.Exists(s.ServerDirectory + @"\renders\tectonicus\map.html"))
                    {
                        strTectonicus = "<h3>Tectonicus Map</h3><div><a href=\"renders/tectonicus/map.html\">Click here to open map</a>";
                    }

                    strImages = "<h3>Images</h3><ul>";
                    DirectoryInfo di          = new DirectoryInfo(s.ServerDirectory + @"\renders\");
                    FileInfo[]    fileEntries = di.GetFiles();
                    foreach (FileInfo fi in fileEntries)
                    {
                        strImages += "<li><a href=\"renders/" + fi.Name + "\">" + fi.Name + "</a></li>";
                    }
                    strImages += "</ul>";

                    strBackups = "<h3>Backups</h3><ul>";
                    DirectoryInfo di2          = new DirectoryInfo(s.ServerDirectory + @"\backups\");
                    FileInfo[]    fileEntries2 = di2.GetFiles();
                    foreach (FileInfo fi in fileEntries2)
                    {
                        strBackups += "<li><a href=\"backups/" + fi.Name + "\">" + fi.Name + "</a></li>";
                    }
                    strBackups += "</ul>";

                    strTemplate = File.ReadAllText(Core.RootFolder + @"\web\templates\server-home.html");
                    dicTags.Add("PageTitle", s.ServerTitle);
                    dicTags.Add("RenderOverviewer", strOverviewer);
                    dicTags.Add("RenderTectonicus", strTectonicus);
                    dicTags.Add("RenderImages", strImages);
                    dicTags.Add("BackupList", strBackups);
                    dicTags.Add("PageBody", "Body");
                }
                else
                {
                    //Unknown
                    context.Response.Status = HttpStatusCode.NotFound;
                    strTemplate             = File.ReadAllText(Core.RootFolder + @"\web\templates\server-home.html");
                    dicTags.Add("PageTitle", "404");
                    dicTags.Add("PageBody", "<h1>404 - Not Found</h1>");
                }

                //Run through our replacer
                strTemplate = WebTemplate.ReplaceTags(strTemplate, dicTags);

                //And send to the browser
                context.Response.Reason          = "Completed - YAMS";
                context.Response.Connection.Type = ConnectionType.Close;
                byte[] buffer = Encoding.UTF8.GetBytes(strTemplate);
                context.Response.Body.Write(buffer, 0, buffer.Length);
                return(ProcessingResult.SendResponse);
            }
        }
예제 #20
0
        public ActionResult GetTemplate(int id)
        {
            WebTemplate template = WebTemplateRepository.Get(s => s.Id.Equals(id)).SingleOrDefault();

            return(Content(Server.HtmlDecode(template.Html)));
        }
예제 #21
0
        public ProcessingResult Process(RequestContext context)
        {
            //it's a public request, work out what they want
            // / = list servers
            // /[0-9]+/ = server home page including chat log
            // /[0-9]+/map = Google Map
            // /[0-9]+/renders = c10t renders

            Regex regRoot          = new Regex(@"^/$");
            Regex regServerList    = new Regex(@"^/servers/$");
            Regex regServerHome    = new Regex(@"^/servers/([0-9]+)/$");
            Regex regServerGMap    = new Regex(@"^/servers/([0-9]+)/map/");
            Regex regServerRenders = new Regex(@"^/servers/([0-9]+)/renders/");
            Regex regServerAPI     = new Regex(@"^/servers/([0-9]+)/api/");

            if (regServerGMap.Match(context.Request.Uri.AbsolutePath).Success || regServerRenders.Match(context.Request.Uri.AbsolutePath).Success)
            {
                return(ProcessingResult.Continue);
            }
            else
            {
                string strTemplate = "No matching Template";
                Dictionary <string, string> dicTags = new Dictionary <string, string>();

                if (regRoot.Match(context.Request.Uri.AbsolutePath).Success)
                {
                    //Server Root
                    strTemplate = File.ReadAllText(Core.RootFolder + @"\web\templates\root.html");
                    dicTags.Add("PageTitle", "YAMS Hosted Server");
                    dicTags.Add("PageBody", "test");
                }
                else if (regServerList.Match(context.Request.Uri.AbsolutePath).Success)
                {
                    //List of Servers
                    strTemplate = File.ReadAllText(Core.RootFolder + @"\web\templates\server-list.html");
                    dicTags.Add("PageTitle", "Server List");
                    string strServerList;
                    strServerList = "<ul>";
                    foreach (KeyValuePair <int, MCServer> kvp in Core.Servers)
                    {
                        strServerList += "<li><a href=\"" + kvp.Value.ServerID + "/\">" + kvp.Value.ServerTitle + "</a></li>";
                    }
                    ;
                    strServerList += "</ul>";
                    dicTags.Add("ServerList", strServerList);
                }
                else if (regServerHome.Match(context.Request.Uri.AbsolutePath).Success)
                {
                    //Individual Server home
                    Match    matServerHome = regServerHome.Match(context.Request.Uri.AbsolutePath);
                    int      intServerID   = Convert.ToInt32(matServerHome.Groups[1].Value);
                    MCServer s             = Core.Servers[intServerID];

                    string strOverviewer = "";
                    string strImages     = "";
                    string strBackups    = "";

                    if (File.Exists(s.ServerDirectory + @"\renders\overviewer\output\index.html"))
                    {
                        strOverviewer = "<div><a href=\"renders/overviewer/output/index.html\">Click here to open map</a></div>";
                    }

                    strImages = "<ul>";
                    DirectoryInfo          di          = new DirectoryInfo(s.ServerDirectory + @"\renders\");
                    IEnumerable <FileInfo> fileEntries = di.GetFiles();
                    var imageFiles = fileEntries.OrderByDescending(f => f.CreationTime).Take(20);
                    foreach (FileInfo fi in imageFiles)
                    {
                        strImages += "<li><a href=\"renders/" + fi.Name + "\">" + fi.Name + "</a></li>";
                    }
                    strImages += "</ul>";

                    strBackups = "<ul>";
                    DirectoryInfo          di2          = new DirectoryInfo(s.ServerDirectory + @"\backups\");
                    IEnumerable <FileInfo> fileEntries2 = di2.GetFiles();
                    var backupFiles = fileEntries2.OrderByDescending(f => f.CreationTime).Take(20);
                    foreach (FileInfo fi in backupFiles)
                    {
                        strBackups += "<li><a href=\"backups/" + fi.Name + "\">" + fi.Name + "</a></li>";
                    }
                    strBackups += "</ul>";

                    //Determine if they need a special client URL
                    string strClientURL = "";
                    if (s.ServerType == "pre")
                    {
                        string json = File.ReadAllText(YAMS.Core.RootFolder + @"\lib\versions.json");
                        //Dictionary<string, string> dicVers = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
                        JObject jVers = JObject.Parse(json);
                        strClientURL = "This server is running the weekly snapshots, <a href=\"" + (string)jVers["pre-client"] + "\">download current client</a>.";
                    }

                    //List out players online
                    string strPlayers = "";
                    if (s.Players.Count > 0)
                    {
                        strPlayers = "<ul>";
                        foreach (KeyValuePair <string, Player> kvp in s.Players)
                        {
                            Vector playerPos = kvp.Value.Position;
                            strPlayers += "<li>";
                            if (kvp.Value.Level == "op")
                            {
                                strPlayers += "<span class=\"label label-important\">op</span> ";
                            }
                            strPlayers += kvp.Value.Username + " <span class=\"label\">" +
                                          playerPos.x.ToString("0.##") + ", " +
                                          playerPos.y.ToString("0.##") + ", " +
                                          playerPos.z.ToString("0.##") + "</span>";
                            strPlayers += "</li>";
                        }
                        ;
                        strPlayers += "</ul>";
                    }
                    else
                    {
                        strPlayers = "No players online right now";
                    }

                    //Connection Addresses
                    string strConnectAddress = "";
                    if (Database.GetSetting("DNSName", "YAMS") != "")
                    {
                        strConnectAddress = Database.GetSetting("DNSName", "YAMS") + ".yams.in";
                    }
                    else
                    {
                        strConnectAddress = Networking.GetExternalIP().ToString();
                    }
                    if (s.GetProperty("server-port") != "25565")
                    {
                        strConnectAddress += ":" + s.GetProperty("server-port");
                    }

                    strConnectAddress += "<input type=\"hidden\" id=\"server-host\" value=\"" + Networking.GetExternalIP().ToString() + "\" />" +
                                         "<input type=\"hidden\" id=\"server-port\" value=\"" + s.GetProperty("server-port") + "\" />";

                    strTemplate = File.ReadAllText(Core.RootFolder + @"\web\templates\server-home.html");
                    dicTags.Add("PageTitle", s.ServerTitle);
                    dicTags.Add("RenderOverviewer", strOverviewer);
                    dicTags.Add("RenderImages", strImages);
                    dicTags.Add("BackupList", strBackups);
                    dicTags.Add("ServerConnectAddress", strConnectAddress); //TODO
                    dicTags.Add("ClientURL", strClientURL);
                    dicTags.Add("PlayersOnline", strPlayers);
                    dicTags.Add("PageBody", Database.GetSetting(intServerID, "ServerWebBody").ToString());
                }
                else if (regServerAPI.Match(context.Request.Uri.AbsolutePath).Success)
                {
                    string strResponse         = "";
                    IParameterCollection param = context.Request.Parameters;
                    Match    matServerAPI      = regServerAPI.Match(context.Request.Uri.AbsolutePath);
                    int      intServerID       = Convert.ToInt32(matServerAPI.Groups[1].Value);
                    MCServer s = Core.Servers[intServerID];
                    switch (context.Request.Parameters["action"])
                    {
                    case "players":
                        strResponse = "{\"players\" : [";
                        if (s.Players.Count > 0)
                        {
                            foreach (KeyValuePair <string, Player> kvp in s.Players)
                            {
                                Vector playerPos = kvp.Value.Position;
                                strResponse += " { \"name\": \"" + kvp.Value.Username + "\", " +
                                               "\"level\": \"" + kvp.Value.Level + "\", " +
                                               "\"x\": \"" + playerPos.x.ToString("0.##") + "\", " +
                                               "\"y\": \"" + playerPos.y.ToString("0.##") + "\", " +
                                               "\"z\": \"" + playerPos.z.ToString("0.##") + "\" },";
                            }
                            ;
                            strResponse = strResponse.Remove(strResponse.Length - 1);
                        }
                        strResponse += "]}";
                        break;
                    }
                    strTemplate = strResponse;
                }
                else
                {
                    //Unknown
                    context.Response.Status = HttpStatusCode.NotFound;
                    strTemplate             = File.ReadAllText(Core.RootFolder + @"\web\templates\server-home.html");
                    dicTags.Add("PageTitle", "404");
                    dicTags.Add("PageBody", "<h1>404 - Not Found</h1>");
                }

                //Run through our replacer
                strTemplate = WebTemplate.ReplaceTags(strTemplate, dicTags);

                //And send to the browser
                context.Response.Reason          = "Completed - YAMS";
                context.Response.Connection.Type = ConnectionType.Close;
                byte[] buffer = Encoding.UTF8.GetBytes(strTemplate);
                context.Response.Body.Write(buffer, 0, buffer.Length);
                return(ProcessingResult.SendResponse);
            }
        }
        private void cmsTreeview_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (e.ClickedItem == tsmiRefreshFromPortal)
            {
                var item = tvCodeItems.SelectedNode.Tag;

                if (item == null)
                {
                    return;
                }

                ActionRequested?.Invoke(this, new RefreshContentEventArgs(item));
            }
            else if (e.ClickedItem == tsmiUpdate)
            {
                var item = tvCodeItems.SelectedNode.Tag;

                if (item == null)
                {
                    return;
                }

                var portalItem = item as EditablePortalItem;
                var epi        = portalItem ?? ((CodeItem)item).Parent;

                ActionRequested?.Invoke(this, new UpdatePendingChangesEventArgs(new List <EditablePortalItem> {
                    epi
                }));
            }
            else if (e.ClickedItem == tsmiCreateNewItem)
            {
                var node = tvCodeItems.SelectedNode;
                while (node.Parent != null)
                {
                    node = node.Parent;
                }

                if (tvCodeItems.SelectedNode.Name == "WebTemplate")
                {
                    var dialog = new NewWebTemplateForm(Service, node.Tag as EntityReference);
                    if (dialog.ShowDialog(this) == DialogResult.OK)
                    {
                        var newTemplate = new WebTemplate(dialog.Template);
                        newTemplate.Code.StateChanged += JavaScript_StateChanged;

                        var newNode = new TreeNode(newTemplate.Name)
                        {
                            Tag = newTemplate.Code
                        };
                        newTemplate.Code.Node = newNode;

                        tvCodeItems.SelectedNode.Nodes.Add(newNode);
                        tvCodeItems.Sort();

                        ApplyCounting(node, "WebTemplate");
                    }
                }
                else if (tvCodeItems.SelectedNode.Name == "Html")
                {
                    var dialog = new NewContentSnippetForm(756150001, Service, node.Tag as EntityReference, Languages);
                    if (dialog.ShowDialog(this) == DialogResult.OK)
                    {
                        var newContentSnippet = new ContentSnippet(dialog.Template);
                        newContentSnippet.Code.StateChanged += JavaScript_StateChanged;

                        var newNode = new TreeNode(newContentSnippet.Name)
                        {
                            Tag = newContentSnippet.Code
                        };
                        newContentSnippet.Code.Node = newNode;

                        tvCodeItems.SelectedNode.Nodes.Add(newNode);
                        tvCodeItems.Sort();

                        CountContentSnippet(node);
                    }
                }
                else if (tvCodeItems.SelectedNode.Name == "Text")
                {
                    var dialog = new NewContentSnippetForm(756150000, Service, node.Tag as EntityReference, Languages);
                    if (dialog.ShowDialog(this) == DialogResult.OK)
                    {
                        var newContentSnippet = new ContentSnippet(dialog.Template);
                        newContentSnippet.Code.StateChanged += JavaScript_StateChanged;

                        var newNode = new TreeNode(newContentSnippet.Name)
                        {
                            Tag = newContentSnippet.Code
                        };
                        newContentSnippet.Code.Node = newNode;

                        tvCodeItems.SelectedNode.Nodes.Add(newNode);
                        tvCodeItems.Sort();

                        CountContentSnippet(node);
                    }
                }
            }
        }
예제 #23
0
        public void Register()
        {
            Application.Current.Use(new HtmlFromJsonProvider());
            Application.Current.Use(new PartialToStandaloneHtmlProvider());

            Handle.GET("/WebsiteProvider", () =>
            {
                return("Welcome to WebsiteProvider.");
            });

            Handle.GET("/WebsiteProvider/partial/template/{?}", (string templateId) =>
            {
                var page = new WebTemplatePage
                {
                    Data = GetWebTemplate(templateId)
                };
                InitializeTemplate(page);
                return(page);
            });

            Handle.GET("/WebsiteProvider/partial/layout/{?}", (string templateId) =>
            {
                WrapperPage page;

                if (Session.Current != null)
                {
                    page = Session.Current.Data as WrapperPage;
                    var sessionWebTemplate = page?.WebTemplatePage.Data;

                    if (sessionWebTemplate != null)
                    {
                        var webTemplate = GetWebTemplate(templateId);
                        if (sessionWebTemplate.Equals(webTemplate))
                        {
                            return(page);
                        }
                    }
                }
                else
                {
                    Session.Current = new Session(SessionOptions.PatchVersioning);
                }

                page = new WrapperPage
                {
                    Session = Session.Current
                };

                if (page.Session.PublicViewModel != page)
                {
                    page.Session.PublicViewModel = page;
                }

                return(page);
            });

            Handle.GET("/WebsiteProvider/partial/wrapper?uri={?}&response={?}", (string requestUri, string responseKey) =>
            {
                Response currentResponse = ResponseStorage.Get(responseKey);
                WebUrl webUrl            = this.GetWebUrl(requestUri);
                WebTemplate template     = webUrl?.Template;

                if (template == null)
                {
                    throw new Exception("Default template is missing");
                }

                WrapperPage master = GetLayoutPage(template);
                master.IsFinal     = webUrl.IsFinal || string.IsNullOrEmpty(webUrl.Url);

                if (!template.Equals(master.WebTemplatePage.Data))
                {
                    master.WebTemplatePage = GetTemplatePage(template.GetObjectID());
                }

                UpdateTemplateSections(requestUri, currentResponse, master.WebTemplatePage, webUrl);

                return(master);
            });

            RegisterFilter();
        }
예제 #24
0
        public void DisplayCodeItems(List <EditablePortalItem> items, bool isLegacyPortal)
        {
            IsLegacyPortal = isLegacyPortal;
            portalItems    = items;
            tvCodeItems.Nodes.Clear();
            var rootNodes = new Dictionary <Guid, TreeNode>();

            if (isLegacyPortal)
            {
                rootNodes.Add(Guid.Empty, new TreeNode("(Not website related)"));
            }

            var searchText    = txtSearch.Text.ToLower();
            var filteredItems = items.Where(i => searchText.Length == 0 ||
                                            i.Name.ToLower().Contains(searchText) ||
                                            chkSearchInContent.Checked &&
                                            i.Items.Any(i2 => i2.Content.ToLower().Contains(searchText)))
                                .ToList();

            if (!filteredItems.Any() && searchText.Length > 0)
            {
                txtSearch.BackColor = Color.LightCoral;
                return;
            }

            foreach (var item in filteredItems)
            {
                item.UpdateRequired += Item_UpdateRequired;
                var websiteReference = item.WebsiteReference;

                if (websiteReference == null)
                {
                    continue;
                }

                TreeNode parentNode;
                if (rootNodes.ContainsKey(websiteReference.Id))
                {
                    parentNode = rootNodes[websiteReference.Id];
                }
                else
                {
                    var name     = websiteReference.Id == Guid.Empty ? "(Not website related)" : websiteReference.Name;
                    var rootNode = new TreeNode(name);

                    rootNodes.Add(websiteReference.Id, rootNode);

                    parentNode = rootNode;

                    parentNode.Nodes.Add(new TreeNode("Web Pages")
                    {
                        Name = "WebPage"
                    });

                    if (!IsLegacyPortal)
                    {
                        parentNode.Nodes.Add(new TreeNode("Entity Forms")
                        {
                            Name = "EntityForm"
                        });
                        parentNode.Nodes.Add(new TreeNode("Entity Lists")
                        {
                            Name = "EntityList"
                        });
                        parentNode.Nodes.Add(new TreeNode("Web Forms")
                        {
                            Name = "WebForm"
                        });
                        parentNode.Nodes.Add(new TreeNode("Web Templates")
                        {
                            Name = "WebTemplate"
                        });
                    }

                    parentNode.Nodes.Add(new TreeNode("Web Files")
                    {
                        Name = "WebFile"
                    });
                }

                TreeNode typeNode;

                if (item is WebPage)
                {
                    typeNode = parentNode.Nodes["WebPage"];

                    WebPage page = (WebPage)item;
                    page.JavaScript.StateChanged += JavaScript_StateChanged;
                    page.Style.StateChanged      += JavaScript_StateChanged;

                    TreeNode node;
                    if (page.IsRoot || page.ParentPageId == Guid.Empty)
                    {
                        node = new TreeNode(page.Name)
                        {
                            Tag = item
                        };
                        typeNode.Nodes.Add(node);

                        if (isLegacyPortal)
                        {
                            var scriptNode = new TreeNode("JavaScript")
                            {
                                Tag = page.JavaScript
                            };
                            page.JavaScript.Node = scriptNode;
                            var styleNode = new TreeNode("Style")
                            {
                                Tag = page.Style
                            };
                            page.Style.Node = styleNode;

                            node.Nodes.Add(scriptNode);
                            node.Nodes.Add(styleNode);
                        }
                    }
                    else
                    {
                        var parentPageNode = typeNode.Nodes.Cast <TreeNode>().FirstOrDefault(t => ((WebPage)t.Tag).Id == page.ParentPageId);
                        if (parentPageNode == null)
                        {
                            continue;
                        }

                        node = new TreeNode(page.Language)
                        {
                            Tag = item
                        };

                        var scriptNode = new TreeNode("JavaScript")
                        {
                            Tag = page.JavaScript
                        };
                        page.JavaScript.Node = scriptNode;
                        var styleNode = new TreeNode("Style")
                        {
                            Tag = page.Style
                        };
                        page.Style.Node = styleNode;

                        node.Nodes.Add(scriptNode);
                        node.Nodes.Add(styleNode);

                        parentPageNode.Nodes.Add(node);
                    }
                }
                else if (item is EntityForm)
                {
                    typeNode = parentNode.Nodes["EntityForm"];

                    if (typeNode == null)
                    {
                        typeNode = new TreeNode("Entity Forms")
                        {
                            Name = "EntityForm"
                        };
                        rootNodes[item.WebsiteReference.Id].Nodes.Add(typeNode);
                    }

                    EntityForm form = (EntityForm)item;
                    form.JavaScript.StateChanged += JavaScript_StateChanged;

                    var node = new TreeNode(form.Name)
                    {
                        Tag = form.JavaScript
                    };
                    form.JavaScript.Node = node;

                    typeNode.Nodes.Add(node);
                }
                else if (item is EntityList)
                {
                    typeNode = parentNode.Nodes["EntityList"];

                    if (typeNode == null)
                    {
                        typeNode = new TreeNode("Entity Lists")
                        {
                            Name = "EntityList"
                        };
                        rootNodes[item.WebsiteReference.Id].Nodes.Add(typeNode);
                    }

                    EntityList list = (EntityList)item;
                    list.JavaScript.StateChanged += JavaScript_StateChanged;

                    var node = new TreeNode(list.Name)
                    {
                        Tag = list.JavaScript
                    };
                    list.JavaScript.Node = node;

                    typeNode.Nodes.Add(node);
                }
                else if (item is WebTemplate)
                {
                    typeNode = parentNode.Nodes["WebTemplate"];

                    if (typeNode == null)
                    {
                        typeNode = new TreeNode("Web Templates")
                        {
                            Name = "WebTemplate"
                        };
                        rootNodes[item.WebsiteReference.Id].Nodes.Add(typeNode);
                    }

                    WebTemplate template = (WebTemplate)item;
                    template.Code.StateChanged += JavaScript_StateChanged;

                    var node = new TreeNode(template.Name)
                    {
                        Tag = template.Code
                    };
                    template.Code.Node = node;

                    typeNode.Nodes.Add(node);
                }
                else if (item is WebFile)
                {
                    typeNode = parentNode.Nodes["WebFile"];

                    if (typeNode == null)
                    {
                        typeNode = new TreeNode("Web Files")
                        {
                            Name = "WebFile"
                        };
                        rootNodes[item.WebsiteReference.Id].Nodes.Add(typeNode);
                    }

                    WebFile file = (WebFile)item;
                    file.Code.StateChanged += JavaScript_StateChanged;

                    var node = new TreeNode(file.Name)
                    {
                        Tag = file.Code
                    };
                    file.Code.Node = node;

                    typeNode.Nodes.Add(node);
                }
                else if (item is WebFormStep)
                {
                    typeNode = parentNode.Nodes["WebForm"];

                    if (typeNode == null)
                    {
                        typeNode = new TreeNode("Web Forms")
                        {
                            Name = "WebForm"
                        };
                        rootNodes[item.WebsiteReference.Id].Nodes.Add(typeNode);
                    }

                    WebFormStep wfStep = (WebFormStep)item;
                    wfStep.JavaScript.StateChanged += JavaScript_StateChanged;

                    var node = new TreeNode(wfStep.Name)
                    {
                        Tag = wfStep.JavaScript
                    };
                    wfStep.JavaScript.Node = node;

                    if (wfStep.WebFormReference != null)
                    {
                        TreeNode webFormNode;

                        if (typeNode.Nodes.ContainsKey(wfStep.WebFormReference.Name))
                        {
                            webFormNode = typeNode.Nodes[wfStep.WebFormReference.Name];
                        }
                        else
                        {
                            webFormNode = new TreeNode(wfStep.WebFormReference.Name)
                            {
                                Name = wfStep.WebFormReference.Name
                            };

                            typeNode.Nodes.Add(webFormNode);
                        }

                        webFormNode.Nodes.Add(node);
                    }
                    else
                    {
                        typeNode.Nodes.Add(node);
                    }
                }
                else
                {
                    throw new Exception($"Unsupported portal item type: {item.GetType().Name}");
                }
            }

            foreach (var node in rootNodes.Values)
            {
                ApplyCounting(node, "WebPage");
                ApplyCounting(node, "EntityForm");
                ApplyCounting(node, "EntityList");
                ApplyCounting(node, "WebTemplate");
                ApplyCounting(node, "WebFile");
                ApplyCounting(node, "WebForm");

                tvCodeItems.Nodes.Add(node);
                node.Expand();
            }
        }
예제 #25
0
 protected WrapperPage GetLayoutPage(WebTemplate template)
 {
     return(Self.GET <WrapperPage>("/WebsiteProvider/partial/layout/" + template.GetObjectID()));
 }