예제 #1
0
        protected void DoDataBind()
        {
            List<SiteNav> lstNav = null;

            using (SiteNavHelper navHelper = new SiteNavHelper()) {
                lstNav = navHelper.GetChildNavigation(SiteData.CurrentSiteID, guidContentID, !SecurityData.IsAuthEditor);
            }

            if (bClickedSort && ddlAlternateSort.SelectedIndex > 0) {
                switch (ddlAlternateSort.SelectedValue) {
                    case "alpha":
                        lstNav = lstNav.OrderBy(x => x.NavMenuText).ToList();
                        break;

                    case "datecreated":
                        lstNav = lstNav.OrderBy(x => x.CreateDate).ToList();
                        break;

                    case "dateupdated":
                        lstNav = lstNav.OrderBy(x => x.EditDate).ToList();
                        break;

                    case "alpha2":
                        lstNav = lstNav.OrderByDescending(x => x.NavMenuText).ToList();
                        break;

                    case "datecreated2":
                        lstNav = lstNav.OrderByDescending(x => x.CreateDate).ToList();
                        break;

                    case "dateupdated2":
                        lstNav = lstNav.OrderByDescending(x => x.EditDate).ToList();
                        break;

                    default:
                        lstNav = lstNav.OrderBy(x => x.NavOrder).ToList();
                        break;
                }
            }

            lstNav.ToList().ForEach(q => CMSConfigHelper.IdentifyLinkAsInactive(q));

            GeneralUtilities.BindRepeater(rpPages, lstNav);

            if (lstNav.Count < 2) {
                btnSave.Visible = false;
            }
        }
        public void SortChildren()
        {
            List<SiteNav> lstNav = null;
            using (SiteNavHelper navHelper = new SiteNavHelper()) {
                lstNav = navHelper.GetChildNavigation(SiteData.CurrentSiteID, this.Root_ContentID, !SecurityData.IsAuthEditor);
            }

            if (!String.IsNullOrEmpty(this.SelectedSort)) {
                switch (this.SelectedSort) {
                    case "alpha":
                        lstNav = lstNav.OrderBy(x => x.NavMenuText).ToList();
                        break;

                    case "datecreated":
                        lstNav = lstNav.OrderBy(x => x.CreateDate).ToList();
                        break;

                    case "dateupdated":
                        lstNav = lstNav.OrderBy(x => x.EditDate).ToList();
                        break;

                    case "alpha2":
                        lstNav = lstNav.OrderByDescending(x => x.NavMenuText).ToList();
                        break;

                    case "datecreated2":
                        lstNav = lstNav.OrderByDescending(x => x.CreateDate).ToList();
                        break;

                    case "dateupdated2":
                        lstNav = lstNav.OrderByDescending(x => x.EditDate).ToList();
                        break;

                    default:
                        lstNav = lstNav.OrderBy(x => x.NavOrder).ToList();
                        break;
                }
            }

            lstNav.ToList().ForEach(q => CMSConfigHelper.IdentifyLinkAsInactive(q));

            this.Pages = lstNav;
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (SiteNavHelper navHelper = new SiteNavHelper()) {

                string sCurrentPage = SiteData.CurrentScriptName;
                string sScrubbedURL = SiteData.AlternateCurrentScriptName;

                if (sScrubbedURL.ToLower() != sCurrentPage.ToLower()) {
                    sCurrentPage = sScrubbedURL;
                }

                ContentPage currentPage = pageHelper.FindByFilename(SiteData.CurrentSiteID, sCurrentPage);

                if (currentPage == null && SiteData.IsPageReal) {
                    IsPageTemplate = true;
                }

                if ((SiteData.IsPageSampler || IsPageTemplate) && currentPage == null) {
                    currentPage = ContentPageHelper.GetSamplerView();
                }

                litVersion.Text = SiteData.CarrotCakeCMSVersion;
                litRelease.Text = currentPage.GoLiveDate.ToString();
                litRetire.Text = currentPage.RetireDate.ToString();
                litTemplate.Text = currentPage.TemplateFile;

                CurrentPageID = currentPage.Root_ContentID;
                lnkCurrent.HRef = SiteData.CurrentScriptName;

                EditPageURL = SiteFilename.PageAddEditURL;
                PageIndexURL = SiteFilename.PageIndexURL;

                if (currentPage.ContentType == ContentPageType.PageType.BlogEntry) {
                    EditPageURL = SiteFilename.BlogPostAddEditURL;
                    PageIndexURL = SiteFilename.BlogPostIndexURL;
                }

                if (!IsPostBack) {
                    List<SiteNav> nav = navHelper.GetChildNavigation(SiteData.CurrentSiteID, CurrentPageID, !SecurityData.IsAuthEditor);

                    SiteNav pageContents2 = navHelper.GetParentPageNavigation(SiteData.CurrentSiteID, CurrentPageID);
                    if (pageContents2 != null) {
                        pageContents2.NavMenuText = "Parent: " + pageContents2.NavMenuText;
                        pageContents2.NavOrder = -110;
                        lnkParent.Visible = true;
                        lnkParent.HRef = pageContents2.FileName;
                    } else {
                        lnkParent.Visible = false;
                    }

                    ContentPage homePage = pageHelper.FindHome(SiteData.CurrentSiteID);

                    List<SiteNav> lstNavTop = null;
                    if (homePage != null && homePage.Root_ContentID == CurrentPageID) {
                        lstNavTop = (from n in navHelper.GetTopNavigation(SiteData.CurrentSiteID, !SecurityData.IsAuthEditor)
                                     where n.Root_ContentID != CurrentPageID
                                     orderby n.NavOrder
                                     select new SiteNav {
                                         NavOrder = n.NavOrder,
                                         FileName = n.FileName,
                                         NavMenuText = (n.NavOrder > 0 ? "  -- " : "") + n.FileName + "  [[" + (n.PageActive ? "" : "{*U*}  ") + n.NavMenuText + "]]",
                                         PageActive = n.PageActive,
                                         ContentID = n.ContentID,
                                         Root_ContentID = n.Root_ContentID,
                                         PageHead = n.PageHead,
                                         SiteID = n.SiteID
                                     }).ToList();
                    }

                    List<SiteNav> lstNav = (from n in nav
                                            orderby n.NavOrder
                                            select new SiteNav {
                                                NavOrder = n.NavOrder,
                                                FileName = n.FileName,
                                                NavMenuText = (n.NavOrder > 0 ? "  -- " : "") + n.FileName + "  [[" + (n.PageActive ? "" : "{*U*}  ") + n.NavMenuText + "]]",
                                                PageActive = n.PageActive,
                                                ContentID = n.ContentID,
                                                Root_ContentID = n.Root_ContentID,
                                                PageHead = n.PageHead,
                                                SiteID = n.SiteID
                                            }).ToList();

                    if (lstNavTop != null) {
                        lstNav = lstNavTop.Union(lstNav).ToList();
                    }

                    GeneralUtilities.BindListDefaultText(ddlCMSLinks, lstNav, null, "Navigate", "00000");

                    if (lstNav.Count < 1) {
                        ddlCMSLinks.Visible = false;
                        lblChildDDL.Visible = false;
                    }
                }
            }
        }