protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Check Security ListInfo li = ListManager.GetListInfoByMetaClassName(ClassName); PrimaryKeyId listId = li.PrimaryKeyId.Value; if (!Mediachase.IBN.Business.ListInfoBus.CanRead((int)listId)) { throw new AccessDeniedException(); } } if (!String.IsNullOrEmpty(HistoryClassName)) { gridHistory.DoPadding = false; gridHistory.ShowCheckBoxes = false; gridHistory.ClassName = HistoryClassName; gridHistory.PlaceName = _placeName; string profileName = CHelper.GetHistorySystemListViewProfile(HistoryClassName, _placeName); gridHistory.ProfileName = profileName; CHelper.AddToContext("HistoryClassName", HistoryClassName); gridHistory.DataBind(); } }
protected void SaveButton_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(ClassName)) { MetaClass mc = MetaDataWrapper.GetMetaClassByName(ClassName); HistoryMetaClassInfo historyInfo = HistoryManager.GetInfo(mc); historyInfo.SelectedFields.Add(FieldList.SelectedValue); HistoryManager.SetInfo(mc, historyInfo); ListViewProfile[] mas = ListViewProfile.GetSystemProfiles(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList"); if (mas.Length == 0) { CHelper.GetHistorySystemListViewProfile(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList"); mas = ListViewProfile.GetSystemProfiles(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList"); } if (!mas[0].FieldSet.Contains(FieldList.SelectedValue)) { mas[0].FieldSet.Add(FieldList.SelectedValue); mas[0].ColumnsUI.Add(new ColumnProperties(FieldList.SelectedValue, "150px", String.Empty)); ListViewProfile.SaveSystemProfile(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList", Mediachase.IBN.Business.Security.CurrentUser.UserID, mas[0]); } CommandParameters cp = new CommandParameters(CommandName); Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString()); //CHelper.UpdateModalPopupContainer(this, ContainerId); //CHelper.RequireDataBind(); } }
private void BindBlockHeader() { // Check, that there are fields left MetaClass mc = MetaDataWrapper.GetMetaClassByName(ClassName); HistoryMetaClassInfo historyInfo = HistoryManager.GetInfo(mc); Collection <string> selectedFields = historyInfo.SelectedFields; bool fieldsExist = false; foreach (MetaField mf in mc.Fields) { if (HistoryManager.IsSupportedField(mf) && !selectedFields.Contains(mf.Name)) { fieldsExist = true; break; } } CommandManager cm = CommandManager.GetCurrent(this.Page); CommandParameters cp; if (fieldsExist) { string id = String.Empty; ListViewProfile[] mas = ListViewProfile.GetSystemProfiles(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList"); if (mas.Length == 0) { id = CHelper.GetHistorySystemListViewProfile(HistoryManager.GetHistoryMetaClassName(ClassName), "ItemHistoryList"); } else { id = mas[0].Id; } cp = new CommandParameters("MC_ListApp_HistoryProfileEdit"); cp.CommandArguments = new Dictionary <string, string>(); cp.AddCommandArgument("ClassName", HistoryManager.GetHistoryMetaClassName(ClassName)); cp.AddCommandArgument("uid", id); string cmd = cm.AddCommand("", "", "ListInfoView", cp); MainBlockHeader.AddRightLink( GetGlobalResourceObject("IbnFramework.ListInfo", "HistoryView").ToString(), String.Format("javascript:{{{0}}};", cmd)); cp = new CommandParameters("MC_ListApp_AddHistoryFieldFrame", new Dictionary <string, string>()); cp.AddCommandArgument("ClassName", ClassName); string command = cm.AddCommand("", "", "ListInfoView", cp); MainBlockHeader.AddRightLink( GetGlobalResourceObject("IbnFramework.ListInfo", "AddField").ToString(), String.Format("javascript:{{{0}}};", command)); } }