Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ProfileHelper = new ProfileHelper(Request["user"]);

            Title = HeaderStringHelper.GetPageTitle(UserInfo.DisplayName);

            var control = (UserProfileControl)LoadControl(UserProfileControl.Location);
            control.UserProfileHelper = ProfileHelper;

            CommonContainerHolder.Controls.Add(control);

            var actions = (UserProfileActions)LoadControl(UserProfileActions.Location);
            actions.MyStaff = ProfileHelper.isMe;
            actions.profileHelper = ProfileHelper;
            actions.Actions = new AllowedActions(ProfileHelper.UserInfo);
            actionsHolder.Controls.Add(actions);

            if (IsMe)
            {
                InitSubscriptionView();

                var script = new StringBuilder();
                script.Append("jq('#switcherSubscriptionButton').one('click',");
                script.Append("function() {");
                script.Append("if (!jq('#subscriptionBlockContainer').hasClass('subsLoaded') &&");
                script.Append("typeof (window.CommonSubscriptionManager) != 'undefined' &&");
                script.Append("typeof (window.CommonSubscriptionManager.LoadSubscriptions) === 'function') {");
                script.Append("window.CommonSubscriptionManager.LoadSubscriptions();");
                script.Append("jq('#subscriptionBlockContainer').addClass('subsLoaded');");
                script.Append("}});");

                Page.RegisterInlineScript(script.ToString());
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            InitScripts();
            Page.RegisterBodyScripts(ResolveUrl("~/js/uploader/ajaxupload.js"));

            Master.DisabledSidePanel = true;

            _helper = new ProfileHelper(Request["user"]);
            UserName = _helper.UserInfo.DisplayUserName(true);
            UserEmail = _helper.UserInfo.Email;

            if (Request.Params["action"] == "edit")
            {
                InitEditControl();
                EditProfileFlag = true;
            }
            else
            {
                InitProfileControl();
                InitTipsSettingsView();
                EditProfileFlag = false;
            }

            Title = HeaderStringHelper.GetPageTitle(Resource.MyProfile);
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!CoreContext.Configuration.YourDocs)
            {
                InitScripts();
            }
            Page.RegisterBodyScripts(ResolveUrl("~/js/uploader/ajaxupload.js"));

            Master.DisabledSidePanel = true;

            helper = new ProfileHelper(Request["user"]);

            UserInfo = helper.userProfile;

            if (Request.Params["action"] == "edit")
            {
                InitEditControl();
                EditProfileFlag = true;
            }
            else
            {
                InitProfileControl();
                EditProfileFlag = false;
            }

            Title = HeaderStringHelper.GetPageTitle(Resource.MyProfile);
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ProfileHelper = new ProfileHelper(Request["user"]);
            var userInfo = ProfileHelper.UserInfo;

            if (userInfo.IsMe() && userInfo.IsVisitor() && IsPageEditProfile())
            {
                Response.Redirect("/my.aspx?action=edit");
            }

            if ((IsPageEditProfile() && !(userInfo.IsMe() || CanEdit()))
                || (!IsPageEditProfile() && !IsAdmin()))
            {
                Response.Redirect("~/products/people/", true);
            }

            var userProfileEditControl = LoadControl(UserProfileEditControl.Location) as UserProfileEditControl;


            _contentHolderForEditForm.Controls.Add(userProfileEditControl);
        }
        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;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            IsPageEditProfileFlag = (Request["action"] == "edit");

            ProfileHelper = new ProfileHelper(Request["user"]);
            UserProfile = ProfileHelper.userProfile;

            if ((IsPageEditProfileFlag && !CanEdit) || (!IsPageEditProfileFlag && !IsAdmin()))
            {
                Response.Redirect("~/products/people/", true);
            }

            Page.RegisterBodyScripts(ResolveUrl("~/usercontrols/users/userprofile/js/userprofileeditcontrol.js"));
            Page.RegisterStyleControl(ResolveUrl("~/usercontrols/users/userprofile/css/profileeditcontrol_style.less"));

            CanAddUser = TenantStatisticsProvider.GetUsersCount() < TenantExtra.GetTenantQuota().ActiveUsers;

            CanEditType = SecurityContext.CheckPermissions(Constants.Action_AddRemoveUser) &&
                          (!(ProfileHelper.UserInfo.IsAdmin() || IsModuleAdmin()) || !IsPageEditProfileFlag);

            if (IsPageEditProfileFlag)
            {
                Phone = UserProfile.Phone;
                ProfileGender = UserProfile.Sex.HasValue ? UserProfile.Sex.Value ? "1" : "0" : "-1";
                Departments = CoreContext.UserManager.GetUserGroups(UserProfile.Id);
                SocContacts = UserProfile.Contacts;
                OtherContacts = new List<MyContact>();
                OtherContacts.AddRange(UserProfile.Emails);
                OtherContacts.AddRange(UserProfile.Messengers);
                OtherContacts.AddRange(UserProfile.Phones);
                var deps = Departments.ToList();

                var script =
                    String.Format(
                        @"<script type='text/javascript'>
                                    var departmentsList = {0};
                                    var socContacts = {1};
                                    var otherContacts = {2};
                                    var userId= {3};
                                  
                </script>",
                        JsonConvert.SerializeObject(deps.ConvertAll(item => new
                            {
                                id = item.ID
                            })),
                        JsonConvert.SerializeObject(SocContacts),
                        JsonConvert.SerializeObject(OtherContacts),
                        JsonConvert.SerializeObject(UserProfile.Id));
                Page.ClientScript.RegisterStartupScript(GetType(), Guid.NewGuid().ToString(), script);
            }

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

            Page.Title = HeaderStringHelper.GetPageTitle(GetTitle());
        }