private void ConfigureControls() { this.TaskHeaderText = Resources.GalleryServerPro.Task_Rotate_Image_Header_Text; this.TaskBodyText = Resources.GalleryServerPro.Task_Rotate_Image_Body_Text; this.OkButtonText = Resources.GalleryServerPro.Task_Rotate_Image_Ok_Button_Text; this.OkButtonToolTip = Resources.GalleryServerPro.Task_Rotate_Image_Ok_Button_Tooltip; this.PageTitle = Resources.GalleryServerPro.Task_Rotate_Image_Page_Title; IGalleryObjectCollection images = new GalleryObjectCollection(); IGalleryObject image = this.GetMediaObject(); if (image is GalleryServerPro.Business.Image) { images.Add(image); rptr.DataSource = images; rptr.DataBind(); } else { Util.Redirect(Web.PageId.mediaobject, "moid={0}&msg={1}", image.Id, ((int)Message.CannotRotateObjectNotRotatable).ToString(CultureInfo.InvariantCulture)); } }
private void BindData() { //Get the data associated with the album and display if (this.GalleryObjectsDataSource == null) { // Sueetie Modified - Retrieve Recent Photos if (DataHelper.GetIntFromQueryString("aid", 1) == -1) { List <SueetieMediaObject> sueetieMediaObjects = SueetieMedia.GetSueetieMediaObjectList(this.GalleryPage.CurrentSueetieGalleryID, true); sueetieMediaObjects.Sort(delegate(SueetieMediaObject x, SueetieMediaObject y) { return(DateTime.Compare(y.DateAdded, x.DateAdded)); }); int _photoCount = SueetieConfiguration.Get().Media.RecentPhotoCount; if (_photoCount > sueetieMediaObjects.Count) { _photoCount = sueetieMediaObjects.Count; } IGalleryObjectCollection _galleryObjects = new GalleryObjectCollection(); for (int i = 0; i < _photoCount; i++) { IGalleryObject _galleryObject = Factory.LoadMediaObjectInstance(sueetieMediaObjects[i].MediaObjectID); _galleryObjects.Add(_galleryObject); } _galleryObjects.Sort(); DisplayThumbnails(_galleryObjects, true); } else { DisplayThumbnails(this.GalleryPage.GetAlbum().GetChildGalleryObjects(true, this.GalleryPage.IsAnonymousUser), true); } } else { DisplayThumbnails(this.GalleryObjectsDataSource, false); } }
/// <summary> /// Move or copy the objects. An exception is thrown if the user does not have the required permission or is /// trying to transfer an object to itself. /// </summary> /// <exception cref="GalleryServerPro.ErrorHandler.CustomExceptions.GallerySecurityException">Thrown when the logged on /// user does not belong to a role that authorizes the moving or copying.</exception> /// <exception cref="GalleryServerPro.ErrorHandler.CustomExceptions.CannotTransferAlbumToNestedDirectoryException"> /// Thrown when the user tries to move or copy an album to one of its children albums.</exception> private void TransferObjects() { #region Get list of objects to move or copy string[] galleryObjectIds = (string[])ViewState["ids"]; // Convert the string array of IDs to integers. Also assign whether each is an album or media object. // (Determined by the first character of each ids string: a=album; m=media object) int id; char idType; IGalleryObjectCollection objectsToMoveOrCopy = new GalleryObjectCollection(); for (int i = 0; i < galleryObjectIds.Length; i++) { id = Convert.ToInt32(galleryObjectIds[i].Substring(1), CultureInfo.InvariantCulture); idType = Convert.ToChar(galleryObjectIds[i].Substring(0, 1), CultureInfo.InvariantCulture); if (idType == 'a') { objectsToMoveOrCopy.Add(Factory.LoadAlbumInstance(id, false)); } else if (idType == 'm') { // Grab a reference to the media object through the base page's album instead of using Factory.LoadMediaObjectInstance(). // This causes the base page's album object to have an accurate state of the child objects so that when we assign the // thumbnail object later in this page life cycle, it works correctly. objectsToMoveOrCopy.Add(this.GetAlbum().GetChildGalleryObjects(GalleryObjectType.MediaObject).FindById(id, GalleryObjectType.MediaObject)); } else { throw new GalleryServerPro.ErrorHandler.CustomExceptions.WebException("Invalid object identifier in method transferObjects(). Expected: 'a' or 'm'. Found: " + idType.ToString()); } } #endregion #region Validate (throws exception if it doesn't validate) ValidateObjectsCanBeMovedOrCopied(objectsToMoveOrCopy); #endregion try { HelperFunctions.BeginTransaction(); #region Move or copy each object foreach (IGalleryObject galleryObject in objectsToMoveOrCopy) { IAlbum album = galleryObject as IAlbum; if (album == null) { if (this.TransType == TransferType.Move) { MoveMediaObject(galleryObject); } else { CopyMediaObject(galleryObject); } } else { if (this.TransType == TransferType.Move) { MoveAlbum(album); } else { CopyAlbum(album); } } } #endregion HelperFunctions.CommitTransaction(); } catch { HelperFunctions.RollbackTransaction(); throw; } }