示例#1
0
        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);
            }
        }
示例#2
0
        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);
        }
示例#3
0
        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();
        }
示例#4
0
        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();
        }