Ejemplo n.º 1
0
		public WidgetListModel(Guid guidContentID) {
			this.Root_ContentID = guidContentID;
			this.PlaceholderName = String.Empty;

			using (WidgetHelper widgetHelper = new WidgetHelper()) {
				this.Controls = widgetHelper.GetWidgets(guidContentID, false);
			}
		}
		public bool Remove() {
			using (WidgetHelper widgetHelper = new WidgetHelper()) {
				List<Guid> lstDel = this.History.DataSource.Where(x => x.Selected).Select(x => x.WidgetDataID).ToList();

				if (lstDel.Any()) {
					widgetHelper.RemoveVersions(lstDel);
					return true;
				}
			}

			return false;
		}
		public WidgetHistoryModel(Guid widgetid)
			: this() {
			this.Root_WidgetID = widgetid;

			using (WidgetHelper widgetHelper = new WidgetHelper()) {
				if (this.Widget == null) {
					this.History.DataSource = widgetHelper.GetWidgetVersionHistory(widgetid);
					this.Widget = this.History.DataSource.Where(x => x.IsLatestVersion == true).FirstOrDefault();

					this.Root_ContentID = this.Widget.Root_ContentID;
				}
			}

			GetCtrlName();
		}
Ejemplo n.º 4
0
		public void Save() {
			using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
				Widget ww = null;

				if (this.CachedWidget) {
					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.CachedWidget) {
						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();
					}
				}
			}
		}
Ejemplo n.º 5
0
        public static List<Widget> GetCurrentPageLiveWidgets(Guid guidContentID)
        {
            List<Widget> pageWidgets = new List<Widget>();

            using (WidgetHelper widgetHelper = new WidgetHelper()) {
                pageWidgets = widgetHelper.GetWidgets(guidContentID, !SecurityData.AdvancedEditMode);
            }

            return pageWidgets;
        }
Ejemplo n.º 6
0
		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();
		}
Ejemplo n.º 7
0
        public List<Widget> GetWidgetList()
        {
            List<Widget> widgets = null;

            using (WidgetHelper pwh = new WidgetHelper()) {
                widgets = pwh.GetWidgets(this.Root_ContentID, false);
            }

            return widgets;
        }