public void OrderChange(string newLayout, string contextKey) { LayoutContextKey key = UtilHelper.JsonDeserialize <LayoutContextKey>(contextKey); if (!key.IsAdmin) { key.ProfileId = null; key.UserId = Mediachase.IBN.Business.Security.CurrentUser.UserID; } CustomPageEntity page = CustomPageManager.GetCustomPage(key.PageUid, key.ProfileId, key.UserId); if (page == null) { throw new ArgumentException(String.Format("Cant read setting for page: {0}", key.PageUid)); } if (!(key.IsAdmin || Mediachase.Ibn.Business.Customization.ProfileManager.CheckPersonalization())) { UserLightPropertyCollection pc = Mediachase.IBN.Business.Security.CurrentUser.Properties; pc["userCollapseExpand_" + key.PageUid.ToString("N")] = newLayout; } else { CustomPageManager.UpdateCustomPage(key.PageUid, newLayout, page.TemplateId, key.ProfileId, key.UserId); } }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Init"></see> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs"></see> object that contains the event data.</param> protected override void OnInit(EventArgs e) { base.OnInit(e); string valueData = string.Empty; string valueTemplate = string.Empty; CustomPageEntity page = null; if (!this.IsAdmin) { page = CustomPageManager.GetCustomPage(PageUid, null, (PrimaryKeyId)Mediachase.IBN.Business.Security.CurrentUser.UserID); } else { page = CustomPageManager.GetCustomPage(PageUid, ProfileId, UserId); // CHelper.AddToContext("pageUid", this.PageUid); } cpManager.DataSource = page.TemplateId.ToString(); cpManager.PageUid = this.PageUid; cpManagerExtender.PageUid = this.PageUid; cpManagerExtender.IsAdmin = this.IsAdmin; LayoutContextKey key = new LayoutContextKey(this.PageUid, this.IsAdmin); if (IsAdmin) { key.ProfileId = ProfileId; key.UserId = UserId; } cpManagerExtender.ContextKey = key; cpManager.IsAdmin = this.IsAdmin; if (!IsPostBack) { cpManager.DataBind(); } }
public void Delete(string newLayout, string contextKey) { //ToDo: Clear ControlProperties collection for deleted node (do it in provider) LayoutContextKey key = UtilHelper.JsonDeserialize <LayoutContextKey>(contextKey); if (!key.IsAdmin) { key.ProfileId = null; key.UserId = Mediachase.IBN.Business.Security.CurrentUser.UserID; } CustomPageEntity page = CustomPageManager.GetCustomPage(key.PageUid, key.ProfileId, key.UserId); if (page == null) { throw new ArgumentException(String.Format("Cant read setting for page: {0}", key.PageUid)); } if (!key.IsAdmin) { List <CpInfo> list = UtilHelper.JsonDeserialize <List <CpInfo> >(page.JsonData); foreach (CpInfo item in list) { foreach (CpInfoItem internalItem in item.Items) { if (!newLayout.Contains(internalItem.InstanseUid)) { //ToDo: make method to get "wrapControl{0}_{1}" ControlProperties.Provider.DeleteValue(String.Format("wrapControl{0}_{1}", internalItem.Id.ToLower().Replace("-", ""), internalItem.InstanseUid)); } } } } CustomPageManager.UpdateCustomPage(key.PageUid, newLayout, page.TemplateId, key.ProfileId, key.UserId); }