private void SaveSettings() { UnbindViewMode(); UnbindDefaultGalleryObject(); UnbindBehaviorSettings(); if (!UnbindError) { GalleryControlSettingsUpdateable.Save(); Factory.ClearGalleryControlSettingsCache(); // Since we are changing settings that affect how and which controls are rendered to the page, let us redirect to the current page and // show the save success message. If we simply show a message without redirecting, two things happen: (1) the user doesn't see the effect // of their change until the next page load, (2) there is the potential for a viewstate validation error const MessageType msg = MessageType.SettingsSuccessfullyChanged; Utils.Redirect(PageId.admin_gallerycontrolsettings, "aid={0}&msg={1}", GetAlbumId(), ((int)msg).ToString(CultureInfo.InvariantCulture)); } }
private void DetectAndSaveChangedGallery() { int galleryId = Convert.ToInt32(ddlCurrentGallery.SelectedValue, CultureInfo.InvariantCulture); if (GalleryId != galleryId) { // User wants to change the current gallery. First verify gallery exists and the user has permission, then update. IGallery gallery; try { gallery = Factory.LoadGallery(galleryId); } catch (InvalidGalleryException) { // Not a valid gallery. Set message and return. ClientMessage = new ClientMessageOptions { Title = Resources.GalleryServer.Validation_Summary_Text, Message = "Invalid gallery.", Style = MessageStyle.Error }; return; } if (UserController.GetGalleriesCurrentUserCanAdminister().Contains(gallery)) { GalleryControlSettingsUpdateable.GalleryId = galleryId; GalleryControlSettingsUpdateable.AlbumId = null; GalleryControlSettingsUpdateable.MediaObjectId = null; GalleryControlSettingsUpdateable.Save(); Factory.ClearGalleryControlSettingsCache(); // Since we are changing galleries, we need to perform a redirect to get rid of the album ID from the old gallery that // is sitting in the query string. const MessageType msg = MessageType.GallerySuccessfullyChanged; Utils.Redirect(PageId.admin_galleries, "msg={0}", ((int)msg).ToString(CultureInfo.InvariantCulture)); } else { // User does not have permission to change to this gallery. Set message and return. ClientMessage = new ClientMessageOptions { Title = Resources.GalleryServer.Validation_Summary_Text, Message = "Invalid gallery.", Style = MessageStyle.Error }; } } else { ClientMessage = new ClientMessageOptions { Title = Resources.GalleryServer.Validation_Summary_Text, Message = Resources.GalleryServer.Admin_Gallery_Settings_Different_Gallery_Not_Selected_Text, Style = MessageStyle.Info }; } }