private void ConfigureControls()
        {
            txtUserName.Focus();

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

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

            if (!UserController.EnablePasswordRetrieval)
            {
                msgTitle  = Resources.GalleryServer.Anon_Pwd_Recovery_Disabled_Header;
                msgDetail = Resources.GalleryServer.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;
            }
        }
        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
                };
            }
        }
示例#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();
        }
        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();
        }
示例#5
0
        private void SaveSettings()
        {
            UnbindWatermarkImage();

            this.wwDataBinder.Unbind(this);

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

                return;
            }

            GallerySettingsUpdateable.Save();

            Factory.ClearWatermarkCache();
            imgWatermarkImage.ImageUrl = WatermarkImageFileSource;

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServer.Admin_Save_Success_Hdr,
                Message = Resources.GalleryServer.Admin_Save_Success_Text,
                Style   = MessageStyle.Success
            };
        }
示例#6
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);
        }
示例#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;
            }

            GallerySettingsUpdateable.Save();

            HelperFunctions.PurgeCache();

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServerPro.Admin_Save_Success_Hdr,
                Message = Resources.GalleryServerPro.Admin_Save_Success_Text,
                Style   = MessageStyle.Success
            };
        }
示例#8
0
        /// <summary>
        ///   Handles the Deleting event of the odsGalleries control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">
        ///   The <see cref="System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs" /> instance containing the event data.
        /// </param>
        protected void odsGalleries_Deleting(object sender, ObjectDataSourceMethodEventArgs e)
        {
            // Make sure user isn't trying to delete the current gallery. Javascript on the client should have prevented us from getting to this point, but
            // we check again as an extra safety measure.
            foreach (DictionaryEntry entry in e.InputParameters)
            {
                var rowGallery = entry.Value as IGallery;

                if (rowGallery == null)
                {
                    return;
                }

                IGallery gallery;
                try
                {
                    gallery = Factory.LoadGallery(rowGallery.GalleryId);
                }
                catch (InvalidGalleryException) { return; }

                if (gallery.GalleryId == GalleryId)
                {
                    e.Cancel = true;

                    ClientMessage = new ClientMessageOptions
                    {
                        Title   = Resources.GalleryServer.Validation_Summary_Text,
                        Message = String.Format(CultureInfo.InvariantCulture, Resources.GalleryServer.Admin_Gallery_Settings_Cannot_Delete_Current_Gallery_Text, gallery.Description.JsEncode()),
                        Style   = MessageStyle.Error
                    };
                }
            }
        }
示例#9
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));
        }
        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;
        }
示例#11
0
        private void ConfigureControlsFirstTime()
        {
            AdminPageTitle = Resources.GalleryServerPro.Admin_Gallery_Manager_Page_Header;

            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
                };

                lbChangeGallery.Visible = false;

                gvGalleries.Columns[0].Visible = false;
                gvGalleries.ShowFooter         = false;
            }

            DataBindGalleriesComboBox();

            CheckForMessages();
        }
示例#12
0
        /// <summary>
        /// Handles the Click event of the btnDelete control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            CurrentUiTemplate = GetSelectedJQueryTemplate();

            string invalidReason;

            if (ValidateUiTemplateBeforeDelete(out invalidReason))
            {
                CurrentUiTemplate.Delete();
                BindTemplateNameDropDownList();
                CurrentUiTemplate = GetSelectedJQueryTemplate();
                BindUiTemplate();
                ViewMode = PageMode.Edit;

                ClientMessage = new ClientMessageOptions
                {
                    Title   = Resources.GalleryServer.Admin_Save_Success_Hdr,
                    Message = Resources.GalleryServer.Admin_Templates_Deleted_Msg,
                    Style   = MessageStyle.Success
                };
            }
            else
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title   = Resources.GalleryServer.Validation_Summary_Text,
                    Message = invalidReason,
                    Style   = MessageStyle.Error
                };
            }
        }
示例#13
0
        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();
        }
示例#14
0
        private void SaveSettings()
        {
            this.wwDataBinder.Unbind(this);

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

                return;
            }

            GallerySettingsUpdateable.Save();

            // In case the media objects path has changed, clear the inflated albums cache, since those albums hold a
            // reference to the full path to the album/media asset.
            CacheController.RemoveInflatedAlbumsFromCache();

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServer.Admin_Save_Success_Hdr,
                Message = Resources.GalleryServer.Admin_Save_Success_Text,
                Style   = MessageStyle.Success
            };
        }
示例#15
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            CurrentUiTemplate = GetSelectedJQueryTemplate();

            string invalidReason;

            if (ValidateUiTemplateBeforeSave(out invalidReason))
            {
                UnbindJQueryTemplate();
                CurrentUiTemplate.Save();

                BindTemplateNameDropDownList();
                ddlTemplateName.SelectedIndex = ddlTemplateName.Items.IndexOf(ddlTemplateName.Items.FindByValue(CurrentUiTemplate.UiTemplateId.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
                };
            }
            else
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title   = Resources.GalleryServerPro.Validation_Summary_Text,
                    Message = invalidReason,
                    Style   = MessageStyle.Error
                };
            }
        }
示例#16
0
        private void SaveSettings()
        {
            string encoderSettingsStr = hdnEncoderSettings.Value;

            var encoderSettings = encoderSettingsStr.FromJson <Entity.MediaEncoderSettings[]>();

            GallerySettingsUpdateable.MediaEncoderSettings = MediaEncoderSettingsController.ToMediaEncoderSettingsCollection(encoderSettings);


            this.wwDataBinder.Unbind(this);

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

                return;
            }

            GallerySettingsUpdateable.Save();

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

            hdnEncoderSettings.Value = MediaEncoderSettingsController.ToEntities(GallerySettingsUpdateable.MediaEncoderSettings).ToJson();
        }
示例#17
0
        /// <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.GalleryServer.Admin_Save_Success_Hdr;
                ClientMessage.Message = Resources.GalleryServer.Admin_Save_Success_Text;
            }

            if (GalleryControl.GalleryControlSettings.MediaObjectId.HasValue)
            {
                try
                {
                    Factory.LoadMediaObjectInstance(GalleryControl.GalleryControlSettings.MediaObjectId.Value);
                }
                catch (InvalidMediaObjectException)
                {
                    ClientMessage = new ClientMessageOptions
                    {
                        Title   = Resources.GalleryServer.Validation_Summary_Text,
                        Message = String.Format(CultureInfo.CurrentCulture, Resources.GalleryServer.Admin_Gallery_Control_Settings_Invalid_MediaObject_Msg, GalleryControl.GalleryControlSettings.MediaObjectId.Value),
                        Style   = MessageStyle.Error
                    };
                }
            }
        }
示例#18
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();
        }
示例#19
0
        private void DetermineMessage()
        {
            if (ClientMessage == null)
            {
                bool isInTrialMode = (License.IsInTrialPeriod && !License.IsValid);
                if (isInTrialMode)
                {
                    int daysLeftInTrial = (License.InstallDate.AddDays(GlobalConstants.TrialNumberOfDays) - DateTime.Today).Days;

                    ClientMessage = new ClientMessageOptions
                    {
                        Title          = Resources.GalleryServerPro.Site_Welcome_Msg,
                        Message        = String.Format(CultureInfo.CurrentCulture, Resources.GalleryServerPro.Admin_In_Trial_Period_Msg, daysLeftInTrial),
                        Style          = MessageStyle.Success,
                        AutoCloseDelay = 0
                    };
                }

                bool trialPeriodExpired = (!License.IsInTrialPeriod && !License.IsValid);
                if (trialPeriodExpired)
                {
                    ClientMessage = new ClientMessageOptions
                    {
                        Title          = Resources.GalleryServerPro.Admin_Need_Product_Key_Hdr,
                        Message        = Resources.GalleryServerPro.Admin_Need_Product_Key_Msg,
                        Style          = MessageStyle.Warning,
                        AutoCloseDelay = 0
                    };
                }
            }
        }
示例#20
0
        private void SaveSettings()
        {
            UnbindData();

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

                return;
            }

            GallerySettingsUpdateable.Save();

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

            if (chkUpdateSort.Checked)
            {
                UpdateSortOnExistingAlbumsAsync();
            }
        }
示例#21
0
        /// <summary>
        /// Verify the product key is valid and displays to the user the results of the validation. The <see cref="License" />
        /// property is updated with the results of the validation.
        /// </summary>
        /// <param name="productKey">The product key to validate.</param>
        private void ValidateProductKey(string productKey)
        {
            License.ProductKey = productKey;
            License.Validate(false);

            if (!String.IsNullOrEmpty(productKey))
            {
                if (License.IsValid)
                {
                    ClientMessage = new ClientMessageOptions
                    {
                        Title          = Resources.GalleryServerPro.Admin_Save_ProductKey_Success_Hdr,
                        Message        = Resources.GalleryServerPro.Admin_Save_ProductKey_Success_Msg,
                        Style          = MessageStyle.Success,
                        AutoCloseDelay = 0
                    };
                }
                else
                {
                    wwDataBinder.AddBindingError(License.KeyInvalidReason, txtProductKey);

                    if (wwDataBinder.BindingErrors.Count > 0)
                    {
                        ClientMessage = new ClientMessageOptions
                        {
                            Title          = Resources.GalleryServerPro.Admin_Save_ProductKey_Incorrect_Hdr,
                            Message        = Utils.HtmlEncode(wwDataBinder.BindingErrors.ToString()),
                            Style          = MessageStyle.Error,
                            AutoCloseDelay = 0
                        };
                    }
                }
            }
        }
        private void RecoverPassword()
        {
            var    iconStyle = MessageStyle.Warning;
            string msgTitle;
            string msgDetail;

            IUserAccount user = UserController.GetUser(txtUserName.Text, true);

            if (user == null)
            {
                msgTitle  = Resources.GalleryServer.Anon_Pwd_Recovery_Cannot_Retrieve_Pwd_Header;
                msgDetail = String.Format(CultureInfo.CurrentCulture, "<p>{0}</p>", Resources.GalleryServer.Anon_Pwd_Recovery_GetUser_Throws_Exception_Message);
            }
            else
            {
                if (HelperFunctions.IsValidEmail(user.Email))
                {
                    // Send user's password in an email.
                    try
                    {
                        EmailController.SendNotificationEmail(user.UserName, user.Email, Entity.EmailTemplateForm.UserNotificationPasswordRecovery, false);

                        msgTitle = Resources.GalleryServer.Anon_Pwd_Recovery_Confirmation_Title;
                        string url = String.Format(CultureInfo.CurrentCulture, " <a href='{0}'>{1}</a>", Web.Utils.GetUrl(PageId.login), Resources.GalleryServer.Login_Button_Text);
                        msgDetail = String.Concat(String.Format(CultureInfo.CurrentCulture, Resources.GalleryServer.Anon_Pwd_Recovery_Confirmation_Body, user.Email), url);
                        iconStyle = MessageStyle.Info;
                        pnlPwdRecoverContainer.Visible = false;
                    }
                    catch (Exception ex)
                    {
                        string errorMsg;
                        if (this.GallerySettings.ShowErrorDetails)
                        {
                            errorMsg = EventController.GetExceptionDetails(ex);
                        }
                        else
                        {
                            errorMsg = Resources.GalleryServer.Error_Generic_Msg;
                        }

                        msgTitle  = Resources.GalleryServer.Anon_Pwd_Recovery_Cannot_Retrieve_Pwd_Header;
                        msgDetail = "<p>" + String.Format(CultureInfo.CurrentCulture, Resources.GalleryServer.Anon_Pwd_Recovery_Cannot_Retrieve_Pwd_Generic_Error, errorMsg) + "</p>";
                    }
                }
                else                 // User is valid but does not have a valid email
                {
                    msgTitle  = Resources.GalleryServer.Anon_Pwd_Recovery_Cannot_Retrieve_Pwd_Header;
                    msgDetail = String.Format(CultureInfo.CurrentCulture, "<p>{0}</p>", Resources.GalleryServer.Anon_Pwd_Recovery_Cannot_Retrieve_Pwd_Invalid_Email);
                }
            }

            // Render confirmation message
            ClientMessage = new ClientMessageOptions
            {
                Title   = msgTitle,
                Message = msgDetail,
                Style   = iconStyle
            };
        }
        /// <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);
        }
示例#24
0
 private void DisplayMessage(string title, string detail, MessageStyle iconStyle)
 {
     ClientMessage = new ClientMessageOptions
     {
         Title          = title,
         Message        = detail,
         Style          = iconStyle,
         AutoCloseDelay = 0
     };
 }
示例#25
0
        /// <summary>
        /// Handles the Click event of the btnDisableUserAlbums 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 btnDisableUserAlbums_Click(object sender, EventArgs e)
        {
            TurnOffUserAlbumsForAllUsers();

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServerPro.Admin_Save_Success_Hdr,
                Message = Resources.GalleryServerPro.Admin_Save_Success_Text,
                Style   = MessageStyle.Success
            };
        }
示例#26
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
            };
        }
示例#27
0
        /// <summary>
        /// Handles the Click event of the btnPurgeCache control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void btnPurgeCache_Click(object sender, EventArgs e)
        {
            CacheController.PurgeCache();

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServer.Admin_Site_Settings_PurgeCache_Success_Hdr,
                Message = null,
                Style   = MessageStyle.Success
            };
        }
示例#28
0
 /// <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 = new ClientMessageOptions
         {
             Title   = Resources.GalleryServer.Admin_Save_Success_Hdr,
             Message = Resources.GalleryServer.Admin_Save_Success_Text,
             Style   = MessageStyle.Success
         };
     }
 }
示例#29
0
        private void HandleGalleryEditSuccess(string msg)
        {
            Factory.ClearGalleryCache();

            DataBindGalleriesComboBox();

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServer.Admin_Save_Success_Hdr,
                Message = msg,
                Style   = MessageStyle.Success
            };
        }
示例#30
0
        private void HandleGalleryEditFailure(string msg)
        {
            Factory.ClearGalleryCache();

            DataBindGalleriesComboBox();

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServer.Validation_Summary_Text,
                Message = msg,
                Style   = MessageStyle.Error
            };
        }