protected void Page_Load(object sender, EventArgs e)
        {
            Actions    = new AllowedActions(ProfileHelper.UserInfo);
            MyStaff    = ProfileHelper.UserInfo.IsMe();
            HasActions = Actions.AllowEdit || Actions.AllowAddOrDelete;

            var currentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);

            IsAdmin = currentUser.IsAdmin();

            SubscribeBtnText =
                StudioNotifyHelper.IsSubscribedToNotify(currentUser, Core.Notify.Actions.PeriodicNotify)
                    ? ResourceJS.TipsAndTricksUnsubscribeBtn
                    : ResourceJS.TipsAndTricksSubscribeBtn;

            if (HasActions && Actions.AllowAddOrDelete)
            {
                _phConfirmationDeleteUser.Controls.Add(LoadControl(ConfirmationDeleteUser.Location));
            }

            ProfileEditLink =
                Page is MyStaff
                    ? "/my.aspx?action=edit"
                    : "profileaction.aspx?action=edit&user="******"reassigns.aspx?user="******"email_change"] == "success")
            {
                Page.RegisterInlineScript(string.Format("toastr.success(\"{0}\");", Resource.ChangeEmailSuccess));
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Actions          = new AllowedActions(ProfileHelper.UserInfo);
            MyStaff          = ProfileHelper.UserInfo.IsMe();
            UserHasAvatar    = !UserPhotoManager.GetPhotoAbsoluteWebPath(ProfileHelper.UserInfo.ID).Contains("default/images/");
            HasActions       = Actions.AllowEdit || Actions.AllowAddOrDelete;
            IsAdmin          = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).IsAdmin();
            SubscribeBtnText =
                StudioNotifyService.Instance.IsSubscribeToPeriodicNotify(SecurityContext.CurrentAccount.ID)
                    ? ResourceJS.TipsAndTricksUnsubscribeBtn
                    : ResourceJS.TipsAndTricksSubscribeBtn;

            if (HasActions && Actions.AllowAddOrDelete)
            {
                _phConfirmationDeleteUser.Controls.Add(LoadControl(ConfirmationDeleteUser.Location));
            }

            ProfileEditLink =
                Page is MyStaff
                    ? "/my.aspx?action=edit"
                    : "profileaction.aspx?action=edit&user="******"reassigns.aspx?user="******"email_change"] == "success")
            {
                Page.RegisterInlineScript(string.Format("toastr.success(\"{0}\");", Resource.ChangeEmailSuccess));
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Actions = new AllowedActions(ProfileHelper.UserInfo);
            MyStaff = ProfileHelper.UserInfo.IsMe();
            UserHasAvatar = !UserPhotoManager.GetPhotoAbsoluteWebPath(ProfileHelper.UserInfo.ID).Contains("default/images/");
            HasActions = Actions.AllowEdit || Actions.AllowAddOrDelete;
            IsAdmin = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).IsAdmin();

            if (HasActions && Actions.AllowAddOrDelete)
            {
                _phConfirmationDeleteUser.Controls.Add(LoadControl(ConfirmationDeleteUser.Location));
            }

            ProfileEditLink =
                Page is MyStaff
                    ? "/my.aspx?action=edit"
                    : "profileaction.aspx?action=edit&user=" + HttpUtility.UrlEncode(ProfileHelper.UserInfo.UserName);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Actions       = new AllowedActions(ProfileHelper.UserInfo);
            MyStaff       = ProfileHelper.UserInfo.IsMe();
            UserHasAvatar = !UserPhotoManager.GetPhotoAbsoluteWebPath(ProfileHelper.UserInfo.ID).Contains("default/images/");
            HasActions    = Actions.AllowEdit || Actions.AllowAddOrDelete;
            IsAdmin       = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).IsAdmin();

            if (HasActions && Actions.AllowAddOrDelete)
            {
                _phConfirmationDeleteUser.Controls.Add(LoadControl(ConfirmationDeleteUser.Location));
            }

            ProfileEditLink =
                Page is MyStaff
                    ? "/my.aspx?action=edit"
                    : "profileaction.aspx?action=edit&user=" + HttpUtility.UrlEncode(ProfileHelper.UserInfo.UserName);
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            userInfo = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            IsAdmin = userInfo.IsAdmin();
            Actions = new AllowedActions(userInfo);

            var quota = TenantExtra.GetTenantQuota();
            IsFreeTariff = quota.Free && !quota.Open;

            _confirmationDeleteDepartmentPanel.Options.IsPopup = true;
            _resendInviteDialog.Options.IsPopup = true;
            _changeStatusDialog.Options.IsPopup = true;
            _changeTypeDialog.Options.IsPopup = true;
            _deleteUsersDialog.Options.IsPopup = true;
            _deleteProfileContainer.Options.IsPopup = true;

            var emptyContentForPeopleFilter = new EmptyScreenControl
                {
                    ID = "emptyContentForPeopleFilter",
                    ImgSrc = WebImageSupplier.GetAbsoluteWebPath("empty_screen_filter.png"),
                    Header = PeopleResource.NotFoundTitle,
                    Describe = PeopleResource.NotFoundDescription,
                    ButtonHTML = String.Format(@"<a class='clearFilterButton link dotline' href='javascript:void(0);' 
                                            onclick='ASC.People.PeopleController.resetAllFilters();'>{0}</a>",
                                               PeopleResource.ClearButton),
                    CssClass = "display-none"
                };

            emptyScreen.Controls.Add(emptyContentForPeopleFilter);


            var controlEmailChange = (UserEmailChange)LoadControl(UserEmailChange.Location);
            controlEmailChange.UserInfo = userInfo;
            userEmailChange.Controls.Add(controlEmailChange);

            loaderHolder.Controls.Add(LoadControl(LoaderPage.Location));
            userConfirmationDelete.Controls.Add(LoadControl(ConfirmationDeleteUser.Location));

            if (Actions.AllowEdit)
            {
                userPwdChange.Controls.Add(LoadControl(PwdTool.Location));
            }
            Title = HeaderStringHelper.GetPageTitle(PeopleResource.ProductName);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Actions = new AllowedActions(ProfileHelper.UserInfo);
            MyStaff = ProfileHelper.UserInfo.IsMe();
            UserHasAvatar = !UserPhotoManager.GetPhotoAbsoluteWebPath(ProfileHelper.UserInfo.ID).Contains("default/images/");
            HasActions = Actions.AllowEdit || Actions.AllowAddOrDelete;
            IsAdmin = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).IsAdmin();

            if (HasActions && Actions.AllowAddOrDelete)
            {
                _phConfirmationDeleteUser.Controls.Add(LoadControl(ConfirmationDeleteUser.Location));
            }

            ProfileEditLink =
                Page is MyStaff
                    ? "/my.aspx?action=edit"
                    : "profileaction.aspx?action=edit&user="******"email_change"] == "success")
            {
                Page.RegisterInlineScript(string.Format("toastr.success(\"{0}\");", Resource.ChangeEmailSuccess));
            }
        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (UserProfileHelper == null)
            {
                UserProfileHelper = new ProfileHelper(SecurityContext.CurrentAccount.ID.ToString());
            }
            UserInfo         = UserProfileHelper.UserInfo;
            ShowSocialLogins = UserInfo.IsMe();

            EnableOauth = CoreContext.Configuration.Standalone ||
                          CoreContext.TenantManager.GetTenantQuota(TenantProvider.CurrentTenantID).Oauth;

            TariffPageLink = TenantExtra.GetTariffPageLink();

            IsAdmin = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).IsAdmin() ||
                      WebItemSecurity.IsProductAdministrator(WebItemManager.PeopleProductID, SecurityContext.CurrentAccount.ID);

            IsVisitor = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).IsVisitor();

            if (!IsAdmin && (UserInfo.Status != EmployeeStatus.Active))
            {
                Response.Redirect(CommonLinkUtility.GetFullAbsolutePath("~/Products/People/"), true);
            }

            Role = GetRole();

            Actions = new AllowedActions(UserInfo);

            LdapFields = ASC.ActiveDirectory.Base.Settings.LdapSettings.GetImportedFields;

            HappyBirthday = CheckHappyBirthday();

            ContactPhones.DataSource = UserProfileHelper.Phones;
            ContactPhones.DataBind();

            ContactEmails.DataSource = UserProfileHelper.Emails;
            ContactEmails.DataBind();

            ContactMessengers.DataSource = UserProfileHelper.Messengers;
            ContactMessengers.DataBind();

            ContactSoccontacts.DataSource = UserProfileHelper.Contacts;
            ContactSoccontacts.DataBind();

            _deleteProfileContainer.Options.IsPopup = true;

            Page.RegisterStyle("~/UserControls/Users/UserProfile/css/userprofilecontrol_style.less")
            .RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/UserControls/Users/UserProfile/js/userprofilecontrol.js"));

            if (Actions.AllowEdit)
            {
                _editControlsHolder.Controls.Add(LoadControl(PwdTool.Location));
            }
            if (Actions.AllowEdit || (UserInfo.IsOwner() && IsAdmin))
            {
                var control = (UserEmailChange)LoadControl(UserEmailChange.Location);
                control.UserInfo = UserInfo;
                control.RegisterStylesAndScripts = false;
                userEmailChange.Controls.Add(control);
            }

            if (ShowSocialLogins && AccountLinkControl.IsNotEmpty)
            {
                var accountLink = (AccountLinkControl)LoadControl(AccountLinkControl.Location);
                accountLink.ClientCallback = "loginCallback";
                accountLink.SettingsView   = true;
                _accountPlaceholder.Controls.Add(accountLink);
            }

            var emailControl = (UserEmailControl)LoadControl(UserEmailControl.Location);

            emailControl.User   = UserInfo;
            emailControl.Viewer = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            _phEmailControlsHolder.Controls.Add(emailControl);

            var photoControl = (LoadPhotoControl)LoadControl(LoadPhotoControl.Location);

            photoControl.User = UserInfo;
            loadPhotoWindow.Controls.Add(photoControl);

            if (UserInfo.IsMe() && SetupInfo.EnabledCultures.Count > 1)
            {
                _phLanguage.Controls.Add(LoadControl(UserLanguage.Location));
            }

            if ((UserInfo.IsLDAP() && !String.IsNullOrEmpty(UserInfo.MobilePhone)) ||
                !String.IsNullOrEmpty(UserInfo.MobilePhone) ||
                UserInfo.IsMe())
            {
                ShowPrimaryMobile = true;
                if (Actions.AllowEdit && (!UserInfo.IsLDAP() || UserInfo.IsLDAP() && !LdapFields.Contains(LdapMapping.MobilePhoneAttribute)))
                {
                    var changeMobile = (ChangeMobileNumber)LoadControl(ChangeMobileNumber.Location);
                    changeMobile.User = UserInfo;
                    ChangeMobileHolder.Controls.Add(changeMobile);
                }
            }

            if (TfaAppAuthSettings.IsVisibleSettings && TfaAppAuthSettings.Enable && TfaAppUserSettings.EnableForUser(UserInfo.ID) && (UserInfo.IsMe() || IsAdmin))
            {
                ShowTfaAppSettings = true;

                if (UserInfo.IsMe() || IsAdmin)
                {
                    var resetApp = (ResetAppDialog)LoadControl(ResetAppDialog.Location);
                    resetApp.User = UserInfo;
                    _backupCodesPlaceholder.Controls.Add(resetApp);
                }
                if (UserInfo.IsMe())
                {
                    var showBackup = (ShowBackupCodesDialog)LoadControl(ShowBackupCodesDialog.Location);
                    showBackup.User = UserInfo;
                    _backupCodesPlaceholder.Controls.Add(showBackup);
                }
            }

            if (UserInfo.BirthDate.HasValue)
            {
                switch (HappyBirthday)
                {
                case 0:
                    BirthDayText = Resource.DrnToday;
                    break;

                case 1:
                    BirthDayText = Resource.DrnTomorrow;
                    break;

                case 2:
                    BirthDayText = Resource.In + " " + DateTimeExtension.Yet(2);
                    break;

                case 3:
                    BirthDayText = Resource.In + " " + DateTimeExtension.Yet(3);
                    break;

                default:
                    BirthDayText = String.Empty;
                    break;
                }
            }

            if (UserInfo.Status != EmployeeStatus.Terminated)
            {
                Groups = CoreContext.UserManager.GetUserGroups(UserInfo.ID).ToList();
            }
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (UserProfileHelper == null)
            {
                UserProfileHelper = new ProfileHelper(SecurityContext.CurrentAccount.ID.ToString());
            }
            UserInfo         = UserProfileHelper.UserInfo;
            ShowSocialLogins = UserInfo.IsMe();

            IsAdmin   = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).IsAdmin();
            IsVisitor = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).IsVisitor();

            if (!IsAdmin && (UserInfo.Status != EmployeeStatus.Active))
            {
                Response.Redirect(CommonLinkUtility.GetFullAbsolutePath("~/products/people/"), true);
            }

            AjaxPro.Utility.RegisterTypeForAjax(GetType());
            Actions = new AllowedActions(UserInfo);

            HappyBirthday = CheckHappyBirthday();

            ContactPhones.DataSource = UserProfileHelper.Phones;
            ContactPhones.DataBind();

            ContactEmails.DataSource = UserProfileHelper.Emails;
            ContactEmails.DataBind();

            ContactMessengers.DataSource = UserProfileHelper.Messengers;
            ContactMessengers.DataBind();

            ContactSoccontacts.DataSource = UserProfileHelper.Contacts;
            ContactSoccontacts.DataBind();

            _deleteProfileContainer.Options.IsPopup = true;

            Page.RegisterStyleControl(VirtualPathUtility.ToAbsolute("~/usercontrols/users/userprofile/css/userprofilecontrol_style.less"));
            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/usercontrols/users/userprofile/js/userprofilecontrol.js"));

            if (Actions.AllowEdit)
            {
                _editControlsHolder.Controls.Add(LoadControl(PwdTool.Location));
            }
            if (Actions.AllowEdit || (UserInfo.IsOwner() && IsAdmin))
            {
                var control = (UserEmailChange)LoadControl(UserEmailChange.Location);
                control.UserInfo = UserInfo;
                userEmailChange.Controls.Add(control);
            }

            if (!MobileDetector.IsMobile)
            {
                var thumbnailEditorControl = (ThumbnailEditor)LoadControl(ThumbnailEditor.Location);
                thumbnailEditorControl.Title            = Resource.TitleThumbnailPhoto;
                thumbnailEditorControl.BehaviorID       = "UserPhotoThumbnail";
                thumbnailEditorControl.JcropMinSize     = UserPhotoManager.SmallFotoSize;
                thumbnailEditorControl.JcropAspectRatio = 1;
                thumbnailEditorControl.SaveFunctionType = typeof(SavePhotoThumbnails);
                _editControlsHolder.Controls.Add(thumbnailEditorControl);
            }

            if (ShowSocialLogins && AccountLinkControl.IsNotEmpty)
            {
                var accountLink = (AccountLinkControl)LoadControl(AccountLinkControl.Location);
                accountLink.ClientCallback = "loginCallback";
                accountLink.SettingsView   = true;
                _accountPlaceholder.Controls.Add(accountLink);
            }

            var emailControl = (UserEmailControl)LoadControl(UserEmailControl.Location);

            emailControl.User   = UserInfo;
            emailControl.Viewer = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            _phEmailControlsHolder.Controls.Add(emailControl);

            var photoControl = (LoadPhotoControl)LoadControl(LoadPhotoControl.Location);

            loadPhotoWindow.Controls.Add(photoControl);

            if (UserInfo.IsMe())
            {
                _phLanguage.Controls.Add(LoadControl(UserLanguage.Location));
            }

            if (StudioSmsNotificationSettings.IsVisibleSettings && (Actions.AllowEdit && !String.IsNullOrEmpty(UserInfo.MobilePhone) || UserInfo.IsMe()))
            {
                ShowPrimaryMobile = true;
                var changeMobile = (ChangeMobileNumber)LoadControl(ChangeMobileNumber.Location);
                changeMobile.User = UserInfo;
                ChangeMobileHolder.Controls.Add(changeMobile);
            }

            if (UserInfo.BirthDate.HasValue)
            {
                switch (HappyBirthday)
                {
                case 0:
                    BirthDayText = Resource.DrnToday;
                    break;

                case 1:
                    BirthDayText = Resource.DrnTomorrow;
                    break;

                case 2:
                    BirthDayText = Resource.In + " " + DateTimeExtension.Yet(2);
                    break;

                case 3:
                    BirthDayText = Resource.In + " " + DateTimeExtension.Yet(3);
                    break;

                default:
                    BirthDayText = String.Empty;
                    break;
                }
            }

            if (UserInfo.Status != EmployeeStatus.Terminated)
            {
                List <GroupInfo> Groups = CoreContext.UserManager.GetUserGroups(UserInfo.ID).ToList();
                if (!Groups.Any())
                {
                    DepartmentsRepeater.Visible = false;
                }
                else
                {
                    Groups.Sort((group1, group2) => String.Compare(group1.Name, group2.Name, StringComparison.Ordinal));
                }

                DepartmentsRepeater.DataSource = Groups;
                DepartmentsRepeater.DataBind();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (UserProfileHelper == null)
            {
                UserProfileHelper = new ProfileHelper(SecurityContext.CurrentAccount.ID.ToString());
            }

            UserProfile = UserProfileHelper.userProfile;
            ShowSocialLogins = UserProfileHelper.isMe;
            UserInfo = UserProfileHelper.UserInfo;

            IsAdmin = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).IsAdmin();

            if (!IsAdmin && (UserInfo.Status != EmployeeStatus.Active))
            {
                Response.Redirect(CommonLinkUtility.GetFullAbsolutePath("~/products/people/"), true);
            }

            AjaxPro.Utility.RegisterTypeForAjax(GetType());
            Actions = new AllowedActions(UserInfo);
            HappyBirthday = CheckHappyBirthday();

            ContactPhones.DataSource = UserProfile.Phones;
            ContactPhones.DataBind();

            ContactEmails.DataSource = UserProfile.Emails;
            ContactEmails.DataBind();

            ContactMessengers.DataSource = UserProfile.Messengers;
            ContactMessengers.DataBind();

            ContactSoccontacts.DataSource = UserProfile.Contacts;
            ContactSoccontacts.DataBind();

            _deleteProfileContainer.Options.IsPopup = true;

            Page.RegisterStyleControl(VirtualPathUtility.ToAbsolute("~/usercontrols/users/userprofile/css/userprofilecontrol_style.less"));
            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/usercontrols/users/userprofile/js/userprofilecontrol.js"));

            Page.RegisterStyleControl(VirtualPathUtility.ToAbsolute("~/skins/default/toastr.css"));
            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/js/third-party/jquery/toastr.js"));

            if (Actions.AllowEdit)
            {
                _editControlsHolder.Controls.Add(LoadControl(PwdTool.Location));
            }
            if (Actions.AllowEdit || (UserInfo.IsOwner() && IsAdmin))
            {
                var control = (UserEmailChange)LoadControl(UserEmailChange.Location);
                control.UserInfo = UserInfo;
                userEmailChange.Controls.Add(control);
            }

            if (!Web.Core.Mobile.MobileDetector.IsRequestMatchesMobile(Context))
            {
                var thumbnailEditorControl = (ThumbnailEditor)LoadControl(ThumbnailEditor.Location);
                thumbnailEditorControl.Title = Resource.TitleThumbnailPhoto;
                thumbnailEditorControl.BehaviorID = "UserPhotoThumbnail";
                thumbnailEditorControl.JcropMinSize = UserPhotoManager.SmallFotoSize;
                thumbnailEditorControl.JcropAspectRatio = 1;
                thumbnailEditorControl.SaveFunctionType = typeof(SavePhotoThumbnails);
                _editControlsHolder.Controls.Add(thumbnailEditorControl);
            }

            if (ShowSocialLogins && AccountLinkControl.IsNotEmpty)
            {
                var accountLink = (AccountLinkControl)LoadControl(AccountLinkControl.Location);
                accountLink.ClientCallback = "loginCallback";
                accountLink.SettingsView = true;
                _accountPlaceholder.Controls.Add(accountLink);
            }

            var emailControl = (UserEmailControl)LoadControl(UserEmailControl.Location);
            emailControl.User = UserInfo;
            emailControl.Viewer = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            _phEmailControlsHolder.Controls.Add(emailControl);

            var photoControl = (LoadPhotoControl)LoadControl(LoadPhotoControl.Location);
            loadPhotoWindow.Controls.Add(photoControl);

            if (UserInfo.IsMe())
            {
                _phLanguage.Controls.Add(LoadControl(UserLanguage.Location));
            }

            if (StudioSmsNotificationSettings.IsVisibleSettings && (Actions.AllowEdit && !String.IsNullOrEmpty(UserInfo.MobilePhone) || UserInfo.IsMe()))
            {
                ShowPrimaryMobile = true;
                var changeMobile = (ChangeMobileNumber)LoadControl(ChangeMobileNumber.Location);
                changeMobile.User = UserInfo;
                ChangeMobileHolder.Controls.Add(changeMobile);
            }

            if (UserInfo.BirthDate.HasValue)
            {
                switch (HappyBirthday)
                {
                    case 0:
                        BirthDayText = Resource.DrnToday;
                        break;
                    case 1:
                        BirthDayText = Resource.DrnTomorrow;
                        break;
                    case 2:
                        BirthDayText = Resource.In + " " + DateTimeExtension.Yet(2);
                        break;
                    case 3:
                        BirthDayText = Resource.In + " " + DateTimeExtension.Yet(3);
                        break;
                    default:
                        BirthDayText = String.Empty;
                        break;
                }
            }
        }