private void CrawlSite(CmsWebDirectory directory, XmlElement urlsetElement) { CmsPageCollection pages = CmsPage.FindByDirectoryID(directory.ID, false); foreach(CmsPage p in pages){ CreateUrlElement(p, urlsetElement); } CmsDirectoryCollection directories = directory.Subdirectories; foreach(CmsWebDirectory d in directories){ CrawlSite(d, urlsetElement); } }
protected void ButtonAddDirectory_OnClick(object sender, EventArgs e) { CmsWebDirectory d = new CmsWebDirectory(); DataBindingManagerDirectory.DataSource = d; DataBindingManagerDirectory.PullData(); d.ParentID = DirectoryID; CmsWebDirectory pd = CmsWebDirectory.FindByID(DirectoryID); d.SortOrder = pd.Files.Count; d.Insert(); Response.Redirect(d.FileType.EditUrl + "?FileID=" + d.ID); }
public void ButtonGenerateSitemap_OnClick(object sender, System.EventArgs e) { host = CmsHostHeaderMapping.FindByID(new Guid(DropDownListHostHeader.SelectedValue)); CmsSite site = CmsSite.FindByID(host.CmsSiteID); rootDirectory = CmsWebDirectory.FindByID( site.RootWebDirectoryID ); XmlDocument doc = new XmlDocument(); XmlElement urlsetElement = doc.CreateElement("urlset", "http://www.google.com/schemas/sitemap/0.84"); doc.AppendChild(urlsetElement); CrawlSite(rootDirectory, urlsetElement); Response.Clear(); Response.ContentType = "text/xml"; Response.AddHeader("Content-Disposition","attachment; filename=Sitemap1.xml"); Response.ContentEncoding = System.Text.Encoding.UTF8; doc.Save(Response.Output); Response.End(); }
protected void Page_Load(object sender, System.EventArgs e) { if(!IsPostBack){ if (Request["FileID"] != null && !Guid.Empty.Equals(Request["FileID"])) { CurrentDirectory = CmsWebDirectory.FindByID(Request["FileID"]); } else { CurrentDirectory = CmsContext.Current.RootDirectory; } string sortExpression = (string)XenosynthContext.Current.Configuration.GetValue("Xenosynth.Modules.Cms.Directory.SortExpression", false); if (sortExpression == null) { sortExpression = "SortOrder"; } DataGridAdapterFiles.SortExpression = sortExpression; BindDataGridFiles(); } //Rebind rather than use viewstate //BindDataGridFiles(); }