OverrideKey() public method

public OverrideKey ( System.Guid guidContentID ) : void
guidContentID System.Guid
return void
Exemplo n.º 1
0
        public List <ContentCategory> GetPageCategories(int takeTop)
        {
            if (takeTop < 0)
            {
                takeTop = 300000;
            }

            if (SecurityData.AdvancedEditMode && !this.IsPageLocked)
            {
                using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                    cmsHelper.OverrideKey(this.ThePage.FileName);
                    if (cmsHelper.cmsAdminContent != null)
                    {
                        return(cmsHelper.cmsAdminContent.ContentCategories.Take(takeTop).ToList());
                    }
                }
            }
            else
            {
                using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                    return(navHelper.GetCategoryListForPost(this.TheSite.SiteID, takeTop, this.ThePage.Root_ContentID));
                }
            }
            return(new List <ContentCategory>());
        }
Exemplo n.º 2
0
        public static PagePayload GetContent(string uri)
        {
            PagePayload page = new PagePayload();

            if (SecurityData.AdvancedEditMode)
            {
                using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                    cmsHelper.OverrideKey(uri);

                    if (cmsHelper.cmsAdminContent == null)
                    {
                        page.ThePage = SiteData.GetPage(uri);

                        if (!page.ThePage.IsPageLocked)
                        {
                            if (page.ThePage.ContentType == ContentPageType.PageType.BlogEntry)
                            {
                                var c = page.ThePage.ContentCategories;
                                var t = page.ThePage.ContentTags;
                            }

                            cmsHelper.cmsAdminContent = page.ThePage;
                        }
                        else
                        {
                            cmsHelper.cmsAdminContent = null;
                        }
                    }
                    else
                    {
                        page.ThePage = cmsHelper.cmsAdminContent;
                        if (page.IsPageLocked)
                        {
                            cmsHelper.cmsAdminContent = null;
                            page.ThePage = SiteData.GetPage(uri);
                        }
                    }
                }
            }
            else
            {
                page.ThePage = SiteData.GetPage(uri);
            }

            page.Load();

            return(page);
        }
Exemplo n.º 3
0
        public void Save()
        {
            using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                Widget ww = null;

                if (this.Root_ContentID.HasValue) {
                    cmsHelper.OverrideKey(this.Root_ContentID.Value);
                    this.Widgets = cmsHelper.cmsAdminWidget;

                    ww = (from w in this.Widgets
                          where w.Root_WidgetID == this.Root_WidgetID
                          select w).FirstOrDefault();
                } else {
                    using (WidgetHelper widgetHelper = new WidgetHelper()) {
                        ww = widgetHelper.Get(this.Root_WidgetID);
                    }
                }

                if (ww != null) {
                    ww.IsPendingChange = true;
                    ww.IsWidgetActive = this.Widget.IsWidgetActive;
                    ww.IsWidgetPendingDelete = this.Widget.IsWidgetPendingDelete;

                    ww.EditDate = SiteData.CurrentSite.Now;
                    ww.GoLiveDate = this.Widget.GoLiveDate;
                    ww.RetireDate = this.Widget.RetireDate;

                    if (this.Root_ContentID.HasValue) {
                        this.Widgets.RemoveAll(x => x.Root_WidgetID == this.Root_WidgetID);
                        this.Widgets.Add(ww);
                        cmsHelper.cmsAdminWidget = this.Widgets.OrderBy(x => x.WidgetOrder).ToList();
                    } else {
                        ww.Save();
                    }
                }
            }
        }
Exemplo n.º 4
0
		public static PagePayload GetContent(string uri) {
			PagePayload page = new PagePayload();

			if (SecurityData.AdvancedEditMode) {
				using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
					cmsHelper.OverrideKey(uri);

					if (cmsHelper.cmsAdminContent == null) {
						page.ThePage = SiteData.GetPage(uri);

						if (!page.ThePage.IsPageLocked) {
							if (page.ThePage.ContentType == ContentPageType.PageType.BlogEntry) {
								var c = page.ThePage.ContentCategories;
								var t = page.ThePage.ContentTags;
							}

							cmsHelper.cmsAdminContent = page.ThePage;
						} else {
							cmsHelper.cmsAdminContent = null;
						}
					} else {
						page.ThePage = cmsHelper.cmsAdminContent;
						if (page.IsPageLocked) {
							cmsHelper.cmsAdminContent = null;
							page.ThePage = SiteData.GetPage(uri);
						}
					}
				}
			} else {
				page.ThePage = SiteData.GetPage(uri);
			}

			page.Load();

			return page;
		}
		protected void LoadData() {
			if (this.Root_ContentID.HasValue) {
				using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
					cmsHelper.OverrideKey(this.Root_ContentID.Value);
					this.Widgets = cmsHelper.cmsAdminWidget;
					this.CachedWidget = true;

					if (this.Widget == null) {
						this.Widget = (from w in this.Widgets
									   where w.Root_WidgetID == this.Root_WidgetID
									   select w).FirstOrDefault();
					}
				}
			} else {
				using (WidgetHelper widgetHelper = new WidgetHelper()) {
					if (this.Widget == null) {
						this.Widget = widgetHelper.Get(this.Root_WidgetID);
						this.Root_ContentID = this.Widget.Root_ContentID;
					}
				}
			}

			GetCtrlName();
		}
Exemplo n.º 6
0
		public List<ContentCategory> GetPageCategories(int takeTop) {
			if (takeTop < 0) {
				takeTop = 300000;
			}

			if (SecurityData.AdvancedEditMode && !this.IsPageLocked) {
				using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
					cmsHelper.OverrideKey(this.ThePage.FileName);
					if (cmsHelper.cmsAdminContent != null) {
						return cmsHelper.cmsAdminContent.ContentCategories.Take(takeTop).ToList();
					}
				}
			} else {
				using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
					return navHelper.GetCategoryListForPost(this.TheSite.SiteID, takeTop, this.ThePage.Root_ContentID);
				}
			}
			return new List<ContentCategory>();
		}
		public void Save() {
			this.CopyCount = 0;
			if (this.Widgets != null) {
				List<Guid> lstSel = this.Widgets.Where(x => x.Selected).Select(x => x.Root_WidgetID).ToList();

				using (ContentPageHelper pageHelper = new ContentPageHelper()) {
					this.SelectedPage = pageHelper.FindContentByID(SiteData.CurrentSiteID, this.SelectedItem);
					this.Widgets = this.SelectedPage.GetWidgetList();
				}

				using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
					cmsHelper.OverrideKey(this.Root_ContentID);

					if (cmsHelper.cmsAdminWidget != null) {
						List<Widget> cacheWidget = cmsHelper.cmsAdminWidget;

						List<Widget> ww = (from w in this.SelectedPage.GetWidgetList()
										   where lstSel.Contains(w.Root_WidgetID) && w.IsLatestVersion == true
										   select w).ToList();

						if (ww != null) {
							this.CopyCount = ww.Count;

							foreach (var w in ww) {
								Guid newWidget = Guid.NewGuid();

								Widget wCpy = new Widget {
									Root_ContentID = this.Root_ContentID,
									Root_WidgetID = newWidget,
									WidgetDataID = Guid.NewGuid(),
									PlaceholderName = this.PlaceholderName,
									ControlPath = w.ControlPath,
									ControlProperties = w.ControlProperties,
									IsLatestVersion = true,
									IsPendingChange = true,
									IsWidgetActive = true,
									IsWidgetPendingDelete = false,
									WidgetOrder = w.WidgetOrder,
									GoLiveDate = w.GoLiveDate,
									RetireDate = w.RetireDate,
									EditDate = SiteData.CurrentSite.Now
								};

								cacheWidget.Add(wCpy);
							}
						}

						cmsHelper.cmsAdminWidget = cacheWidget;
					}
				}
			}
		}
		public void SaveTextWidgets() {
			if (this.ContentPage != null && this.ContentPage.Root_ContentID != Guid.Empty) {
				using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
					cmsHelper.OverrideKey(this.ContentPage.Root_ContentID);

					if (cmsHelper.cmsAdminWidget != null) {
						var ww = (from w in cmsHelper.cmsAdminWidget
								  where w.IsLatestVersion == true
								  && w.IsPendingChange == true
								  && (w.ControlPath.StartsWith("CLASS:Carrotware.CMS.UI.Components.ContentRichText,")
										|| w.ControlPath.StartsWith("CLASS:Carrotware.CMS.UI.Components.ContentPlainText,"))
								  select w);

						foreach (Widget w in ww) {
							w.Save();
						}
					}

					cmsHelper.cmsAdminContent = null;
					cmsHelper.cmsAdminWidget = null;
				}
			}
		}
		public void RefreshWidgetList() {
			this.WidgetListHtml = new List<Widget>();
			this.WidgetListText = new List<Widget>();

			if (this.ContentPage != null && this.ContentPage.Root_ContentID != Guid.Empty) {
				using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
					cmsHelper.OverrideKey(this.ContentPage.Root_ContentID);

					this.WidgetListHtml = (from w in cmsHelper.cmsAdminWidget
										   where w.IsLatestVersion == true
										   && w.ControlPath.StartsWith("CLASS:Carrotware.CMS.UI.Components.ContentRichText,")
										   select w).ToList();

					this.WidgetListText = (from w in cmsHelper.cmsAdminWidget
										   where w.IsLatestVersion == true
										   && w.ControlPath.StartsWith("CLASS:Carrotware.CMS.UI.Components.ContentPlainText,")
										   select w).ToList();
				}
			}
		}
 protected void OverrideCache(ContentPage pageContents)
 {
     using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
         cmsHelper.OverrideKey(pageContents.Root_ContentID);
         cmsHelper.cmsAdminContent = pageContents;
         cmsHelper.cmsAdminWidget = pageContents.GetWidgetList();
     }
 }