public ViewModel(Models.Page page) { // check for admin preview if (Web.Request["preview"] == "adminonly") { // force login if not already if (!Security.IsLoggedIn) { throw new Beweb.ProgrammingErrorException("force login required"); } } else if (!page.GetIsActive()) { if (!Security.IsLoggedIn) { throw new Beweb.BadUrlException("Page not available with ID of [" + page.ID + "]"); } } //page.CheckUserAccess(); // uncomment this if using page user access control TrackingBreadcrumb.Current.AddBreadcrumb(1, page.Title); #if pages ContentPage = page; #endif }
public static void AddPagePhrase(Page page) { // delete any existing phrases DeletePhrase("Page", page.ID); if (page.GetIsActive()) { // save the meta keywords to the autocomplete table AddPhrase("Page", page.ID, page.Title); AddPhrase("Page", page.ID, page.MetaKeywords, true); /* Add and other fields you would like to here */ } else { // clean up any child pages as these are no longer navigatable foreach (var childPage in page.ChildPages) { DeletePhrase("Page", childPage.ID); } } }