/// <summary> /// Handle the situation where the user didn't select any objects on step 1. Show message to user, move transfer state back to /// previous step, and re-render the page. This function is only relevant when the page requests the user make a selection /// and no selection was made. It is not intended for and in fact throws an exception in situations where the user made a /// selection on a previous page and is then transferred to this page. /// </summary> private void HandleUserNotSelectingAnyObjects() { string msg = String.Format(CultureInfo.CurrentCulture, "<p class='gsp_msgwarning'><span class='gsp_bold'>{0} </span>{1}</p>", Resources.GalleryServerPro.Task_No_Objects_Selected_Hdr, Resources.GalleryServerPro.Task_No_Objects_Selected_Dtl); phMsg.Controls.Clear(); phMsg.Controls.Add(new System.Web.UI.LiteralControl(msg)); if (this.TransObjectState == TransferObjectState.ObjectsCopyStep2) { this._transferState = TransferObjectState.ObjectsCopyStep1; } else if (this.TransObjectState == TransferObjectState.ObjectsMoveStep2) { this._transferState = TransferObjectState.ObjectsMoveStep1; } else { throw new GalleryServerPro.ErrorHandler.CustomExceptions.WebException("The function HandleUserNotSelectingAnyObjects should never be invoked in cases where the user made a selection on a previous page and is then transferred to this page."); } ConfigureControls(); }
/// <summary> /// Handle the situation where the user didn't select any objects on step 1. Show message to user, move transfer state back to /// previous step, and re-render the page. This function is only relevant when the page requests the user make a selection /// and no selection was made. It is not intended for and in fact throws an exception in situations where the user made a /// selection on a previous page and is then transferred to this page. /// </summary> private void HandleUserNotSelectingAnyObjects() { string msg = String.Format(CultureInfo.CurrentCulture, "<p class='gsp_msgwarning'><span class='gsp_bold'>{0} </span>{1}</p>", Resources.GalleryServerPro.Task_No_Objects_Selected_Hdr, Resources.GalleryServerPro.Task_No_Objects_Selected_Dtl); phMsg.Controls.Clear(); phMsg.Controls.Add(new System.Web.UI.LiteralControl(msg)); if (this.TransObjectState == TransferObjectState.ObjectsCopyStep2) { this._transferState = TransferObjectState.ObjectsCopyStep1; } else if (this.TransObjectState == TransferObjectState.ObjectsMoveStep2) { this._transferState = TransferObjectState.ObjectsMoveStep1; } else throw new WebException("The function HandleUserNotSelectingAnyObjects should never be invoked in cases where the user made a selection on a previous page and is then transferred to this page."); ConfigureControls(); }
/// <summary> /// Determine the current state of this page. /// </summary> /// <returns>Returns the current state of this page.</returns> private TransferObjectState GetTransferObjectState() { // Is the album ID specified on the query string? Notice that we check for the presence of the "aid" // parameter instead of checking to see if the value is greater than 0. This is because we might get to // this page from a page showing a virtual album, in which case the aid parameter will be passed as // int.MinValue. bool isAlbumIdSpecified = Util.IsQueryStringParameterPresent("aid"); int mediaObjectId = Util.GetQueryStringParameterInt32("moid"); bool?skipStep1 = Util.GetQueryStringParameterBoolean("skipstep1"); //if (!skipStep1.HasValue) // throw new GalleryServerPro.ErrorHandler.CustomExceptions.UnexpectedQueryStringException(); TransferObjectState transferState = TransferObjectState.None; if ((!Page.IsPostBack) && (isAlbumIdSpecified) && (skipStep1.Value == false)) { // Not postback, must allow user to select objects to copy/move (step 1) if (this.TransType == TransferType.Copy) { transferState = TransferObjectState.ObjectsCopyStep1; } else { transferState = TransferObjectState.ObjectsMoveStep1; } } else if ((!Page.IsPostBack) && (isAlbumIdSpecified) && (this.TransType == TransferType.Move) && (skipStep1.Value == true)) { // Not postback, user selected 'Move album' link. We'll display the treeview to allow the user to select the destination album. transferState = TransferObjectState.AlbumMoveStep2; } else if ((!Page.IsPostBack) && (isAlbumIdSpecified) && (this.TransType == TransferType.Copy) && (skipStep1.Value == true)) { // Not postback, user selected 'Copy album' link. We'll display the treeview to allow the user to select the destination album. transferState = TransferObjectState.AlbumCopyStep2; } else if ((!Page.IsPostBack) && (mediaObjectId > 0)) { // Not postback, user already selected a media object to copy/move from a different web page, // We'll display the treeview to allow the user to select the destination album. if (this.TransType == TransferType.Copy) { transferState = TransferObjectState.MediaObjectCopyStep2; } else { transferState = TransferObjectState.MediaObjectMoveStep2; } } else if ((Page.IsPostBack) && (ViewState["ShowTreeView"] != null) && (ViewState["ShowTreeView"].ToString() == "1")) { // This is a postback where we want to show the treeview control, thus allowing the user to select // the destination album to copy/move the objects to. if (this.TransType == TransferType.Copy) { transferState = TransferObjectState.ObjectsCopyStep2; } else { transferState = TransferObjectState.ObjectsMoveStep2; } } else if ((Page.IsPostBack) && (ViewState["ShowTreeView"] != null) && (ViewState["ShowTreeView"].ToString() == "0")) { // This is a postback where we do not want to show the treeview control, which can only mean the user has // finished selecting the destination album and is ready to transfer the objects. transferState = TransferObjectState.ReadyToTransfer; } return(transferState); }
/// <summary> /// Handle the situation where the user didn't select any objects on step 1. Show message to user, move transfer state back to /// previous step, and re-render the page. This function is only relevant when the page requests the user make a selection /// and no selection was made. It is not intended for and in fact throws an exception in situations where the user made a /// selection on a previous page and is then transferred to this page. /// </summary> private void HandleUserNotSelectingAnyObjects() { ClientMessage = new ClientMessageOptions { Title = Resources.GalleryServerPro.Task_No_Objects_Selected_Hdr, Message = Resources.GalleryServerPro.Task_No_Objects_Selected_Dtl, Style = MessageStyle.Info }; if (this.TransObjectState == TransferObjectState.ObjectsCopyStep2) { this._transferState = TransferObjectState.ObjectsCopyStep1; } else if (this.TransObjectState == TransferObjectState.ObjectsMoveStep2) { this._transferState = TransferObjectState.ObjectsMoveStep1; } else throw new WebException("The function HandleUserNotSelectingAnyObjects should never be invoked in cases where the user made a selection on a previous page and is then transferred to this page."); ConfigureControls(); }