private void UpdateFieldsFromObject() { Name.Text = selectedItem.Name; MediaTypeHandler.SetValue(selectedItem.MediaTypeHandler); if (selectedItem.MasterPage != null) { MasterPageSelector.SelectedValue = selectedItem.MasterPage.ID.ToString(); } Label.Text = selectedItem.Label; IsActive.Checked = selectedItem.IsActive; ShowInMenu.Checked = selectedItem.ShowInMenu; ShowInSiteTree.Checked = selectedItem.ShowInSiteTree; ShowInSearchResults.Checked = selectedItem.ShowInSearchResults; EnableCaching.Checked = selectedItem.EnableCaching; MainLayout.Text = selectedItem.MainLayout; SummaryLayout.Text = selectedItem.SummaryLayout; FeaturedLayout.Text = selectedItem.FeaturedLayout; UseMediaTypeLayouts.Checked = selectedItem.UseMediaTypeLayouts; MultiRoleSelector.SetSelectedRoles(selectedItem.GetRoles()); MultiMediaTypeSelector.SetMediaTypes(selectedItem.MediaTypes.ToList()); OnPublishExecuteCode.Text = selectedItem.OnPublishExecuteCode; }
public void UpdateObjectFromFields() { selectedItem.CanLimitedRolesAccessAllChildPages = CanLimitedRolesAccessAllChildPages.Checked; selectedItem.EnforceRoleLimitationsOnFrontEnd = EnforceRoleLimitationOnFrontEnd.Checked; var roles = MultiRoleSelector.GetSelectedRoles(); if (roles == null) { return; } var rolesMedias = selectedItem.Media.RolesMedias.ToList(); foreach (var roleMedia in rolesMedias) { BaseMapper.DeleteObjectFromContext(roleMedia); } foreach (var role in roles) { var contextRole = BaseMapper.GetObjectFromContext(role); var newMediaRole = new RoleMedia() { Media = selectedItem.Media, Role = contextRole, DateCreated = DateTime.Now, DateLastModified = DateTime.Now }; selectedItem.Media.RolesMedias.Add(newMediaRole); } }
private void UpdateObjectFromFields() { selectedItem.Name = Name.Text; selectedItem.MediaTypeHandler = MediaTypeHandler.GetValue().ToString(); if (MasterPageSelector.SelectedValue != "") { selectedItem.MasterPageID = long.Parse(MasterPageSelector.SelectedValue); } else { selectedItem.MasterPage = null; } selectedItem.Label = Label.Text; selectedItem.IsActive = IsActive.Checked; selectedItem.ShowInMenu = ShowInMenu.Checked; selectedItem.ShowInSiteTree = ShowInSiteTree.Checked; selectedItem.ShowInSearchResults = ShowInSearchResults.Checked; selectedItem.EnableCaching = EnableCaching.Checked; selectedItem.AddRoles(MultiRoleSelector.GetSelectedRoles()); selectedItem.AddChildMediaTypes(MultiMediaTypeSelector.GetSelectedMediaTypes()); selectedItem.MainLayout = MediaDetailsMapper.ConvertUrlsToShortCodes(MainLayout.Text); selectedItem.SummaryLayout = MediaDetailsMapper.ConvertUrlsToShortCodes(SummaryLayout.Text); selectedItem.FeaturedLayout = MediaDetailsMapper.ConvertUrlsToShortCodes(FeaturedLayout.Text); selectedItem.UseMediaTypeLayouts = UseMediaTypeLayouts.Checked; selectedItem.OnPublishExecuteCode = OnPublishExecuteCode.Text; }
public void UpdateFieldsFromObject() { CanLimitedRolesAccessAllChildPages.Checked = selectedItem.CanLimitedRolesAccessAllChildPages; EnforceRoleLimitationOnFrontEnd.Checked = selectedItem.EnforceRoleLimitationsOnFrontEnd; if (!IsPostBack) { MultiRoleSelector.SetSelectedRoles(this.selectedItem.Media.RolesMedias.Select(i => i.Role).ToList()); } }