Пример #1
0
        private void ConfigureControlsFirstTime()
        {
            AdminPageTitle = Resources.GalleryServerPro.Admin_Images_General_Page_Header;

            if (AppSetting.Instance.License.IsInReducedFunctionalityMode)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Admin_Site_Settings_ProductKey_NotEntered_Label,
                    Message = Resources.GalleryServerPro.Admin_Need_Product_Key_Msg2,
                    Style = MessageStyle.Info
                };

                OkButtonBottom.Enabled = false;
                OkButtonTop.Enabled = false;
            }

            this.wwDataBinder.DataBind();

            ddlWmkTextLocation.DataSource = Enum.GetValues(typeof(System.Drawing.ContentAlignment));
            ddlWmkTextLocation.DataBind();

            ddlWmkImageLocation.DataSource = Enum.GetValues(typeof(System.Drawing.ContentAlignment));
            ddlWmkImageLocation.DataBind();
        }
        private void ConfigureControls()
        {
            txtUserName.Focus();

            string msgTitle = String.Empty;
            string msgDetail = String.Empty;

            if (UserController.RequiresQuestionAndAnswer)
            {
                msgTitle = Resources.GalleryServerPro.Anon_Pwd_Recovery_Disabled_Header;
                msgDetail = Resources.GalleryServerPro.Anon_Pwd_Recovery_Disabled_Because_Question_Answer_Is_Enabled_Body;
            }

            if (!UserController.EnablePasswordRetrieval)
            {
                msgTitle = Resources.GalleryServerPro.Anon_Pwd_Recovery_Disabled_Header;
                msgDetail = Resources.GalleryServerPro.Anon_Pwd_Recovery_Disabled_Because_Password_Retrieval_Is_Disabled_Body;
            }

            if (!String.IsNullOrEmpty(msgTitle))
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title = msgTitle,
                    Message = msgDetail,
                    Style = MessageStyle.Warning,
                    AutoCloseDelay = 0
                };

                pnlPwdRecoverContainer.Visible = false;
            }
        }
Пример #3
0
        private void ConfigureControlsFirstTime()
        {
            AdminPageTitle = Resources.GalleryServerPro.Admin_User_Settings_Page_Header;

              if (AppSetting.Instance.License.IsInReducedFunctionalityMode)
              {
            ClientMessage = new ClientMessageOptions
            {
              Title = Resources.GalleryServerPro.Admin_Site_Settings_ProductKey_NotEntered_Label,
              Message = Resources.GalleryServerPro.Admin_Need_Product_Key_Msg2,
              Style = MessageStyle.Info
            };

            OkButtonBottom.Enabled = false;
            OkButtonTop.Enabled = false;
              }

              this.wwDataBinder.DataBind();

              hdnUserRoles.Value = DefaultRolesForSelfRegisteredUserCollection.ToJson();
              hdnUsersToNotify.Value = UsersToNotifyForNewAccounts.ToJson();

              ConfigureOrphanUserAlbums();

              ConfigureUserAlbumParentComboBox();
        }
Пример #4
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            CurrentMediaTemplate = GetSelectedMediaTemplate();

            if (ValidateDeleteTemplate())
            {
                CurrentMediaTemplate.Delete();
                BindBrowserIdDropDownList();

                if (ddlBrowserId.Items.Count == 0)
                {
                    // User deleted last template for a MIME type. Re-bind the MIME types dropdown.
                    BindMimeTypeDropDownList();
                    BindBrowserIdDropDownList();
                    CurrentMediaTemplate = LoadDefaultMediaTemplate();
                }
                else
                {
                    CurrentMediaTemplate = GetSelectedMediaTemplate();
                }

                BindMediaTemplate();
                ViewMode = PageMode.Edit;

                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Admin_Save_Success_Hdr,
                    Message = Resources.GalleryServerPro.Admin_Templates_Deleted_Msg,
                    Style = MessageStyle.Success
                };
            }
        }
Пример #5
0
        private bool ValidateDeleteTemplate()
        {
            var isDefault = CurrentMediaTemplate.BrowserId.Equals("default", StringComparison.OrdinalIgnoreCase);
            var nonDefaultTmplExist = Factory.LoadMediaTemplates().Any(mt => mt.MimeType == CurrentMediaTemplate.MimeType && mt.BrowserId != "default");

            if (isDefault && nonDefaultTmplExist)
            {
                ClientMessage = new ClientMessageOptions
                                                    {
                                                        Title = Resources.GalleryServerPro.Validation_Summary_Text,
                                                        Message = Resources.GalleryServerPro.Admin_Media_Templates_Cannot_Delete_Default_Tmpl_Msg,
                                                        Style = MessageStyle.Error
                                                    };

                return false;
            }

            return true;
        }
Пример #6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            CurrentMediaTemplate = GetSelectedMediaTemplate();

            if (ValidateTemplateBeforeSave())
            {
                UnbindMediaTemplate();
                CurrentMediaTemplate.Save();

                if (ddlMimeType.SelectedValue != CurrentMediaTemplate.MimeType)
                {
                    // The user changed the MIME type, so rebind the MIME type dropdown.
                    BindMimeTypeDropDownList();
                    ddlMimeType.SelectedIndex = ddlMimeType.Items.IndexOf(ddlMimeType.Items.FindByValue(CurrentMediaTemplate.MimeType.ToString(CultureInfo.InvariantCulture)));
                }

                BindBrowserIdDropDownList();
                ddlBrowserId.SelectedIndex = ddlBrowserId.Items.IndexOf(ddlBrowserId.Items.FindByValue(CurrentMediaTemplate.MediaTemplateId.ToString(CultureInfo.InvariantCulture)));
                ViewMode = PageMode.Edit;

                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Admin_Save_Success_Hdr,
                    Message = Resources.GalleryServerPro.Admin_Save_Success_Text,
                    Style = MessageStyle.Success
                };
            }

            btnDelete.Enabled = !CurrentMediaTemplate.IsNew;
        }
Пример #7
0
        private void SaveSettings()
        {
            this.wwDataBinder.Unbind(this);

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Validation_Summary_Text,
                    Message = wwDataBinder.BindingErrors.ToString(),
                    Style = MessageStyle.Error
                };

                return;
            }

            UserController.SaveUser(this.CurrentUser);

            bool originalEnableUserAlbumSetting = ProfileController.GetProfileForGallery(GalleryId).EnableUserAlbum;

            SaveProfile(this.CurrentProfile);

            SaveSettingsCompleted(originalEnableUserAlbumSetting);
        }
        private void btnOkClicked()
        {
            // User clicked the download button. Gather selected items, build a ZIP file, and send to user.
            List<int> albumIds, mediaObjectIds;
            RetrieveUserSelections(out albumIds, out mediaObjectIds);

            if ((albumIds.Count == 0) && (mediaObjectIds.Count == 0))
            {
                // No objects were selected. Inform user and exit function.
                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Task_No_Objects_Selected_Hdr,
                    Message = Resources.GalleryServerPro.Task_No_Objects_Selected_Dtl,
                    Style = MessageStyle.Info
                };

                return;
            }

            BuildAndSendZipFile(albumIds, mediaObjectIds);
        }
        private void ConfigureControlsFirstTime()
        {
            AdminPageTitle = Resources.GalleryServerPro.Admin_Gallery_Settings_General_Page_Header;

            OkButtonBottom.Enabled = SavingIsEnabled;
            OkButtonTop.Enabled = SavingIsEnabled;

            if (AppSetting.Instance.License.IsInReducedFunctionalityMode)
            {
                ClientMessage = new ClientMessageOptions
                                                    {
                                                        Title = Resources.GalleryServerPro.Admin_Site_Settings_ProductKey_NotEntered_Label,
                                                        Message = Resources.GalleryServerPro.Admin_Need_Product_Key_Msg2,
                                                        Style = MessageStyle.Info
                                                    };

                OkButtonBottom.Enabled = false;
                OkButtonTop.Enabled = false;
            }

            this.wwDataBinder.DataBind();

            hdnUsersToNotify.Value = UsersToNotifyWhenErrorOccursCollection.ToJson();

            CheckForMessages();
        }
Пример #10
0
        private void CheckForMessages()
        {
            if (ClientMessage != null && ClientMessage.MessageId == MessageType.SettingsSuccessfullyChanged)
            {
                ClientMessage.Title = Resources.GalleryServerPro.Admin_Save_Success_Hdr;
                ClientMessage.Message = Resources.GalleryServerPro.Admin_Save_Success_Text;
            }

            // Check for a second situation we might need to tell the user about.
            if (!GallerySettingsUpdateable.ShowHeader && GallerySettingsUpdateable.AllowManageOwnAccount)
            {
                if (ClientMessage == null)
                {
                    ClientMessage = new ClientMessageOptions
                    {
                        Title = "INFO: Header is hidden"
                    };
                }

                ClientMessage.Style = MessageStyle.Info;
                ClientMessage.Message += "<p>" + Resources.GalleryServerPro.Admin_Gallery_Settings_Cannot_Display_Account_Edit_Link_Msg + "</p>";
                ClientMessage.AutoCloseDelay = 0;
            }
        }
Пример #11
0
        private void SaveSettings()
        {
            this.wwDataBinder.Unbind(this);

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Validation_Summary_Text,
                    Message = wwDataBinder.BindingErrors.ToString(),
                    Style = MessageStyle.Error
                };

                return;
            }

            GallerySettingsUpdateable.Save();

            HelperFunctions.PurgeCache();

            ClientMessage = new ClientMessageOptions
            {
                Title = Resources.GalleryServerPro.Admin_Save_Success_Hdr,
                Message = Resources.GalleryServerPro.Admin_Save_Success_Text,
                Style = MessageStyle.Success
            };
        }
Пример #12
0
        private void ConfigureControlsFirstTime()
        {
            AdminPageTitle = Resources.GalleryServerPro.Admin_Media_Objects_General_Page_Header;

            if (AppSetting.Instance.License.IsInReducedFunctionalityMode)
            {
                ClientMessage = new ClientMessageOptions
                                                    {
                                                        Title = Resources.GalleryServerPro.Admin_Site_Settings_ProductKey_NotEntered_Label,
                                                        Message = Resources.GalleryServerPro.Admin_Need_Product_Key_Msg2,
                                                        Style = MessageStyle.Info
                                                    };

                OkButtonBottom.Enabled = false;
                OkButtonTop.Enabled = false;
            }

            this.wwDataBinder.DataBind();

            // Bind transition types. Exclude 'Transfer' since it requires parameters and will fail with the javascript that executes it.
            ddlTransType.DataSource = Enum.GetNames(typeof(MediaObjectTransitionType)).Where(sst => sst != MediaObjectTransitionType.Transfer.ToString()).ToList();
            ddlTransType.DataBind();

            // Bind slide show types.
            ddlSlideShowType.DataSource = Enum.GetNames(typeof(SlideShowType)).Where(sst => sst != SlideShowType.NotSet.ToString()).ToList();
            ddlSlideShowType.DataBind();

            lblMoPath.Text = GallerySettings.FullMediaObjectPath;
            lblThumbnailCachePath.Text = HelperFunctions.MapAlbumDirectoryStructureToAlternateDirectory(GallerySettings.FullMediaObjectPath, GallerySettings.FullThumbnailPath, GallerySettings.FullMediaObjectPath);
            lblOptimizedCachePath.Text = HelperFunctions.MapAlbumDirectoryStructureToAlternateDirectory(GallerySettings.FullMediaObjectPath, GallerySettings.FullOptimizedPath, GallerySettings.FullMediaObjectPath);
        }
        private void UnbindDefaultGalleryObject()
        {
            if (rbDefaultGallery.Checked)
            {
                ClearDefaultAlbum();
                GalleryControlSettingsUpdateable.MediaObjectId = null;
            }
            else if (rbDefaultAlbum.Checked)
            {
                if (tvUC.SelectedAlbum != null)
                {
                    GalleryControlSettingsUpdateable.AlbumId = tvUC.SelectedAlbum.Id;
                    GalleryControlSettingsUpdateable.MediaObjectId = null;
                }
                else
                {
                    UnbindError = true;

                    ClientMessage = new ClientMessageOptions
                    {
                        Title = Resources.GalleryServerPro.Validation_Summary_Text,
                        Message = Resources.GalleryServerPro.Admin_Gallery_Control_Settings_InvalidAlbum_Msg,
                        Style = MessageStyle.Error
                    };
                }
            }
            else if (rbDefaultMediaObject.Checked)
            {
                ClearDefaultAlbum();

                int mediaObjectId;
                if (Int32.TryParse(txtDefaultMediaObjectId.Text, out mediaObjectId))
                {
                    try
                    {
                        Factory.LoadMediaObjectInstance(mediaObjectId);

                        GalleryControlSettingsUpdateable.MediaObjectId = mediaObjectId;
                    }
                    catch (InvalidMediaObjectException)
                    {
                        UnbindError = true;

                        ClientMessage = new ClientMessageOptions
                        {
                            Title = Resources.GalleryServerPro.Validation_Summary_Text,
                            Message = String.Format(CultureInfo.CurrentCulture, Resources.GalleryServerPro.Admin_Gallery_Control_Settings_Invalid_MediaObject_Msg, mediaObjectId),
                            Style = MessageStyle.Error
                        };
                    }
                }
                else
                {
                    UnbindError = true;

                    ClientMessage = new ClientMessageOptions
                    {
                        Title = Resources.GalleryServerPro.Validation_Summary_Text,
                        Message = Resources.GalleryServerPro.Admin_Gallery_Control_Settings_InvalidMediaObject_Msg,
                        Style = MessageStyle.Error
                    };
                }
            }
        }
        private void ConfigureControlsFirstTime()
        {
            AdminPageTitle = Resources.GalleryServerPro.Admin_Gallery_Control_Settings_Page_Header;

            rbDefaultGallery.Text = String.Format(CultureInfo.InvariantCulture, Resources.GalleryServerPro.Admin_Gallery_Control_Settings_Default_Gallery_Label,
                                                                                        Utils.HtmlEncode(Factory.LoadGallery(GalleryId).Description));

            CheckForMessages();

            if (AppSetting.Instance.License.IsInReducedFunctionalityMode)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Admin_Site_Settings_ProductKey_NotEntered_Label,
                    Message = Resources.GalleryServerPro.Admin_Need_Product_Key_Msg2,
                    Style = MessageStyle.Info
                };

                OkButtonBottom.Enabled = false;
                OkButtonTop.Enabled = false;
            }

            DataBindControlsFirstTime();
        }
        /// <summary>
        /// Determine if there are any messages we need to display to the user.
        /// </summary>
        private void CheckForMessages()
        {
            if (ClientMessage != null && ClientMessage.MessageId == MessageType.SettingsSuccessfullyChanged)
            {
                ClientMessage.Title = Resources.GalleryServerPro.Admin_Save_Success_Hdr;
                ClientMessage.Message = Resources.GalleryServerPro.Admin_Save_Success_Text;
            }

            if (GalleryControl.GalleryControlSettings.MediaObjectId.HasValue)
            {
                try
                {
                    Factory.LoadMediaObjectInstance(GalleryControl.GalleryControlSettings.MediaObjectId.Value);
                }
                catch (InvalidMediaObjectException)
                {
                    ClientMessage = new ClientMessageOptions
                    {
                        Title = Resources.GalleryServerPro.Validation_Summary_Text,
                        Message = String.Format(CultureInfo.CurrentCulture, Resources.GalleryServerPro.Admin_Gallery_Control_Settings_Invalid_MediaObject_Msg, GalleryControl.GalleryControlSettings.MediaObjectId.Value),
                        Style = MessageStyle.Error
                    };
                }
            }
        }
Пример #16
0
        private void ConfigureControlsFirstTime()
        {
            AdminPageTitle = Resources.GalleryServerPro.Admin_Albums_General_Page_Header;

            if (AppSetting.Instance.License.IsInReducedFunctionalityMode)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Admin_Site_Settings_ProductKey_NotEntered_Label,
                    Message = Resources.GalleryServerPro.Admin_Need_Product_Key_Msg2,
                    Style = MessageStyle.Info
                };

                OkButtonBottom.Enabled = false;
                OkButtonTop.Enabled = false;
            }

            DataBindControlsFirstTime();
        }
Пример #17
0
        private void SaveSettings()
        {
            UnbindData();

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Validation_Summary_Text,
                    Message = wwDataBinder.BindingErrors.ToString(),
                    Style = MessageStyle.Error
                };

                return;
            }

            GallerySettingsUpdateable.Save();

            ClientMessage = new ClientMessageOptions
            {
                Title = Resources.GalleryServerPro.Admin_Save_Success_Hdr,
                Message = GetSaveSuccessText(),
                Style = MessageStyle.Success
            };

            HelperFunctions.PurgeCache();

            if (chkUpdateSort.Checked)
            {
                UpdateSortOnExistingAlbumsAsync();
            }
        }
Пример #18
0
        private void SaveSettings()
        {
            // Step 1: Update config manually with those items that are not managed via the wwDataBinder
            UnbindUsersToNotifyWhenErrorOccurs();

            // Step 2: Save
            this.wwDataBinder.Unbind(this);

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Validation_Summary_Text,
                    Message = wwDataBinder.BindingErrors.ToString(),
                    Style = MessageStyle.Error
                };

                return;
            }

            GallerySettingsUpdateable.Save();

            HelperFunctions.PurgeCache();

            // 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_gallerysettings, "aid={0}&msg={1}", GetAlbumId(), ((int)msg).ToString(CultureInfo.InvariantCulture));
        }
Пример #19
0
        private void ProcessAccountDeletion()
        {
            try
            {
                UserController.DeleteGalleryServerProUser(this.CurrentUser.UserName, false);
            }
            catch (WebException ex)
            {
                int errorId = LogError(ex);

                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Validation_Summary_Text,
                    Message = String.Format(CultureInfo.CurrentCulture, Resources.GalleryServerPro.MyAccount_Delete_Account_Err_Msg, errorId, ex.GetType()),
                    Style = MessageStyle.Error
                };

                return;
            }
            catch (GallerySecurityException ex)
            {
                int errorId = LogError(ex);

                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Validation_Summary_Text,
                    Message = String.Format(CultureInfo.CurrentCulture, Resources.GalleryServerPro.MyAccount_Delete_Account_Err_Msg, errorId, ex.GetType()),
                    Style = MessageStyle.Error
                };

                return;
            }

            UserController.LogOffUser();

            Utils.Redirect(PageId.album);
        }
Пример #20
0
		private void btnOkClicked(string step)
		{
			// User clicked either 'Choose these objects' (step 1) or 'Move objects' (step 2).
			// Carry out the requested action.
			if (step == "step1")
			{
				string[] ids = RetrieveUserSelections();

				if (ids.Length > 0)
				{
					// Persist the gallery object IDs to the view state, so they are available later
					ViewState["ids"] = ids;

					ShowTreeview();
				}
				else
				{
					HandleUserNotSelectingAnyObjects();
				}
			}
			else if (step == "step2")
			{
				try
				{
					TransferObjects();

					HelperFunctions.PurgeCache();

					RedirectAfterSuccessfulTransfer();
				}
				catch (GallerySecurityException)
				{
					// User does not have permission to carry out the operation.
					ClientMessage = new ClientMessageOptions
					{
						Title = Resources.GalleryServerPro.Task_Transfer_Objects_Cannot_Transfer_No_Permission_Msg_Hdr,
						Message = Resources.GalleryServerPro.Task_Transfer_Objects_Cannot_Transfer_No_Permission_Msg_Dtl,
						Style = MessageStyle.Error,
						AutoCloseDelay = 0
					};
				}
				catch (UnsupportedMediaObjectTypeException ex)
				{
					// User is trying to copy a file that is disabled on the Media Object Types page.
					ClientMessage = new ClientMessageOptions
					{
						Title = Resources.GalleryServerPro.Task_Transfer_Objects_Cannot_Transfer_UnsupportedFileType_Msg_Hdr,
						Message = String.Format(CultureInfo.InvariantCulture, Resources.GalleryServerPro.Task_Transfer_Objects_Cannot_Transfer_UnsupportedFileType_Msg_Dtl, System.IO.Path.GetExtension(ex.MediaObjectFilePath)),
						Style = MessageStyle.Error,
						AutoCloseDelay = 0
					};
				}
				catch (CannotTransferAlbumToNestedDirectoryException)
				{
					// User tried to move or copy an album to one of its own subdirectories. This cannot be done.
					ClientMessage = new ClientMessageOptions
					{
						Title = Resources.GalleryServerPro.Task_Transfer_Objects_Cannot_Transfer_To_Nested_Album_Msg_Hdr,
						Message = Resources.GalleryServerPro.Task_Transfer_Objects_Cannot_Transfer_To_Nested_Album_Msg_Dtl,
						Style = MessageStyle.Error,
						AutoCloseDelay = 0
					};
					//string msg = String.Format(CultureInfo.CurrentCulture, "<p class='gsp_msgwarning'><span class='gsp_bold'>{0} </span>{1}</p>", Resources.GalleryServerPro.Task_Transfer_Objects_Cannot_Transfer_To_Nested_Album_Msg_Hdr, Resources.GalleryServerPro.Task_Transfer_Objects_Cannot_Transfer_To_Nested_Album_Msg_Dtl);
					//phMsg.Controls.Clear();
					//phMsg.Controls.Add(new System.Web.UI.LiteralControl(msg));
				}
			}

		}
Пример #21
0
        private void SaveSettingsCompleted(bool originalEnableUserAlbumSetting)
        {
            bool newEnableUserAlbumSetting = ProfileController.GetProfileForGallery(GalleryId).EnableUserAlbum;

            if (originalEnableUserAlbumSetting != newEnableUserAlbumSetting)
            {
                // Since we changed a setting 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.myaccount, "msg={0}", ((int)msg).ToString(CultureInfo.InvariantCulture));
            }
            else
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Admin_Save_Success_Hdr,
                    Message = Resources.GalleryServerPro.Admin_Save_Success_Text,
                    Style = MessageStyle.Success
                };
            }
        }
Пример #22
0
		/// <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();
		}
Пример #23
0
        private void ConfigureControlsFirstTime()
        {
            ViewMode = PageMode.Edit;
            OkButtonIsVisible = false;

            BindDropDownLists();

            CurrentMediaTemplate = LoadDefaultMediaTemplate();

            BindMediaTemplate();

            AdminPageTitle = Resources.GalleryServerPro.Admin_Media_Templates_Page_Header;

            if (AppSetting.Instance.License.IsInReducedFunctionalityMode)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Admin_Site_Settings_ProductKey_NotEntered_Label,
                    Message = Resources.GalleryServerPro.Admin_Need_Product_Key_Msg2,
                    Style = MessageStyle.Info
                };
            }

            ActivateFirstTab();
        }
Пример #24
0
        private void SaveSettings()
        {
            File.WriteAllText(CssFilePath, txtCss.Text, System.Text.Encoding.UTF8);

            ClientMessage = new ClientMessageOptions
            {
                Title = Resources.GalleryServerPro.Admin_Save_Success_Hdr,
                Message = String.Concat("<p>", Resources.GalleryServerPro.Admin_Save_Success_Text, "</p><p>You may need to force a browser refresh to load the CSS changes.</p>"),
                Style = MessageStyle.Success
            };
        }
Пример #25
0
        /// <summary>
        /// Returns <c>true</c> when the media template can be saved; otherwise <c>false</c>. When it fails validation,
        /// a message to the user is automatically generated. Enforeces these rules:
        /// 1. Cannot save a template that has the same MIME type and browser ID as another one.
        /// 2. When creating a template, the MIME type must exist in the gsp_MimeType table.
        /// 3. The first template for a new MIME type must have a browser ID "default".
        /// </summary>
        private bool ValidateTemplateBeforeSave()
        {
            var mimeType = txtMimeType.Text.Trim();
            var browserId = txtBrowserId.Text.Trim();

            // TEST 1: Cannot save a template that has the same MIME type and browser ID as another one.
            if (Factory.LoadMediaTemplates().Any(mt =>
                                                                                        mt.MediaTemplateId != CurrentMediaTemplate.MediaTemplateId &&
                                                                                        mt.MimeType == mimeType &&
                                                                                        mt.BrowserId == browserId))
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Validation_Summary_Text,
                    Message = Resources.GalleryServerPro.Admin_Templates_Cannot_Save_Duplicate_Name_Msg,
                    Style = MessageStyle.Error
                };

                return false;
            }

            var firstTmplForMimeType = Factory.LoadMediaTemplates().All(mt => mt.MimeType != mimeType);

            if (!firstTmplForMimeType)
            {
                return true;
            }

            // TEST 2. When creating a template, the MIME type must exist in the gsp_MimeType table.
            if (!DoesMatchingMimeTypeExist(mimeType))
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Validation_Summary_Text,
                    Message = String.Format(CultureInfo.InvariantCulture, Resources.GalleryServerPro.Admin_Media_Templates_Cannot_Save_No_Matching_MimeType_Msg, mimeType),
                    Style = MessageStyle.Error
                };

                return false;
            }

            // TEST 3. The first template for a new MIME type must have a browser ID "default".
            var isNonDefaultTmpl = !browserId.Equals("default", StringComparison.OrdinalIgnoreCase);
            if (isNonDefaultTmpl)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Validation_Summary_Text,
                    Message = Resources.GalleryServerPro.Admin_Media_Templates_Cannot_Save_No_Default_Tmpl_Msg,
                    Style = MessageStyle.Error
                };

                return false;
            }

            return true;
        }
Пример #26
0
        private bool ValidateExternalHtmlSource(string externalHtmlSource)
        {
            if (Utils.IsCurrentUserGalleryAdministrator(GalleryId))
                return true; // Allow admins to enter any HTML they want

            IHtmlValidator htmlValidator = Factory.GetHtmlValidator(externalHtmlSource, GalleryId);
            htmlValidator.Validate();
            if (!htmlValidator.IsValid)
            {
                string invalidHtmlTags = String.Join(", ", htmlValidator.InvalidHtmlTags.ToArray());
                string invalidHtmlAttributes = String.Join(", ", htmlValidator.InvalidHtmlAttributes.ToArray());
                string javascriptDetected = (htmlValidator.InvalidJavascriptDetected ? Resources.GalleryServerPro.Task_Add_Objects_External_Tab_Javascript_Detected_Yes : Resources.GalleryServerPro.Task_Add_Objects_External_Tab_Javascript_Detected_No);

                if (String.IsNullOrEmpty(invalidHtmlTags))
                    invalidHtmlTags = Resources.GalleryServerPro.Task_Add_Objects_External_Tab_No_Invalid_Html;

                if (String.IsNullOrEmpty(invalidHtmlAttributes))
                    invalidHtmlAttributes = Resources.GalleryServerPro.Task_Add_Objects_External_Tab_No_Invalid_Html;

                ClientMessage = new ClientMessageOptions
                {
                    Title = "Invalid text",
                    Message = String.Format(CultureInfo.InvariantCulture, Resources.GalleryServerPro.Task_Add_Objects_External_Tab_Invalid_Html_Msg, invalidHtmlTags, invalidHtmlAttributes, javascriptDetected),
                    Style = MessageStyle.Warning
                };

                return false;
            }
            return true;
        }
Пример #27
0
        /// <summary>
        /// Handles the Click event of the btnEnableUserAlbums control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void btnEnableUserAlbums_Click(object sender, EventArgs e)
        {
            TurnOnUserAlbumsForAllUsers();

              ClientMessage = new ClientMessageOptions
              {
            Title = Resources.GalleryServerPro.Admin_Save_Success_Hdr,
            Message = Resources.GalleryServerPro.Admin_Save_Success_Text,
            Style = MessageStyle.Success
              };
        }
Пример #28
0
        private void VerifyUploadSettingsAreEnabled()
        {
            if (!GallerySettings.AllowAddLocalContent && !GallerySettings.AllowAddExternalContent)
            {
                // Both settings are disabled, which means no objects can be added. This is probably a mis-configuration,
                // so give a friendly message to help point the administrator in the right direction for changing it.
                ClientMessage = new ClientMessageOptions
                {
                    Title = Resources.GalleryServerPro.Task_No_Objects_Selected_Hdr,
                    Message = Resources.GalleryServerPro.Task_Add_Objects_All_Adding_Types_Disabled_Msg,
                    Style = MessageStyle.Info,
                    AutoCloseDelay = 0
                };

                this.OkButtonTop.Visible = false;
                this.OkButtonBottom.Visible = false;
            }
        }
Пример #29
0
        private void SaveSettings()
        {
            // Step 1: Update config manually with those items that are not managed via the wwDataBinder
              UnbindUserAlbumId();

              UnbindDefaultRoles();

              UnbindUsersToNotify();

              // Step 2: Save
              this.wwDataBinder.Unbind(this);

              if (wwDataBinder.BindingErrors.Count > 0)
              {
            ClientMessage = new ClientMessageOptions
            {
              Title = Resources.GalleryServerPro.Validation_Summary_Text,
              Message = wwDataBinder.BindingErrors.ToString(),
              Style = MessageStyle.Error
            };

            return;
              }

              GallerySettingsUpdateable.Save();

              HelperFunctions.PurgeCache();
              ConfigureOrphanUserAlbums();

              ClientMessage = new ClientMessageOptions
                        {
                          Title = Resources.GalleryServerPro.Admin_Save_Success_Hdr,
                          Message = Resources.GalleryServerPro.Admin_Save_Success_Text,
                          Style = MessageStyle.Success
                        };
        }
Пример #30
0
        private void ConfigureControlsEveryTime()
        {
            OkButtonIsVisible = false;

            if (AppSetting.Instance.License.IsInReducedFunctionalityMode)
            {
                ClientMessage = new ClientMessageOptions { Title = Resources.GalleryServerPro.Admin_Site_Settings_ProductKey_NotEntered_Label, Message = Resources.GalleryServerPro.Admin_Need_Product_Key_Msg2, Style = MessageStyle.Info };

                OkButtonBottom.Enabled = false;
                OkButtonTop.Enabled = false;
            }

            this.PageTitle = Resources.GalleryServerPro.Admin_Manage_Roles_Page_Header;
        }