예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.RegisterStyleControl(VirtualPathUtility.ToAbsolute("~/usercontrols/common/authorize/css/authorize.less"));
            Page.RegisterBodyScripts(ResolveUrl("~/usercontrols/common/authorize/js/authorize.js"));

            Login    = "";
            Password = "";
            HashId   = "";

            //Account link control
            AccountLinkControl accountLink = null;

            if (SetupInfo.ThirdPartyAuthEnabled && AccountLinkControl.IsNotEmpty)
            {
                accountLink                = (AccountLinkControl)LoadControl(AccountLinkControl.Location);
                accountLink.Visible        = true;
                accountLink.ClientCallback = "authCallback";
                accountLink.SettingsView   = false;
                signInPlaceholder.Controls.Add(accountLink);
            }

            //top panel
            var master = Page.Master as BaseTemplate;

            if (master != null)
            {
                master.TopStudioPanel.DisableProductNavigation = true;
                master.TopStudioPanel.DisableSearch            = true;
                master.TopStudioPanel.DisableVideo             = true;
            }

            Page.Title = HeaderStringHelper.GetPageTitle(Resource.Authorization);

            pwdReminderHolder.Controls.Add(LoadControl(PwdTool.Location));

            var msg = Request["m"];

            if (!string.IsNullOrEmpty(msg))
            {
                ErrorMessage = msg;
            }

            var thirdPartyProfile = Request.Url.GetProfile();

            if ((IsPostBack || thirdPartyProfile != null) && !SecurityContext.IsAuthenticated)
            {
                var tryByHash   = false;
                var smsLoginUrl = string.Empty;
                try
                {
                    if (thirdPartyProfile != null)
                    {
                        HashId = thirdPartyProfile.HashId;
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(Request["__EVENTARGUMENT"]) && Request["__EVENTTARGET"] == "signInLogin" && accountLink != null)
                        {
                            HashId = ASC.Common.Utils.Signature.Read <string>(Request["__EVENTARGUMENT"]);
                        }
                    }

                    if (!string.IsNullOrEmpty(Request["login"]))
                    {
                        Login = Request["login"].Trim();
                    }
                    else if (string.IsNullOrEmpty(HashId))
                    {
                        throw new InvalidCredentialException("login");
                    }

                    if (!string.IsNullOrEmpty(Request["pwd"]))
                    {
                        Password = Request["pwd"];
                    }
                    else if (string.IsNullOrEmpty(HashId))
                    {
                        throw new InvalidCredentialException("password");
                    }

                    if (string.IsNullOrEmpty(HashId))
                    {
                        var counter = (int)(cache.Get("loginsec/" + Login) ?? 0);
                        if (++counter % 5 == 0)
                        {
                            Thread.Sleep(TimeSpan.FromSeconds(10));
                        }
                        cache.Insert("loginsec/" + Login, counter, DateTime.UtcNow.Add(TimeSpan.FromMinutes(1)));
                    }

                    if (!ActiveDirectoryUserImporter.TryLdapAuth(Login, Password))
                    {
                        smsLoginUrl = SmsLoginUrl(accountLink);
                        if (string.IsNullOrEmpty(smsLoginUrl))
                        {
                            if (string.IsNullOrEmpty(HashId))
                            {
                                var cookiesKey = SecurityContext.AuthenticateMe(Login, Password);
                                CookiesManager.SetCookies(CookiesType.AuthKey, cookiesKey);
                                MessageService.Send(HttpContext.Current.Request, MessageAction.LoginSuccess);
                            }
                            else
                            {
                                Guid userId;
                                tryByHash = TryByHashId(accountLink, HashId, out userId);
                                var cookiesKey = SecurityContext.AuthenticateMe(userId);
                                CookiesManager.SetCookies(CookiesType.AuthKey, cookiesKey);
                                MessageService.Send(HttpContext.Current.Request, MessageAction.LoginSuccessViaSocialAccount);
                            }
                        }
                    }
                }
                catch (InvalidCredentialException)
                {
                    Auth.ProcessLogout();
                    ErrorMessage = tryByHash ? Resource.LoginWithAccountNotFound : Resource.InvalidUsernameOrPassword;

                    var loginName = tryByHash && !string.IsNullOrWhiteSpace(HashId)
                        ? HashId
                        : string.IsNullOrWhiteSpace(Login) ? AuditResource.EmailNotSpecified : Login;
                    var messageAction = tryByHash ? MessageAction.LoginFailSocialAccountNotFound : MessageAction.LoginFailInvalidCombination;

                    MessageService.Send(HttpContext.Current.Request, loginName, messageAction);

                    return;
                }
                catch (System.Security.SecurityException)
                {
                    Auth.ProcessLogout();
                    ErrorMessage = Resource.ErrorDisabledProfile;
                    MessageService.Send(HttpContext.Current.Request, Login, MessageAction.LoginFailDisabledProfile);
                    return;
                }
                catch (Exception ex)
                {
                    Auth.ProcessLogout();
                    ErrorMessage = ex.Message;
                    MessageService.Send(HttpContext.Current.Request, Login, MessageAction.LoginFail);
                    return;
                }

                if (!string.IsNullOrEmpty(smsLoginUrl))
                {
                    Response.Redirect(smsLoginUrl);
                }

                var refererURL = (string)Session["refererURL"];
                if (string.IsNullOrEmpty(refererURL))
                {
                    Response.Redirect(CommonLinkUtility.GetDefault());
                }
                else
                {
                    Session["refererURL"] = null;
                    Response.Redirect(refererURL);
                }
            }
            ProcessConfirmedEmailCondition();
        }
예제 #2
0
        protected override void PageLoad()
        {
            if (!CRMSecurity.IsAdmin)
            {
                Response.Redirect(PathProvider.StartURL());
            }

            Page.RegisterBodyScripts(PathProvider.GetFileStaticRelativePath,
                                     "settings.js",
                                     "settings.invoices.js"
                                     );

            var          typeValue = (HttpContext.Current.Request["type"] ?? "common").ToLower();
            ListItemView listItemViewControl;

            string titlePage;

            switch (typeValue)
            {
            case "common":
                CommonContainerHolder.Controls.Add(LoadControl(CommonSettingsView.Location));

                titlePage = CRMSettingResource.CommonSettings;
                break;

            case "currency":
                CommonContainerHolder.Controls.Add(LoadControl(CurrencySettingsView.Location));

                titlePage = CRMSettingResource.CurrencySettings;
                break;

            case "deal_milestone":
                var dealMilestoneViewControl = (DealMilestoneView)LoadControl(DealMilestoneView.Location);
                CommonContainerHolder.Controls.Add(dealMilestoneViewControl);

                titlePage = CRMDealResource.DealMilestone;
                break;

            case "task_category":
                listItemViewControl = (ListItemView)LoadControl(ListItemView.Location);
                listItemViewControl.CurrentTypeValue   = ListType.TaskCategory;
                listItemViewControl.AddButtonText      = CRMSettingResource.AddThisCategory;
                listItemViewControl.AddPopupWindowText = CRMSettingResource.CreateNewCategory;
                listItemViewControl.AddListButtonText  = CRMSettingResource.CreateNewCategoryListButton;

                listItemViewControl.AjaxProgressText          = CRMSettingResource.CreateCategoryInProgressing;
                listItemViewControl.DeleteText                = CRMSettingResource.DeleteCategory;
                listItemViewControl.EditText                  = CRMSettingResource.EditCategory;
                listItemViewControl.EditPopupWindowText       = CRMSettingResource.EditSelectedCategory;
                listItemViewControl.DescriptionText           = CRMSettingResource.DescriptionTextTaskCategory;
                listItemViewControl.DescriptionTextEditDelete = CRMSettingResource.DescriptionTextTaskCategoryEditDelete;
                listItemViewControl.HeaderText                = CRMTaskResource.TaskCategories;
                CommonContainerHolder.Controls.Add(listItemViewControl);
                titlePage = CRMTaskResource.TaskCategories;
                break;

            case "history_category":
                listItemViewControl = (ListItemView)LoadControl(ListItemView.Location);
                listItemViewControl.CurrentTypeValue          = ListType.HistoryCategory;
                listItemViewControl.AddButtonText             = CRMSettingResource.AddThisCategory;
                listItemViewControl.AddPopupWindowText        = CRMSettingResource.CreateNewCategory;
                listItemViewControl.AddListButtonText         = CRMSettingResource.CreateNewCategoryListButton;
                listItemViewControl.AjaxProgressText          = CRMSettingResource.CreateCategoryInProgressing;
                listItemViewControl.DeleteText                = CRMSettingResource.DeleteCategory;
                listItemViewControl.EditText                  = CRMSettingResource.EditCategory;
                listItemViewControl.EditPopupWindowText       = CRMSettingResource.EditSelectedCategory;
                listItemViewControl.DescriptionText           = CRMSettingResource.DescriptionTextHistoryCategory;
                listItemViewControl.DescriptionTextEditDelete = CRMSettingResource.DescriptionTextHistoryCategoryEditDelete;
                listItemViewControl.HeaderText                = CRMSettingResource.HistoryCategories;
                CommonContainerHolder.Controls.Add(listItemViewControl);
                titlePage = CRMSettingResource.HistoryCategories;
                break;

            case "contact_stage":
                listItemViewControl = (ListItemView)LoadControl(ListItemView.Location);
                listItemViewControl.CurrentTypeValue   = ListType.ContactStatus;
                listItemViewControl.AddButtonText      = CRMSettingResource.AddThisStage;
                listItemViewControl.AddPopupWindowText = CRMSettingResource.CreateNewStage;
                listItemViewControl.AddListButtonText  = CRMSettingResource.CreateNewStageListButton;

                listItemViewControl.AjaxProgressText          = CRMSettingResource.CreateContactStageInProgressing;
                listItemViewControl.DeleteText                = CRMSettingResource.DeleteContactStage;
                listItemViewControl.EditText                  = CRMSettingResource.EditContactStage;
                listItemViewControl.EditPopupWindowText       = CRMSettingResource.EditSelectedContactStage;
                listItemViewControl.DescriptionText           = CRMSettingResource.DescriptionTextContactStage;
                listItemViewControl.DescriptionTextEditDelete = CRMSettingResource.DescriptionTextContactStageEditDelete;
                listItemViewControl.HeaderText                = CRMContactResource.ContactStages;
                CommonContainerHolder.Controls.Add(listItemViewControl);
                titlePage = CRMContactResource.ContactStages;
                break;

            case "contact_type":
                listItemViewControl = (ListItemView)LoadControl(ListItemView.Location);
                listItemViewControl.CurrentTypeValue   = ListType.ContactType;
                listItemViewControl.AddButtonText      = CRMSettingResource.AddThisContactType;
                listItemViewControl.AddPopupWindowText = CRMSettingResource.CreateNewContactType;
                listItemViewControl.AddListButtonText  = CRMSettingResource.CreateNewContactTypeListButton;

                listItemViewControl.AjaxProgressText          = CRMSettingResource.CreateContactTypeInProgressing;
                listItemViewControl.DeleteText                = CRMSettingResource.DeleteContactType;
                listItemViewControl.EditText                  = CRMSettingResource.EditContactType;
                listItemViewControl.EditPopupWindowText       = CRMSettingResource.EditSelectedContactType;
                listItemViewControl.DescriptionText           = CRMSettingResource.DescriptionTextContactType;
                listItemViewControl.DescriptionTextEditDelete = CRMSettingResource.DescriptionTextContactTypeEditDelete;
                listItemViewControl.HeaderText                = CRMSettingResource.ContactTypes;
                CommonContainerHolder.Controls.Add(listItemViewControl);
                titlePage = CRMSettingResource.ContactTypes;
                break;

            case "tag":
                var tagSettingsViewControl = (TagSettingsView)LoadControl(TagSettingsView.Location);
                CommonContainerHolder.Controls.Add(tagSettingsViewControl);

                titlePage = CRMCommonResource.Tags;
                break;

            case "web_to_lead_form":
                CommonContainerHolder.Controls.Add(LoadControl(WebToLeadFormView.Location));
                titlePage = CRMSettingResource.WebToLeadsForm;
                break;
            //case "task_template":
            //    CommonContainerHolder.Controls.Add(LoadControl(TaskTemplateView.Location));

            //    titlePage = CRMSettingResource.TaskTemplates;
            //    break;

            case "invoice_items":

                var actionValue = (HttpContext.Current.Request["action"] ?? "").ToLower();
                if (!String.IsNullOrEmpty(actionValue) && actionValue == "manage")
                {
                    var         idParam           = HttpContext.Current.Request["id"];
                    InvoiceItem targetInvoiceItem = null;

                    if (!String.IsNullOrEmpty(idParam))
                    {
                        targetInvoiceItem = DaoFactory.InvoiceItemDao.GetByID(Convert.ToInt32(idParam));
                        if (targetInvoiceItem == null)
                        {
                            Response.Redirect(PathProvider.StartURL() + "settings.aspx?type=invoice_items");
                        }
                    }


                    var invoiceProductsViewControl = (InvoiceItemActionView)LoadControl(InvoiceItemActionView.Location);
                    invoiceProductsViewControl.TargetInvoiceItem = targetInvoiceItem;
                    CommonContainerHolder.Controls.Add(invoiceProductsViewControl);

                    titlePage = CRMCommonResource.ProductsAndServices;

                    var headerTitle = targetInvoiceItem == null ?
                                      CRMInvoiceResource.CreateNewInvoiceItem :
                                      String.Format(CRMInvoiceResource.UpdateInvoiceItem, targetInvoiceItem.Title);
                    Master.CurrentPageCaption = headerTitle;
                    Title = HeaderStringHelper.GetPageTitle(headerTitle);
                }
                else
                {
                    var invoiceProductsViewControl = (InvoiceItemsView)LoadControl(InvoiceItemsView.Location);
                    CommonContainerHolder.Controls.Add(invoiceProductsViewControl);

                    titlePage = CRMCommonResource.ProductsAndServices;
                }
                break;

            case "invoice_tax":
                var invoiceTaxesViewControl = (InvoiceTaxesView)LoadControl(InvoiceTaxesView.Location);
                CommonContainerHolder.Controls.Add(invoiceTaxesViewControl);

                titlePage = CRMCommonResource.InvoiceTaxes;

                break;

            case "organisation_profile":
                var organisationProfileControl = (OrganisationProfile)LoadControl(OrganisationProfile.Location);
                CommonContainerHolder.Controls.Add(organisationProfileControl);

                titlePage = CRMCommonResource.OrganisationProfile;

                break;

            case "voip.common":
                var voIPCommon = (VoipCommon)LoadControl(VoipCommon.Location);
                CommonContainerHolder.Controls.Add(voIPCommon);

                titlePage = CRMCommonResource.VoIPCommonSettings;

                break;

            case "voip.numbers":
                var voIPNumbers = (VoipNumbers)LoadControl(VoipNumbers.Location);
                CommonContainerHolder.Controls.Add(voIPNumbers);

                titlePage = CRMCommonResource.VoIPNumbersSettings;

                break;

            default:
                CommonContainerHolder.Controls.Add(LoadControl(CustomFieldsView.Location));

                titlePage = CRMSettingResource.CustomFields;
                break;
            }

            Title = HeaderStringHelper.GetPageTitle(Master.CurrentPageCaption ?? titlePage);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.RegisterBodyScripts(
                "~/js/third-party/xregexp.js",
                "~/UserControls/Management/ConfirmActivation/js/confirmactivation.js")
            .RegisterStyle("~/UserControls/Management/ConfirmActivation/css/confirmactivation.less");
            Page.Title = HeaderStringHelper.GetPageTitle(Resource.Authorization);

            var email = (Request["email"] ?? "").Trim();

            if (string.IsNullOrEmpty(email))
            {
                ShowError(Resource.ErrorNotCorrectEmail);
                return;
            }

            Type = typeof(ConfirmType).TryParseEnum(Request["type"] ?? "", ConfirmType.EmpInvite);

            try
            {
                if (Type == ConfirmType.EmailChange)
                {
                    User       = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
                    User.Email = email;
                    CoreContext.UserManager.SaveUserInfo(User);
                    MessageService.Send(Request, MessageAction.UserUpdatedEmail);

                    ActivateMail(User);
                    const string successParam = "email_change=success";
                    if (User.IsVisitor())
                    {
                        Response.Redirect(CommonLinkUtility.ToAbsolute("~/My.aspx?" + successParam), true);
                    }
                    Response.Redirect(string.Format("{0}&{1}", User.GetUserProfilePageURL(), successParam), true);
                    return;
                }

                User = CoreContext.UserManager.GetUserByEmail(email);
                if (User.ID.Equals(Constants.LostUser.ID))
                {
                    ShowError(string.Format(Resource.ErrorUserNotFoundByEmail, email));
                    return;
                }

                if (!User.ID.Equals(SecurityContext.CurrentAccount.ID))
                {
                    Auth.ProcessLogout();
                }

                UserAuth(User);
                ActivateMail(User);

                passwordSetter.Visible        = true;
                ButtonEmailAndPasswordOK.Text = Resource.EmailAndPasswordOK;
            }
            catch (ThreadAbortException)
            {
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
            }

            if (IsPostBack)
            {
                LoginToPortal();
            }
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ForumManager.Instance.SetCurrentPage(ForumPage.Search);

            var currentPageNumber = 0;

            if (!String.IsNullOrEmpty(Request["p"]))
            {
                try
                {
                    currentPageNumber = Convert.ToInt32(Request["p"]);
                }
                catch
                {
                    currentPageNumber = 0;
                }
            }
            if (currentPageNumber <= 0)
            {
                currentPageNumber = 1;
            }

            var findTopicList = new List <Topic>();
            var topicCount    = 0;

            var searchText = "";

            _tagID       = 0;
            _isFindByTag = false;

            var tagName = "";

            if (!String.IsNullOrEmpty(Request["tag"]))
            {
                _isFindByTag = true;
                try
                {
                    _tagID = Convert.ToInt32(Request["tag"]);
                }
                catch
                {
                    _tagID = 0;
                }

                findTopicList = ForumDataProvider.SearchTopicsByTag(TenantProvider.CurrentTenantID, _tagID, currentPageNumber, ForumManager.Settings.TopicCountOnPage, out topicCount);
            }
            else if (!String.IsNullOrEmpty(Request["search"]))
            {
                searchText    = Request["search"];
                findTopicList = ForumDataProvider.SearchTopicsByText(TenantProvider.CurrentTenantID, searchText, currentPageNumber, ForumManager.Settings.TopicCountOnPage, out topicCount);
            }

            if (findTopicList.Count > 0)
            {
                _isFind = true;

                var i = 0;
                foreach (var topic in findTopicList)
                {
                    if (i == 0)
                    {
                        foreach (var tag in topic.Tags)
                        {
                            if (tag.ID == _tagID)
                            {
                                tagName = tag.Name;
                                break;
                            }
                        }
                    }

                    var topicControl = (TopicControl)LoadControl(ForumManager.Settings.UserControlsVirtualPath + "/TopicControl.ascx");
                    topicControl.SettingsID       = ForumManager.Settings.ID;
                    topicControl.Topic            = topic;
                    topicControl.IsShowThreadName = true;
                    topicControl.IsEven           = (i % 2 == 0);
                    topicListHolder.Controls.Add(topicControl);
                    i++;
                }

                var pageNavigator = new PageNavigator
                {
                    CurrentPageNumber = currentPageNumber,
                    EntryCountOnPage  = ForumManager.Settings.TopicCountOnPage,
                    VisiblePageCount  = 5,
                    EntryCount        = topicCount
                };
                if (_isFindByTag)
                {
                    pageNavigator.PageUrl = _isFindByTag
                                                ? "search.aspx?tag=" + _tagID.ToString()
                                                : "search.aspx?search=" + HttpUtility.UrlEncode(searchText, Encoding.UTF8);
                }

                bottomPageNavigatorHolder.Controls.Add(pageNavigator);
            }
            else
            {
                var emptyScreenControl = new EmptyScreenControl
                {
                    ImgSrc   = WebImageSupplier.GetAbsoluteWebPath("forums_icon.png", ForumManager.Settings.ModuleID),
                    Header   = Resources.ForumResource.EmptyScreenSearchCaption,
                    Describe = Resources.ForumResource.EmptyScreenSearchText,
                };

                topicListHolder.Controls.Add(emptyScreenControl);
            }

            (Master as ForumMasterPage).CurrentPageCaption = HeaderStringHelper.GetHTMLSearchHeader(_isFindByTag ? tagName : searchText);

            Title = HeaderStringHelper.GetPageTitle((Master as ForumMasterPage).CurrentPageCaption);
        }
예제 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     HelpHolder.Controls.Add(LoadControl(HelpCenter.Location));
     Title = HeaderStringHelper.GetPageTitle(Resource.HelpCenter);
 }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.RegisterBodyScripts("~/usercontrols/management/confirminviteactivation/js/confirm_invite_activation.js");

            Page.RegisterStyle("~/usercontrols/management/confirminviteactivation/css/confirm_invite_activation.less");

            var uid = Guid.Empty;

            try
            {
                uid = new Guid(Request["uid"]);
            }
            catch
            {
            }

            var email = GetEmailAddress();

            if (_type != ConfirmType.Activation && AccountLinkControl.IsNotEmpty && !CoreContext.Configuration.Personal)
            {
                var thrd = (AccountLinkControl)LoadControl(AccountLinkControl.Location);
                thrd.InviteView     = true;
                thrd.ClientCallback = "loginJoinCallback";
                thrdParty.Visible   = true;
                thrdParty.Controls.Add(thrd);
            }

            Page.Title = HeaderStringHelper.GetPageTitle(Resource.Authorization);

            UserInfo user;

            try
            {
                SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem);

                user = CoreContext.UserManager.GetUserByEmail(email);
                var usr = CoreContext.UserManager.GetUsers(uid);
                if (usr.ID.Equals(ASC.Core.Users.Constants.LostUser.ID) || usr.ID.Equals(ASC.Core.Configuration.Constants.Guest.ID))
                {
                    usr = CoreContext.UserManager.GetUsers(CoreContext.TenantManager.GetCurrentTenant().OwnerId);
                }

                _userAvatar = usr.GetMediumPhotoURL();
                _userName   = usr.DisplayUserName(true);
                _userPost   = (usr.Title ?? "").HtmlEncode();
            }
            finally
            {
                SecurityContext.Logout();
            }

            if (_type == ConfirmType.LinkInvite || _type == ConfirmType.EmpInvite)
            {
                if (TenantStatisticsProvider.GetUsersCount() >= TenantExtra.GetTenantQuota().ActiveUsers&& _employeeType == EmployeeType.User)
                {
                    ShowError(UserControlsCommonResource.TariffUserLimitReason);
                    return;
                }

                if (!user.ID.Equals(ASC.Core.Users.Constants.LostUser.ID))
                {
                    ShowError(CustomNamingPeople.Substitute <Resource>("ErrorEmailAlreadyExists"));
                    return;
                }
            }

            else if (_type == ConfirmType.Activation)
            {
                if (user.IsActive)
                {
                    ShowError(Resource.ErrorConfirmURLError);
                    return;
                }

                if (user.ID.Equals(ASC.Core.Users.Constants.LostUser.ID) || user.Status == EmployeeStatus.Terminated)
                {
                    ShowError(string.Format(Resource.ErrorUserNotFoundByEmail, email));
                    return;
                }
            }

            var tenant = CoreContext.TenantManager.GetCurrentTenant();

            if (tenant != null)
            {
                var settings = SettingsManager.Instance.LoadSettings <IPRestrictionsSettings>(tenant.TenantId);
                if (settings.Enable && !IPSecurity.IPSecurity.Verify(tenant.TenantId))
                {
                    ShowError(Resource.ErrorAccessRestricted);
                    return;
                }
            }

            if (!IsPostBack)
            {
                return;
            }

            var          firstName          = GetFirstName();
            var          lastName           = GetLastName();
            var          pwd                = (Request["pwdInput"] ?? "").Trim();
            var          mustChangePassword = false;
            LoginProfile thirdPartyProfile;

            //thirdPartyLogin confirmInvite
            if (Request["__EVENTTARGET"] == "thirdPartyLogin")
            {
                var valueRequest = Request["__EVENTARGUMENT"];
                thirdPartyProfile = new LoginProfile(valueRequest);

                if (!string.IsNullOrEmpty(thirdPartyProfile.AuthorizationError))
                {
                    // ignore cancellation
                    if (thirdPartyProfile.AuthorizationError != "Canceled at provider")
                    {
                        ShowError(HttpUtility.HtmlEncode(thirdPartyProfile.AuthorizationError));
                    }
                    return;
                }

                if (string.IsNullOrEmpty(thirdPartyProfile.EMail))
                {
                    ShowError(HttpUtility.HtmlEncode(Resource.ErrorNotCorrectEmail));
                    return;
                }
            }

            if (Request["__EVENTTARGET"] == "confirmInvite")
            {
                if (String.IsNullOrEmpty(email))
                {
                    _errorMessage = Resource.ErrorEmptyUserEmail;
                    return;
                }

                if (!email.TestEmailRegex())
                {
                    _errorMessage = Resource.ErrorNotCorrectEmail;
                    return;
                }

                if (String.IsNullOrEmpty(firstName))
                {
                    _errorMessage = Resource.ErrorEmptyUserFirstName;
                    return;
                }

                if (String.IsNullOrEmpty(lastName))
                {
                    _errorMessage = Resource.ErrorEmptyUserLastName;
                    return;
                }

                var checkPassResult = CheckPassword(pwd);
                if (!String.IsNullOrEmpty(checkPassResult))
                {
                    _errorMessage = checkPassResult;
                    return;
                }
            }
            var userID = Guid.Empty;

            try
            {
                SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem);
                if (_type == ConfirmType.EmpInvite || _type == ConfirmType.LinkInvite)
                {
                    if (TenantStatisticsProvider.GetUsersCount() >= TenantExtra.GetTenantQuota().ActiveUsers&& _employeeType == EmployeeType.User)
                    {
                        ShowError(UserControlsCommonResource.TariffUserLimitReason);
                        return;
                    }

                    UserInfo newUser;
                    if (Request["__EVENTTARGET"] == "confirmInvite")
                    {
                        var fromInviteLink = _type == ConfirmType.LinkInvite;
                        newUser = CreateNewUser(firstName, lastName, email, pwd, _employeeType, fromInviteLink);

                        var messageAction = _employeeType == EmployeeType.User ? MessageAction.UserCreatedViaInvite : MessageAction.GuestCreatedViaInvite;
                        MessageService.Send(HttpContext.Current.Request, MessageInitiator.System, messageAction, newUser.DisplayUserName(false));

                        userID = newUser.ID;
                    }

                    if (Request["__EVENTTARGET"] == "thirdPartyLogin")
                    {
                        if (!String.IsNullOrEmpty(CheckPassword(pwd)))
                        {
                            pwd = UserManagerWrapper.GeneratePassword();
                            mustChangePassword = true;
                        }
                        var valueRequest = Request["__EVENTARGUMENT"];
                        thirdPartyProfile = new LoginProfile(valueRequest);
                        newUser           = CreateNewUser(GetFirstName(thirdPartyProfile), GetLastName(thirdPartyProfile), GetEmailAddress(thirdPartyProfile), pwd, _employeeType, false);

                        var messageAction = _employeeType == EmployeeType.User ? MessageAction.UserCreatedViaInvite : MessageAction.GuestCreatedViaInvite;
                        MessageService.Send(HttpContext.Current.Request, MessageInitiator.System, messageAction, newUser.DisplayUserName(false));

                        userID = newUser.ID;
                        if (!String.IsNullOrEmpty(thirdPartyProfile.Avatar))
                        {
                            SaveContactImage(userID, thirdPartyProfile.Avatar);
                        }

                        var linker = new AccountLinker("webstudio");
                        linker.AddLink(userID.ToString(), thirdPartyProfile);
                    }
                }
                else if (_type == ConfirmType.Activation)
                {
                    user.ActivationStatus = EmployeeActivationStatus.Activated;
                    user.FirstName        = firstName;
                    user.LastName         = lastName;
                    CoreContext.UserManager.SaveUserInfo(user);
                    SecurityContext.SetUserPassword(user.ID, pwd);

                    userID = user.ID;

                    //notify
                    if (user.IsVisitor())
                    {
                        StudioNotifyService.Instance.GuestInfoAddedAfterInvite(user, pwd);
                        MessageService.Send(HttpContext.Current.Request, MessageInitiator.System, MessageAction.GuestActivated, user.DisplayUserName(false));
                    }
                    else
                    {
                        StudioNotifyService.Instance.UserInfoAddedAfterInvite(user, pwd);
                        MessageService.Send(HttpContext.Current.Request, MessageInitiator.System, MessageAction.UserActivated, user.DisplayUserName(false));
                    }
                }
            }
            catch (Exception exception)
            {
                _errorMessage = HttpUtility.HtmlEncode(exception.Message);
                return;
            }
            finally
            {
                SecurityContext.Logout();
            }

            user = CoreContext.UserManager.GetUsers(userID);
            try
            {
                var cookiesKey = SecurityContext.AuthenticateMe(user.Email, pwd);
                CookiesManager.SetCookies(CookiesType.AuthKey, cookiesKey);
                MessageService.Send(HttpContext.Current.Request, MessageAction.LoginSuccess);
                StudioNotifyService.Instance.UserHasJoin();

                if (mustChangePassword)
                {
                    StudioNotifyService.Instance.UserPasswordChange(user);
                }
            }
            catch (Exception exception)
            {
                (Page as Confirm).ErrorMessage = HttpUtility.HtmlEncode(exception.Message);
                return;
            }

            UserHelpTourHelper.IsNewUser = true;
            if (CoreContext.Configuration.Personal)
            {
                PersonalSettings.IsNewUser = true;
            }
            Response.Redirect("~/");
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(GetType());

            Master.DisabledSidePanel = true;

            Title = HeaderStringHelper.GetPageTitle(Resource.Search);

            var productID = !string.IsNullOrEmpty(Request["productID"]) ? new Guid(Request["productID"]) : Guid.Empty;
            var moduleID  = !string.IsNullOrEmpty(Request["moduleID"]) ? new Guid(Request["moduleID"]) : Guid.Empty;

            SearchText = (Request["search"] ?? "").Trim();

            var searchResultsData = new List <SearchResult>();

            if (!string.IsNullOrEmpty(SearchText))
            {
                List <ISearchHandlerEx> handlers = null;

                var products = !string.IsNullOrEmpty(Request["products"]) ? Request["products"] : string.Empty;
                if (!string.IsNullOrEmpty(products))
                {
                    try
                    {
                        var productsStr  = products.Split(new[] { ',' });
                        var productsGuid = productsStr.Select(p => new Guid(p)).ToArray();

                        handlers = SearchHandlerManager.GetHandlersExForProductModule(productsGuid);
                    }
                    catch (Exception err)
                    {
                        Log.Error(err);
                    }
                }

                if (handlers == null)
                {
                    handlers = SearchHandlerManager.GetHandlersExForProductModule(productID, moduleID);
                }

                searchResultsData = GetSearchresultByHandlers(handlers, SearchText);
            }

            if (searchResultsData.Count <= 0)
            {
                var emptyScreenControl = new EmptyScreenControl
                {
                    ImgSrc   = WebImageSupplier.GetAbsoluteWebPath("empty_search.png"),
                    Header   = Resource.SearchNotFoundMessage,
                    Describe = Resource.SearchNotFoundDescript
                };
                SearchContent.Controls.Add(emptyScreenControl);
            }
            else
            {
                searchResultsData = GroupSearchresult(productID, searchResultsData);
                var oSearchView = (SearchResults)LoadControl(SearchResults.Location);
                oSearchView.SearchResultsData = searchResultsData;
                SearchContent.Controls.Add(oSearchView);
            }
        }
예제 #8
0
        protected void Page_PreLoad(object sender, EventArgs e)
        {
            if (!(this.Master is IStudioMaster))
            {
                return;
            }

            var master = this.Master as IStudioMaster;

            //top navigator
            if (this.Master is StudioTemplate)
            {
                (this.Master as StudioTemplate).TopNavigationPanel.CustomTitle        = CustomNamingPeople.Substitute <Resources.Resource>("Employees");
                (this.Master as StudioTemplate).TopNavigationPanel.CustomTitleURL     = CommonLinkUtility.GetEmployees();
                (this.Master as StudioTemplate).TopNavigationPanel.CustomTitleIconURL = WebImageSupplier.GetAbsoluteWebPath("home.png");
            }

            #region define profile type

            if (!String.IsNullOrEmpty(Request["type"]))
            {
                try
                {
                }
                catch
                {
                }
            }

            #endregion

            _userID    = SecurityContext.CurrentAccount.ID;
            _productID = GetProductID();

            #region find request user

            _userInfo = CoreContext.UserManager.GetUserByUserName(Request[CommonLinkUtility.ParamName_UserUserName]);
            if (_userInfo == null || _userInfo == Constants.LostUser)
            {
                if (!String.IsNullOrEmpty(Request["uid"]))
                {
                    try
                    {
                        _userID = new Guid(Request["uid"]);
                    }
                    catch
                    {
                        _userID = SecurityContext.CurrentAccount.ID;
                    }
                }

                if (!CoreContext.UserManager.UserExists(_userID))
                {
                    //user not found
                    Response.Redirect(CommonLinkUtility.GetEmployees(_productID));
                    return;
                }
                else
                {
                    _userInfo = CoreContext.UserManager.GetUsers(_userID);
                }
            }
            else
            {
                _userID = _userInfo.ID;
            }

            #endregion

            var self = SecurityContext.CurrentAccount.ID.Equals(_userID);

            var container = new Container {
                Body = new PlaceHolder(), Header = new PlaceHolder()
            };
            master.ContentHolder.Controls.Add(container);

            container.BreadCrumbs.Add(new BreadCrumb {
                Caption = CustomNamingPeople.Substitute <Resources.Resource>("Employees"), NavigationUrl = CommonLinkUtility.GetEmployees(_productID)
            });
            container.BreadCrumbs.Add(new BreadCrumb {
                Caption = (self ? Resources.Resource.MyProfile : (_userInfo.DisplayUserName(false))), NavigationUrl = CommonLinkUtility.GetEmployees(_productID)
            });

            Title = HeaderStringHelper.GetPageTitle(CustomNamingPeople.Substitute <Resources.Resource>("Employees"), container.BreadCrumbs);

            //user card
            var userCard = (UserProfileControl)LoadControl(UserProfileControl.Location);
            userCard.UserInfo = _userInfo;
            container.Body.Controls.Add(new Literal
            {
                Text = "<div class=\"headerBase borderBase\" style=\"padding: 0px 0px 5px 15px; border-top:none; border-right:none; border-left:none;\">"
                       + Resources.Resource.PersonalInfo
                       + "</div><div style=\"padding:15px 0px 0px 0px\">"
            });
            container.Body.Controls.Add(userCard);
            container.Body.Controls.Add(new Literal {
                Text = "</div><div style=height:20px;>&nbsp;</div>"
            });


            var product = ProductManager.Instance[_productID];
            if (product != null && product.Context != null && product.Context.UserActivityControlLoader != null)
            {
                container.Body.Controls.Add(product.Context.UserActivityControlLoader.LoadControl(_userID));
                container.Body.Controls.Add(new Literal {
                    Text = "<div style=height:20px;>&nbsp;</div>"
                });
            }
            else
            {
                var isFirst = true;
                foreach (var prod in WebItemManager.Instance.GetItems(Web.Core.WebZones.WebZoneType.All).OfType <IProduct>())
                {
                    if (prod.Context == null || prod.Context.UserActivityControlLoader == null)
                    {
                        continue;
                    }

                    var sb = new StringBuilder();
                    sb.Append("<div id='studio_product_activityBox_" + prod.ID + "' class='borderBase tintMedium clearFix' style='border-left:none; border-right:none; margin-top:-1px; padding:10px;'>");
                    sb.Append("<div class='headerBase' style='float:left; cursor:pointer;' onclick=\"StudioManager.ToggleProductActivity('" + prod.ID + "');\">");
                    var logoURL = prod.GetIconAbsoluteURL();
                    if (!String.IsNullOrEmpty(logoURL))
                    {
                        sb.Append("<img alt='' style='margin-right:5px;' align='absmiddle' src='" + logoURL + "'/>");
                    }
                    sb.Append(prod.Name.HtmlEncode());
                    sb.Append("<img alt='' align='absmiddle' id='studio_activityProductState_" + prod.ID + "' style='margin-left:15px;'  src='" + WebImageSupplier.GetAbsoluteWebPath(isFirst ? "collapse_down_dark.png" : "collapse_right_dark.png") + "'/>");
                    sb.Append("</div>");
                    sb.Append("</div>");
                    sb.Append("<div id=\"studio_product_activity_" + prod.ID + "\" style=\"padding-left:40px; " + (isFirst ? "" : "display:none;") + " padding-top:20px;\">");

                    container.Body.Controls.Add(new Literal {
                        Text = sb.ToString()
                    });
                    var activityControl = prod.Context.UserActivityControlLoader.LoadControl(_userID);
                    container.Body.Controls.Add(activityControl);

                    sb = new StringBuilder();
                    sb.Append("</div>");
                    container.Body.Controls.Add(new Literal {
                        Text = sb.ToString()
                    });

                    isFirst = false;
                }
            }


            Employee.WriteEmployeeActions(this);


            if (SecurityContext.CheckPermissions(Constants.Action_AddRemoveUser))
            {
                master.SideHolder.Controls.Add(Employee.GetEmployeeNavigation());
            }

            var sideControl = (CompanyNavigation)LoadControl(CompanyNavigation.Location);
            master.SideHolder.Controls.Add(sideControl);
        }
예제 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (SetupInfo.WorkMode == WorkMode.Promo)
            {
                Response.Redirect(FeedUrls.MainPageUrl, true);
            }

            Utility.RegisterTypeForAjax(this.GetType());

            if (!CommunitySecurity.CheckPermissions(NewsConst.Action_Add))
            {
                Response.Redirect(FeedUrls.MainPageUrl, true);
            }

            _mobileVer = Core.Mobile.MobileDetector.IsRequestMatchesMobile(this.Context);

            Breadcrumb.Add(new BreadCrumb {
                NavigationUrl = FeedUrls.MainPageUrl, Caption = NewsResource.NewsBreadCrumbs
            });
            if (Info.HasUser)
            {
                Breadcrumb.Add(new BreadCrumb {
                    Caption = Info.User.DisplayUserName(false), NavigationUrl = FeedUrls.GetFeedListUrl(Info.UserId)
                });
            }

            var  storage = FeedStorageFactory.Create();
            Feed feed    = null;

            if (!string.IsNullOrEmpty(Request["docID"]))
            {
                long docID;
                if (long.TryParse(Request["docID"], out docID))
                {
                    feed = storage.GetFeed(docID);
                    Breadcrumb.Add(new BreadCrumb {
                        Caption = feed.Caption ?? string.Empty, NavigationUrl = FeedUrls.GetFeedUrl(docID, Info.UserId)
                    });
                    Breadcrumb.Add(new BreadCrumb {
                        Caption = NewsResource.NewsEditBreadCrumbsNews, NavigationUrl = FeedUrls.EditNewsUrl + "?docID=" + docID + Info.UserIdAttribute
                    });
                    _text = (feed != null ? feed.Text : "").HtmlEncode();
                }
            }
            else
            {
                Breadcrumb.Add(new BreadCrumb {
                    Caption = NewsResource.NewsAddBreadCrumbsNews, NavigationUrl = FeedUrls.EditNewsUrl + (string.IsNullOrEmpty(Info.UserIdAttribute) ? string.Empty : "?" + Info.UserIdAttribute.Substring(1))
                });
            }

            if (_mobileVer && IsPostBack)
            {
                _text = Request["mobiletext"] ?? "";
            }

            if (!IsPostBack)
            {
                //feedNameRequiredFieldValidator.ErrorMessage = NewsResource.RequaredFieldValidatorCaption;
                HTML_FCKEditor.BasePath      = VirtualPathUtility.ToAbsolute(CommonControlsConfigurer.FCKEditorBasePath);
                HTML_FCKEditor.ToolbarSet    = "NewsToolbar";
                HTML_FCKEditor.EditorAreaCSS = WebSkin.GetUserSkin().BaseCSSFileAbsoluteWebPath;
                HTML_FCKEditor.Visible       = !_mobileVer;
                BindNewsTypes();

                if (feed != null)
                {
                    if (!CommunitySecurity.CheckPermissions(feed, NewsConst.Action_Edit))
                    {
                        Response.Redirect(FeedUrls.MainPageName, true);
                    }
                    feedName.Text        = feed.Caption;
                    HTML_FCKEditor.Value = feed.Text;
                    FeedId = feed.Id;
                    feedType.SelectedIndex = (int)Math.Log((int)feed.FeedType, 2);
                }
            }
            else
            {
                var control = FindControl(Request.Params["__EVENTTARGET"]);
                if (lbCancel.Equals(control))
                {
                    CancelFeed(sender, e);
                }
                else
                {
                    SaveFeed();
                }
            }

            this.Title = HeaderStringHelper.GetPageTitle(NewsResource.AddonName, Breadcrumb);

            lbCancel.Attributes["name"] = HTML_FCKEditor.ClientID;
        }
예제 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!CommunitySecurity.CheckPermissions(NewsConst.Action_Add))
            {
                Response.Redirect(FeedUrls.MainPageUrl, true);
            }

            var storage = FeedStorageFactory.Create();

            FeedNS.Feed feed  = null;
            long        docID = 0;

            if (!string.IsNullOrEmpty(Request["docID"]) && long.TryParse(Request["docID"], out docID))
            {
                feed = storage.GetFeed(docID);
            }
            if (!IsPostBack)
            {
                _errorMessage.Text = "";
                if (feed != null)
                {
                    if (!CommunitySecurity.CheckPermissions(feed, NewsConst.Action_Edit))
                    {
                        Response.Redirect(FeedUrls.MainPageUrl, true);
                    }

                    FeedId = docID;
                    var pollFeed = feed as FeedPoll;
                    if (pollFeed != null)
                    {
                        _pollMaster.QuestionFieldID = "feedName";
                        var question = pollFeed;
                        _pollMaster.Singleton = (question.PollType == FeedPollType.SimpleAnswer);
                        _pollMaster.Name      = feed.Caption;
                        _pollMaster.ID        = question.Id.ToString(CultureInfo.CurrentCulture);

                        foreach (var variant in question.Variants)
                        {
                            _pollMaster.AnswerVariants.Add(new PollFormMaster.AnswerViarint
                            {
                                ID   = variant.ID.ToString(CultureInfo.CurrentCulture),
                                Name = variant.Name
                            });
                        }
                    }
                }
                else
                {
                    _pollMaster.QuestionFieldID = "feedName";
                }
            }
            else
            {
                SaveFeed();
            }

            if (feed != null)
            {
                (Master as NewsMaster).CurrentPageCaption = NewsResource.NewsEditBreadCrumbsPoll;
                Title = HeaderStringHelper.GetPageTitle(NewsResource.NewsEditBreadCrumbsPoll);
                lbCancel.NavigateUrl = VirtualPathUtility.ToAbsolute("~/products/community/modules/news/") + "?docid=" + docID + Info.UserIdAttribute;
            }
            else
            {
                (Master as NewsMaster).CurrentPageCaption = NewsResource.NewsAddBreadCrumbsPoll;
                Title = HeaderStringHelper.GetPageTitle(NewsResource.NewsAddBreadCrumbsPoll);
                lbCancel.NavigateUrl = VirtualPathUtility.ToAbsolute("~/products/community/modules/news/") + (string.IsNullOrEmpty(Info.UserIdAttribute) ? string.Empty : "?" + Info.UserIdAttribute.Substring(1));
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _cfg = new TalkConfiguration();

            Utility.RegisterTypeForAjax(GetType());

            Master.DisabledSidePanel      = true;
            Master.DisabledTopStudioPanel = true;

            Page
            .RegisterBodyScripts("~/addons/talk/js/gears.init.js",
                                 "~/addons/talk/js/gears.init.js",
                                 "~/addons/talk/js/iscroll.js",
                                 "~/addons/talk/js/talk.customevents.js",
                                 "~/js/third-party/jquery/jquery.notification.js",
                                 "~/js/third-party/moment.min.js",
                                 "~/js/third-party/moment-timezone.min.js",
                                 "~/js/third-party/firebase.js",
                                 "~/js/third-party/firebase-app.js",
                                 "~/js/third-party/firebase-auth.js",
                                 "~/js/third-party/firebase-database.js",
                                 "~/js/third-party/firebase-messaging.js",
                                 "~/addons/talk/js/talk.common.js",
                                 "~/addons/talk/js/talk.navigationitem.js",
                                 "~/addons/talk/js/talk.msmanager.js",
                                 "~/addons/talk/js/talk.mucmanager.js",
                                 "~/addons/talk/js/talk.roomsmanager.js",
                                 "~/addons/talk/js/talk.contactsmanager.js",
                                 "~/addons/talk/js/talk.messagesmanager.js",
                                 "~/addons/talk/js/talk.connectiomanager.js",
                                 "~/addons/talk/js/talk.default.js",
                                 "~/addons/talk/js/talk.init.js")
            .RegisterStyle("~/addons/talk/css/default/talk.style.css");

            var virtPath = "~/addons/talk/css/default/talk.style." + CultureInfo.CurrentCulture.Name.ToLower() + ".css";

            if (File.Exists(Server.MapPath(virtPath)))
            {
                Page.RegisterStyle(virtPath);
            }
            Page.RegisterStyle("~/addons/talk/css/default/talk.text-overflow.css");


            switch (_cfg.RequestTransportType.ToLower())
            {
            case "flash":
                Page.RegisterBodyScripts("~/addons/talk/js/jlib/plugins/strophe.flxhr.js",

                                         "~/addons/talk/js/jlib/flxhr/checkplayer.js",
                                         "~/addons/talk/js/jlib/flxhr/flensed.js",
                                         "~/addons/talk/js/jlib/flxhr/flxhr.js",
                                         "~/addons/talk/js/jlib/flxhr/swfobject.js",

                                         "~/addons/talk/js/jlib/strophe/base64.js",
                                         "~/addons/talk/js/jlib/strophe/md5.js",
                                         "~/addons/talk/js/jlib/strophe/core.js");

                break;

            default:
                Page.RegisterBodyScripts(
                    "~/addons/talk/js/jlib/strophe/base64.js",
                    "~/addons/talk/js/jlib/strophe/md5.js",
                    "~/addons/talk/js/jlib/strophe/core.js",

                    "~/addons/talk/js/jlib/flxhr/swfobject.js");
                break;
            }

            Master.AddClientScript(new TalkClientScript(), new TalkClientScriptLocalization());

            try
            {
                Page.Title = TalkResource.ProductName + " - " + CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).DisplayUserName(false);
            }
            catch (System.Security.SecurityException)
            {
                Page.Title = TalkResource.ProductName + " - " + HeaderStringHelper.GetPageTitle(TalkResource.DefaultContactTitle);
            }
            try
            {
                Page.RegisterInlineScript("ASC.TMTalk.notifications.initialiseFirebase(" + GetFirebaseConfig() + ");");
            }
            catch (Exception) {}
        }
예제 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.RegisterBodyScripts(PathProvider.GetFileStaticRelativePath, "projectaction.js");

            _hintPopupDeleteProject.Options.IsPopup    = true;
            _hintPopupActiveTasks.Options.IsPopup      = true;
            _hintPopupActiveMilestones.Options.IsPopup = true;

            TemplatesCount = Page.EngineFactory.TemplateEngine.GetCount();
            HideChooseTeam = CoreContext.UserManager.GetUsers().All(r => r.ID == SecurityContext.CurrentAccount.ID);

            if (Project != null)
            {
                ProjectManagerName        = CoreContext.UserManager.GetUsers(Project.Responsible).DisplayUserName();
                UrlProject                = "tasks.aspx?prjID=" + Project.ID;
                ActiveTasksCount          = Page.EngineFactory.TaskEngine.GetByProject(Project.ID, TaskStatus.Open, Guid.Empty).Count();
                ActiveMilestonesCount     = Page.EngineFactory.MilestoneEngine.GetByProject(Project.ID).Count(m => m.Status == MilestoneStatus.Open);
                IsEditingProjectAvailable = true;
                PageTitle                         = ProjectResource.EditProject;
                ActiveTasksUrl                    = string.Format("tasks.aspx?prjID={0}#status=open", Project.ID);
                ActiveMilestonesUrl               = string.Format("milestones.aspx?prjID={0}#status=open", Project.ID);
                ProjectActionButtonTitle          = ProjectResource.SaveProject;
                RenderProjectPrivacyCheckboxValue = Project.Private;
                ProjectManagerId                  = Project.Responsible.ToString();

                projectTitle.Text       = Project.Title;
                projectDescription.Text = Project.Description;

                var tags = Page.EngineFactory.TagEngine.GetProjectTags(Project.ID).Select(r => r.Value.HtmlEncode()).ToArray();
                ProjectTags = string.Join(", ", tags);

                ProjectStatusTitle = Project.Status.ToString();
                ProjectStatusList  = string.Join(";",
                                                 string.Join(",", (int)ProjectStatus.Open, ProjectStatus.Open),
                                                 string.Join(",", (int)ProjectStatus.Paused, ProjectStatus.Paused),
                                                 string.Join(",", (int)ProjectStatus.Closed, ProjectStatus.Closed));

                Page.Title = HeaderStringHelper.GetPageTitle(Project.Title);
            }
            else
            {
                if (TemplatesCount > 0)
                {
                    ControlPlaceHolder.Controls.Add(LoadControl("../Common/AddMilestoneContainer.ascx"));
                }

                projectTitle.Attributes.Add("deftext", ProjectTemplatesResource.DefaultProjTitle);

                _hintPopupDeleteProject.Options.IsPopup    = true;
                _hintPopupActiveTasks.Options.IsPopup      = true;
                _hintPopupActiveMilestones.Options.IsPopup = true;

                PageTitle = ProjectResource.CreateNewProject;
                ProjectActionButtonTitle          = ProjectResource.AddNewProject;
                RenderProjectPrivacyCheckboxValue = true;
                ProjectManagerName = ProjectResource.AddProjectManager;

                var users = CoreContext.UserManager.GetUsers().Where(r => ProjectSecurity.IsProjectsEnabled(r.ID)).ToList();
                if (users.Count == 1)
                {
                    var manager = users.First();
                    ProjectManagerId   = manager.ID.ToString();
                    ProjectManagerName = manager.DisplayUserName();
                }

                Page.Title = HeaderStringHelper.GetPageTitle(PageTitle);

                Page.Master.RegisterCRMResources();
            }
        }
예제 #13
0
        protected override void PageLoad()
        {
            var action = UrlParameters.ActionType;

            CanCreate = RequestContext.CanCreateDiscussion(true);

            var discussionId = UrlParameters.EntityID;

            if (discussionId >= 0)
            {
                var discussion = EngineFactory.MessageEngine.GetByID(discussionId);

                if (action.HasValue && action.Value == UrlAction.Edit)
                {
                    if (ProjectSecurity.CanEdit(discussion))
                    {
                        LoadDiscussionActionControl(discussion);
                    }
                    else
                    {
                        Response.Redirect("messages.aspx", true);
                    }

                    Title = HeaderStringHelper.GetPageTitle(discussion.Title);
                }
                else if (discussion != null && ProjectSecurity.CanRead(discussion.Project) && discussion.Project.ID == Project.ID)
                {
                    LoadDiscussionDetailsControl(discussion);

                    IsSubcribed  = EngineFactory.MessageEngine.IsSubscribed(discussion);
                    EssenceTitle = discussion.Title;

                    Title = HeaderStringHelper.GetPageTitle(discussion.Title);
                }
                else
                {
                    RedirectNotFound(string.Format("messages.aspx?prjID={0}", Project.ID));
                }
            }
            else
            {
                if (action.HasValue && action.Value == UrlAction.Add)
                {
                    if (CanCreate)
                    {
                        LoadDiscussionActionControl(null);

                        Title = HeaderStringHelper.GetPageTitle(MessageResource.CreateMessage);
                    }
                    else
                    {
                        Response.Redirect("messages.aspx", true);
                    }
                }
                else
                {
                    contentHolder.Controls.Add(LoadControl(CommonList.Location));
                    loaderHolder.Controls.Add(LoadControl(LoaderPage.Location));
                }
            }
        }
예제 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.RegisterTypeForAjax(typeof(Default), Page);
            commentList.Visible = CommunitySecurity.CheckPermissions(NewsConst.Action_Comment);

            pgNavigator.EntryCount       = 1;
            pgNavigator.EntryCountOnPage = 1;
            Breadcrumb.Add(new BreadCrumb {
                Caption = NewsResource.NewsBreadCrumbs, NavigationUrl = FeedUrls.MainPageUrl
            });
            if (Info.HasUser)
            {
                Breadcrumb.Add(new BreadCrumb {
                    Caption = Info.User.DisplayUserName(false), NavigationUrl = FeedUrls.GetFeedListUrl(Info.UserId)
                });
            }

            if (!IsPostBack)
            {
                var storage = FeedStorageFactory.Create();
                if (!string.IsNullOrEmpty(Request["docID"]))
                {
                    long docID;
                    if (long.TryParse(Request["docID"], out docID))
                    {
                        //Show panel
                        ContentView.Visible = false;
                        FeedView.Visible    = true;

                        var feed = storage.GetFeed(docID);
                        if (feed != null)
                        {
                            if (!feed.Readed)
                            {
                                storage.ReadFeed(feed.Id, SecurityContext.CurrentAccount.ID.ToString());
                            }
                            FeedViewCtrl.Feed = feed;
                            hdnField.Value    = feed.Id.ToString(CultureInfo.CurrentCulture);
                            Title            += string.Format(CultureInfo.CurrentCulture, "-{0}", feed.Caption);
                            InitCommentsView(storage, feed);
                            FeedView.DataBind();
                            Breadcrumb.Add(new BreadCrumb {
                                Caption = feed.Caption, NavigationUrl = FeedUrls.GetFeedUrl(docID, Info.UserId)
                            });
                        }
                        else
                        {
                            ContentView.Visible  = true;
                            FeedView.Visible     = false;
                            FeedRepeater.Visible = true;
                        }
                    }
                }
                else
                {
                    PageNumber = string.IsNullOrEmpty(Request["page"]) ? 1 : Convert.ToInt32(Request["page"]);
                    LoadData();
                }
            }
            this.Title = HeaderStringHelper.GetPageTitle(Resources.NewsResource.AddonName, Breadcrumb);
        }
예제 #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.RegisterStyle("~/usercontrols/common/authorize/css/authorize.less")
            .RegisterBodyScripts("~/usercontrols/common/authorize/js/authorize.js");

            Login    = "";
            Password = "";
            HashId   = "";

            //Account link control
            bool withAccountLink = false;

            if (SetupInfo.ThirdPartyAuthEnabled && AccountLinkControl.IsNotEmpty)
            {
                var accountLink = (AccountLinkControl)LoadControl(AccountLinkControl.Location);
                accountLink.Visible        = true;
                accountLink.ClientCallback = "authCallback";
                accountLink.SettingsView   = false;
                signInPlaceholder.Controls.Add(accountLink);

                withAccountLink = true;
            }

            //top panel
            var master = Page.Master as BaseTemplate;

            if (master != null)
            {
                master.TopStudioPanel.DisableProductNavigation = true;
                master.TopStudioPanel.DisableSearch            = true;
            }

            Page.Title = HeaderStringHelper.GetPageTitle(Resource.Authorization);

            pwdReminderHolder.Controls.Add(LoadControl(PwdTool.Location));

            var msg      = Request["m"];
            var urlError = Request.QueryString["error"];

            if (!string.IsNullOrEmpty(msg))
            {
                ErrorMessage = msg;
            }
            else if (urlError == "ipsecurity")
            {
                ErrorMessage = Resource.LoginFailIPSecurityMsg;
            }

            var thirdPartyProfile = Request.Url.GetProfile();

            if ((IsPostBack || thirdPartyProfile != null) && !SecurityContext.IsAuthenticated)
            {
                if (!AuthProcess(thirdPartyProfile, withAccountLink))
                {
                    return;
                }

                var refererURL = (string)Session["refererURL"];
                if (string.IsNullOrEmpty(refererURL))
                {
                    Response.Redirect(CommonLinkUtility.GetDefault(), true);
                }
                else
                {
                    Session["refererURL"] = null;
                    Response.Redirect(refererURL, true);
                }
            }
            ProcessConfirmedEmailCondition();
        }
예제 #16
0
        protected override void PageLoad()
        {
            if (RequestContext.IsInConcreteProject())
            {
                Server.Transfer(String.Concat(PathProvider.BaseAbsolutePath, "ProjectOverview.aspx"));
            }
            else
            {
                if (String.Compare(UrlParameters.ActionType, "add", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (ProjectSecurity.IsAdministrator(SecurityContext.CurrentAccount.ID))
                    {
                        Server.Transfer(String.Concat(PathProvider.BaseAbsolutePath, "ProjectAction.aspx"));
                    }
                    else
                    {
                        Response.Redirect("projects.aspx");
                    }
                }
            }

            ((IStudioMaster)Master).DisabledSidePanel = true;

            Master.BreadCrumbs.Add(new BreadCrumb
            {
                Caption       = ProjectResource.Projects,
                NavigationUrl = "projects.aspx"
            });

            Title = HeaderStringHelper.GetPageTitle(ProjectResource.Projects, Master.BreadCrumbs);

            IsEmptyListProjects = !RequestContext.HasAnyProjects();
            if (IsEmptyListProjects)
            {
                var button = "";
                if (ProjectSecurity.CanCreateProject())
                {
                    button = string.Format("<a href='projects.aspx?action=add' class='projectsEmpty baseLinkAction'>{0}<a>",
                                           ProjectResource.CreateFirstProject);
                }
                var escNoProj = new Studio.Controls.Common.EmptyScreenControl
                {
                    Header     = ProjectResource.EmptyListProjHeader,
                    ImgSrc     = WebImageSupplier.GetAbsoluteWebPath("projects_logo.png", ProductEntryPoint.ID),
                    Describe   = ProjectResource.EmptyListProjDescribe,
                    ID         = "escNoProj",
                    ButtonHTML = button
                };
                _escNoProj.Controls.Add(escNoProj);
            }
            else
            {
                var list = (Controls.Projects.ProjectsList)LoadControl(PathProvider.GetControlVirtualPath("ProjectsList.ascx"));
                __listProjects.Controls.Add(list);

                var advansedFilter = new Studio.Controls.Common.AdvansedFilter {
                    BlockID = "AdvansedFilter"
                };
                _content.Controls.Add(advansedFilter);

                var emptyScreenControlFilter = new Studio.Controls.Common.EmptyScreenControl
                {
                    ImgSrc     = WebImageSupplier.GetAbsoluteWebPath("empty-filter.png", ProductEntryPoint.ID),
                    Header     = ProjectsCommonResource.Filter_NoProjects,
                    Describe   = ProjectResource.DescrEmptyListProjFilter,
                    ID         = "emptyFilter",
                    ButtonHTML = String.Format("<a href='javascript:void(0)' class='baseLinkAction'>{0}</a>",
                                               ProjectsFilterResource.ClearFilter)
                };
                projectListEmptyScreen.Controls.Add(emptyScreenControlFilter);
            }
        }
예제 #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _cfg = new TalkConfiguration();

            AjaxPro.Utility.RegisterTypeForAjax(GetType());

            Master.DisabledSidePanel      = true;
            Master.DisabledTopStudioPanel = true;

            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/gears.init.js"));
            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/iscroll.js"));
            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/talk.customevents.js"));
            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/talk.common.js"));
            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/talk.navigationitem.js"));
            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/talk.msmanager.js"));
            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/talk.mucmanager.js"));
            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/talk.roomsmanager.js"));
            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/talk.contactsmanager.js"));
            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/talk.messagesmanager.js"));
            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/talk.connectiomanager.js"));
            Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/talk.default.js"));

            //if (cfg.EnabledFirebugLite)
            //{
            //    Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "firebug.lite", "https://getfirebug.com/firebug-lite.js");
            //}

            var culture = CultureInfo.CurrentCulture;

            Page.RegisterStyleControl(VirtualPathUtility.ToAbsolute("~/addons/talk/css/default/talk.style.css"));
            Page.RegisterStyleControl(VirtualPathUtility.ToAbsolute("~/addons/talk/css/default/talk.style" + "." + culture.Name.ToLower() + ".css"));
            Page.RegisterStyleControl(VirtualPathUtility.ToAbsolute("~/addons/talk/css/default/talk.text-overflow.css"));


            switch (_cfg.RequestTransportType.ToLower())
            {
            case "flash":
                Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/jlib/plugins/strophe.flxhr.js"));

                Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/jlib/flxhr/checkplayer.js"));
                Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/jlib/flxhr/flensed.js"));
                Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/jlib/flxhr/flxhr.js"));
                Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/jlib/flxhr/swfobject.js"));

                Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/jlib/strophe/base64.js"));
                Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/jlib/strophe/md5.js"));
                Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/jlib/strophe/core.js"));

                break;

            default:
                Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/jlib/strophe/base64.js"));
                Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/jlib/strophe/md5.js"));
                Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/jlib/strophe/core.js"));

                Page.RegisterBodyScripts(VirtualPathUtility.ToAbsolute("~/addons/talk/js/jlib/flxhr/swfobject.js"));
                break;
            }

            var jsResources = new StringBuilder();

            jsResources.Append("window.ASC=window.ASC||{};");
            jsResources.Append("window.ASC.TMTalk=window.ASC.TMTalk||{};");
            jsResources.Append("window.ASC.TMTalk.Resources={};");
            jsResources.Append("window.ASC.TMTalk.Resources.statusTitles={}" + ';');
            jsResources.Append("window.ASC.TMTalk.Resources.statusTitles.offline='" + EscapeJsString(TalkResource.StatusOffline) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.statusTitles.online='" + EscapeJsString(TalkResource.StatusOnline) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.statusTitles.away='" + EscapeJsString(TalkResource.StatusAway) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.statusTitles.xa='" + EscapeJsString(TalkResource.StatusNA) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.addonIcon='" + EscapeJsString(WebImageSupplier.GetAbsoluteWebPath("product_logo.png", TalkAddon.AddonID)) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.addonIcon16='" + EscapeJsString(WebImageSupplier.GetAbsoluteWebPath("talk16.png", TalkAddon.AddonID)) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.addonIcon32='" + EscapeJsString(WebImageSupplier.GetAbsoluteWebPath("talk32.png", TalkAddon.AddonID)) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.addonIcon48='" + EscapeJsString(WebImageSupplier.GetAbsoluteWebPath("talk48.png", TalkAddon.AddonID)) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.addonIcon128='" + EscapeJsString(WebImageSupplier.GetAbsoluteWebPath("talk128.png", TalkAddon.AddonID)) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.iconNewMessage='" + EscapeJsString(WebImageSupplier.GetAbsoluteWebPath("icon-new-message.ico", TalkAddon.AddonID)) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.productName='" + EscapeJsString(TalkResource.ProductName) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.updateFlashPlayerUrl='" + EscapeJsString(TalkResource.UpdateFlashPlayerUrl) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.selectUserBookmarkTitle='" + EscapeJsString(TalkResource.SelectUserBookmarkTitle) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.defaultConferenceSubjectTemplate='" + EscapeJsString(TalkResource.DefaultConferenceSubjectTemplate) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.labelNewMessage='" + EscapeJsString(TalkResource.LabelNewMessage) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.labelRecvInvite='" + EscapeJsString(TalkResource.LabelRecvInvite) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.titleRecvInvite='" + EscapeJsString(TalkResource.TitleRecvInvite) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.hintClientConnecting='" + EscapeJsString(TalkResource.HintClientConnecting) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.hintClientDisconnected='" + EscapeJsString(TalkResource.HintClientDisconnected) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.hintEmotions='" + EscapeJsString(TalkResource.HintEmotions) + "',");
            jsResources.Append("window.ASC.TMTalk.Resources.hintFlastPlayerIncorrect='" + EscapeJsString(TalkResource.HintFlastPlayerIncorrect) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.hintGroups='" + EscapeJsString(TalkResource.HintGroups) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.hintNoFlashPlayer='" + EscapeJsString(TalkResource.HintNoFlashPlayer) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.hintOfflineContacts='" + EscapeJsString(TalkResource.HintOfflineContacts) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.hintSendFile='" + EscapeJsString(TalkResource.HintSendFile) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.hintSounds='" + EscapeJsString(TalkResource.HintSounds) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.hintUpdateHrefText='" + EscapeJsString(TalkResource.HintUpdateHrefText) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.hintSelectContact='" + EscapeJsString(TalkResource.HintSelectContact) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.hintSendInvite='" + EscapeJsString(TalkResource.HintSendInvite) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.hintPossibleClientConflict='" + EscapeJsString(TalkResource.HintPossibleClientConflict) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.hintCreateShortcutDialog='" + EscapeJsString(TalkResource.HintCreateShortcutDialog) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.sendFileMessage='" + EscapeJsString(string.Format(TalkResource.SendFileMessage, "{0}<br/>", "{1}")) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.mailingsGroupName='" + EscapeJsString(TalkResource.MailingsGroupName) + "';");
            jsResources.Append("window.ASC.TMTalk.Resources.conferenceGroupName='" + EscapeJsString(TalkResource.ConferenceGroupName) + "';");

            Page.RegisterInlineScript(jsResources.ToString(), true, false);

            jsResources = new StringBuilder();

            jsResources.Append("TMTalk.init('ajaxupload.ashx?type=ASC.Web.Talk.UploadFileHanler,ASC.Web.Talk');");
            jsResources.Append("ASC.TMTalk.properties.init('2.0');");
            jsResources.Append("ASC.TMTalk.iconManager.init();");
            jsResources.AppendFormat("ASC.TMTalk.notifications.init('{0}', '{1}');", GetUserPhotoHandlerPath(), GetNotificationHandlerPath());
            jsResources.AppendFormat("ASC.TMTalk.msManager.init('{0}');", GetValidSymbols());
            jsResources.AppendFormat("ASC.TMTalk.mucManager.init('{0}');", GetValidSymbols());
            jsResources.Append("ASC.TMTalk.roomsManager.init();");
            jsResources.Append("ASC.TMTalk.contactsManager.init();");
            jsResources.AppendFormat("ASC.TMTalk.messagesManager.init('{0}', '{1}', '{2}', '{3}');", GetShortDateFormat(), GetFullDateFormat(), GetMonthNames(), GetHistoryLength());
            jsResources.AppendFormat("ASC.TMTalk.connectionManager.init('{0}', '{1}', '{2}', '{3}');", GetBoshUri(), GetJabberAccount(), GetResourcePriority(), GetInactivity());
            jsResources.AppendFormat("ASC.TMTalk.properties.item('addonID', '{0}');", TalkAddon.AddonID);
            jsResources.AppendFormat("ASC.TMTalk.properties.item('enabledMassend', '{0}');", GetMassendState());
            jsResources.AppendFormat("ASC.TMTalk.properties.item('enabledConferences', '{0}');", GetConferenceState());
            jsResources.AppendFormat("ASC.TMTalk.properties.item('requestTransportType', '{0}');", GetRequestTransportType());
            jsResources.AppendFormat("ASC.TMTalk.properties.item('fileTransportType', '{0}');", GetFileTransportType());
            jsResources.AppendFormat("ASC.TMTalk.properties.item('maxUploadSize', '{0}');", SetupInfo.MaxImageUploadSize);
            jsResources.AppendFormat("ASC.TMTalk.properties.item('sounds', '{0}');", VirtualPathUtility.ToAbsolute("~/addons/talk/swf/sounds.swf"));
            jsResources.AppendFormat("ASC.TMTalk.properties.item('expressInstall', '{0}');", VirtualPathUtility.ToAbsolute("~/addons/talk/swf/expressinstall.swf"));

            Page.RegisterInlineScript(jsResources.ToString());

            try
            {
                Page.Title = TalkResource.ProductName + " - " + CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).DisplayUserName();
            }
            catch (System.Security.SecurityException)
            {
                Page.Title = TalkResource.ProductName + " - " + HeaderStringHelper.GetPageTitle(TalkResource.DefaultContactTitle);
            }
        }
예제 #18
0
        protected override void PageLoad()
        {
            if (!CRMSecurity.IsAdmin)
            {
                Response.Redirect(PathProvider.StartURL());
            }

            this.Page.RegisterBodyScripts(LoadControl(VirtualPathUtility.ToAbsolute("~/products/crm/masters/SettingsBodyScripts.ascx")));

            var          typeValue = (HttpContext.Current.Request["type"] ?? "common").ToLower();
            ListItemView listItemViewControl;

            string titlePage;

            switch (typeValue)
            {
            case "common":
                CommonContainerHolder.Controls.Add(LoadControl(CommonSettingsView.Location));

                titlePage = CRMSettingResource.CommonSettings;
                break;

            case "deal_milestone":
                var dealMilestoneViewControl = (DealMilestoneView)LoadControl(DealMilestoneView.Location);
                CommonContainerHolder.Controls.Add(dealMilestoneViewControl);

                titlePage = CRMDealResource.DealMilestone;
                break;

            case "task_category":
                listItemViewControl = (ListItemView)LoadControl(ListItemView.Location);
                listItemViewControl.CurrentTypeValue   = ListType.TaskCategory;
                listItemViewControl.AddButtonText      = CRMSettingResource.AddThisCategory;
                listItemViewControl.AddPopupWindowText = CRMSettingResource.CreateNewCategory;
                listItemViewControl.AddListButtonText  = CRMSettingResource.CreateNewCategoryListButton;

                listItemViewControl.AjaxProgressText          = CRMSettingResource.CreateCategoryInProgressing;
                listItemViewControl.DeleteText                = CRMSettingResource.DeleteCategory;
                listItemViewControl.EditText                  = CRMSettingResource.EditCategory;
                listItemViewControl.EditPopupWindowText       = CRMSettingResource.EditSelectedCategory;
                listItemViewControl.DescriptionText           = CRMSettingResource.DescriptionTextTaskCategory;
                listItemViewControl.DescriptionTextEditDelete = CRMSettingResource.DescriptionTextTaskCategoryEditDelete;
                CommonContainerHolder.Controls.Add(listItemViewControl);
                titlePage = CRMTaskResource.TaskCategories;
                break;

            case "history_category":
                listItemViewControl = (ListItemView)LoadControl(ListItemView.Location);
                listItemViewControl.CurrentTypeValue          = ListType.HistoryCategory;
                listItemViewControl.AddButtonText             = CRMSettingResource.AddThisCategory;
                listItemViewControl.AddPopupWindowText        = CRMSettingResource.CreateNewCategory;
                listItemViewControl.AddListButtonText         = CRMSettingResource.CreateNewCategoryListButton;
                listItemViewControl.AjaxProgressText          = CRMSettingResource.CreateCategoryInProgressing;
                listItemViewControl.DeleteText                = CRMSettingResource.DeleteCategory;
                listItemViewControl.EditText                  = CRMSettingResource.EditCategory;
                listItemViewControl.EditPopupWindowText       = CRMSettingResource.EditSelectedCategory;
                listItemViewControl.DescriptionText           = CRMSettingResource.DescriptionTextHistoryCategory;
                listItemViewControl.DescriptionTextEditDelete = CRMSettingResource.DescriptionTextHistoryCategoryEditDelete;
                CommonContainerHolder.Controls.Add(listItemViewControl);
                titlePage = CRMSettingResource.HistoryCategories;
                break;

            case "contact_stage":
                listItemViewControl = (ListItemView)LoadControl(ListItemView.Location);
                listItemViewControl.CurrentTypeValue   = ListType.ContactStatus;
                listItemViewControl.AddButtonText      = CRMSettingResource.AddThisStage;
                listItemViewControl.AddPopupWindowText = CRMSettingResource.CreateNewStage;
                listItemViewControl.AddListButtonText  = CRMSettingResource.CreateNewStageListButton;

                listItemViewControl.AjaxProgressText          = CRMSettingResource.CreateContactStageInProgressing;
                listItemViewControl.DeleteText                = CRMSettingResource.DeleteContactStage;
                listItemViewControl.EditText                  = CRMSettingResource.EditContactStage;
                listItemViewControl.EditPopupWindowText       = CRMSettingResource.EditSelectedContactStage;
                listItemViewControl.DescriptionText           = CRMSettingResource.DescriptionTextContactStage;
                listItemViewControl.DescriptionTextEditDelete = CRMSettingResource.DescriptionTextContactStageEditDelete;
                CommonContainerHolder.Controls.Add(listItemViewControl);
                titlePage = CRMContactResource.ContactStages;
                break;

            case "contact_type":
                listItemViewControl = (ListItemView)LoadControl(ListItemView.Location);
                listItemViewControl.CurrentTypeValue   = ListType.ContactType;
                listItemViewControl.AddButtonText      = CRMSettingResource.AddThisContactType;
                listItemViewControl.AddPopupWindowText = CRMSettingResource.CreateNewContactType;
                listItemViewControl.AddListButtonText  = CRMSettingResource.CreateNewContactTypeListButton;

                listItemViewControl.AjaxProgressText          = CRMSettingResource.CreateContactTypeInProgressing;
                listItemViewControl.DeleteText                = CRMSettingResource.DeleteContactType;
                listItemViewControl.EditText                  = CRMSettingResource.EditContactType;
                listItemViewControl.EditPopupWindowText       = CRMSettingResource.EditSelectedContactType;
                listItemViewControl.DescriptionText           = CRMSettingResource.DescriptionTextContactType;
                listItemViewControl.DescriptionTextEditDelete = CRMSettingResource.DescriptionTextContactTypeEditDelete;
                CommonContainerHolder.Controls.Add(listItemViewControl);
                titlePage = CRMSettingResource.ContactTypes;
                break;

            case "tag":
                var tagSettingsViewControl = (TagSettingsView)LoadControl(TagSettingsView.Location);
                CommonContainerHolder.Controls.Add(tagSettingsViewControl);

                titlePage = CRMCommonResource.Tags;
                break;

            case "web_to_lead_form":
                CommonContainerHolder.Controls.Add(LoadControl(WebToLeadFormView.Location));
                titlePage = CRMSettingResource.WebToLeadsForm;
                break;

            case "task_template":
                CommonContainerHolder.Controls.Add(LoadControl(TaskTemplateView.Location));

                titlePage = CRMSettingResource.TaskTemplates;
                break;

            default:
                typeValue = "custom_field";
                CommonContainerHolder.Controls.Add(LoadControl(CustomFieldsView.Location));

                titlePage = CRMSettingResource.CustomFields;
                break;
            }

            Title = HeaderStringHelper.GetPageTitle(Master.CurrentPageCaption ?? titlePage);
        }
예제 #19
0
 protected override void OnPreRender(EventArgs e)
 {
     base.OnPreRender(e);
     Title = HeaderStringHelper.GetPageTitle(WikiMaster.CurrentPageCaption ?? WikiResource.ModuleName);
 }
예제 #20
0
 protected string GetPageTitle(ManagementType module)
 {
     return(HeaderStringHelper.GetPageTitle(GetNavigationTitle(module)));
 }
예제 #21
0
 protected override void PageLoad()
 {
     Title = HeaderStringHelper.GetPageTitle(ProjectsCommonResource.TimeTracking);
 }
예제 #22
0
        private void LoadData()
        {
            var storage  = FeedStorageFactory.Create();
            var feedType = FeedType.All;

            if (!string.IsNullOrEmpty(Request["type"]))
            {
                feedType = (FeedType)Enum.Parse(typeof(FeedType), Request["type"], true);
                var feedTypeInfo = FeedTypeInfo.FromFeedType(feedType);
                Title = HeaderStringHelper.GetPageTitle((Master as NewsMaster).CurrentPageCaption ?? feedTypeInfo.TypeName);
            }
            else
            {
                Title = HeaderStringHelper.GetPageTitle((Master as NewsMaster).CurrentPageCaption ?? NewsResource.NewsBreadCrumbs);
            }

            var feedsCount = !string.IsNullOrEmpty(Request["search"]) ? storage.SearchFeedsCount(Request["search"], feedType, Info.UserId) : storage.GetFeedsCount(feedType, Info.UserId);

            FeedsCount = feedsCount;

            if (feedsCount == 0)
            {
                FeedRepeater.Visible = false;
                MessageShow.Visible  = true;

                string buttonLink;
                string buttonName;
                var    emptyScreenControl = new EmptyScreenControl {
                    Describe = NewsResource.EmptyScreenText
                };

                switch (feedType)
                {
                case FeedType.News:
                    emptyScreenControl.ImgSrc = WebImageSupplier.GetAbsoluteWebPath("150x_news.png", NewsConst.ModuleId);
                    emptyScreenControl.Header = NewsResource.EmptyScreenNewsCaption;
                    buttonLink = FeedUrls.EditNewsUrl;
                    buttonName = NewsResource.EmptyScreenNewsLink;
                    break;

                case FeedType.Order:
                    emptyScreenControl.ImgSrc = WebImageSupplier.GetAbsoluteWebPath("150x_order.png", NewsConst.ModuleId);
                    emptyScreenControl.Header = NewsResource.EmptyScreenOrdersCaption;
                    buttonLink = FeedUrls.EditOrderUrl;
                    buttonName = NewsResource.EmptyScreenOrderLink;
                    break;

                case FeedType.Advert:
                    emptyScreenControl.ImgSrc = WebImageSupplier.GetAbsoluteWebPath("150x_advert.png", NewsConst.ModuleId);
                    emptyScreenControl.Header = NewsResource.EmptyScreenAdvertsCaption;
                    buttonLink = FeedUrls.EditAdvertUrl;
                    buttonName = NewsResource.EmptyScreenAdvertLink;
                    break;

                case FeedType.Poll:
                    emptyScreenControl.ImgSrc = WebImageSupplier.GetAbsoluteWebPath("150x_poll.png", NewsConst.ModuleId);
                    emptyScreenControl.Header = NewsResource.EmptyScreenPollsCaption;
                    buttonLink = FeedUrls.EditPollUrl;
                    buttonName = NewsResource.EmptyScreenPollLink;
                    break;

                default:
                    emptyScreenControl.ImgSrc = WebImageSupplier.GetAbsoluteWebPath("150x_newslogo.png", NewsConst.ModuleId);
                    emptyScreenControl.Header = NewsResource.EmptyScreenEventsCaption;
                    buttonLink = FeedUrls.EditNewsUrl;
                    buttonName = NewsResource.EmptyScreenEventLink;
                    break;
                }

                if (CommunitySecurity.CheckPermissions(NewsConst.Action_Add) && String.IsNullOrEmpty(Request["uid"]) && String.IsNullOrEmpty(Request["search"]))
                {
                    emptyScreenControl.ButtonHTML = String.Format("<a class='link underline blue plus' href='{0}'>{1}</a>", buttonLink, buttonName);
                }


                MessageShow.Controls.Add(emptyScreenControl);
            }
            else
            {
                var pageSize  = PageSize;
                var pageCount = (int)(feedsCount / pageSize + 1);
                if (pageCount < PageNumber)
                {
                    PageNumber = pageCount;
                }

                var feeds = !string.IsNullOrEmpty(Request["search"]) ?
                            storage.SearchFeeds(Request["search"], feedType, Info.UserId, pageSize, (PageNumber - 1) * pageSize) :
                            storage.GetFeeds(feedType, Info.UserId, pageSize, (PageNumber - 1) * pageSize);

                pgNavigator.EntryCountOnPage  = pageSize;
                pgNavigator.EntryCount        = 0 < pageCount ? (int)feedsCount : pageSize;
                pgNavigator.CurrentPageNumber = PageNumber;

                pgNavigator.ParamName = "page";
                if (!string.IsNullOrEmpty(Request["search"]))
                {
                    pgNavigator.PageUrl = string.Format(
                        CultureInfo.CurrentCulture,
                        "{0}?search={1}&size={2}",
                        VirtualPathUtility.ToAbsolute("~/products/community/modules/news/"),
                        Request["search"],
                        pageSize
                        );
                }
                else
                {
                    pgNavigator.PageUrl = string.IsNullOrEmpty(Request["type"]) ?
                                          string.Format(
                        CultureInfo.CurrentCulture,
                        "{0}?{1}&size={2}",
                        VirtualPathUtility.ToAbsolute("~/products/community/modules/news/"),
                        (string.IsNullOrEmpty(Info.UserIdAttribute) ? string.Empty : "?" + Info.UserIdAttribute.Substring(1)),
                        pageSize
                        ) :
                                          string.Format(
                        CultureInfo.CurrentCulture,
                        "{0}?type={1}{2}&size={3}",
                        VirtualPathUtility.ToAbsolute("~/products/community/modules/news/"),
                        Request["type"],
                        Info.UserIdAttribute,
                        pageSize);
                }
                FeedRepeater.DataSource = feeds;
                FeedRepeater.DataBind();
            }
        }
예제 #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ForumManager.Instance.SetCurrentPage(ForumPage.Search);

            int currentPageNumber;

            if (!int.TryParse(Request["p"], out currentPageNumber))
            {
                currentPageNumber = 1;
            }

            if (currentPageNumber <= 0)
            {
                currentPageNumber = 1;
            }

            var findTopicList = new List <Topic>();
            var topicCount    = 0;

            if (!String.IsNullOrEmpty(Request["uid"]))
            {
                try
                {
                    _userID = new Guid(Request["uid"]);
                }
                catch
                {
                    _userID = Guid.Empty;
                }

                if (_userID != Guid.Empty)
                {
                    findTopicList = ForumDataProvider.SearchTopicsByUser(TenantProvider.CurrentTenantID, _userID, currentPageNumber, ForumManager.Settings.TopicCountOnPage, out topicCount);
                }
            }

            if (findTopicList.Count > 0)
            {
                _isFind = true;

                var i = 0;
                foreach (var topic in findTopicList)
                {
                    var topicControl = (TopicControl)LoadControl(ForumManager.Settings.UserControlsVirtualPath + "/TopicControl.ascx");
                    topicControl.SettingsID       = ForumManager.Settings.ID;
                    topicControl.Topic            = topic;
                    topicControl.IsShowThreadName = true;
                    topicControl.IsEven           = (i % 2 == 0);
                    topicListHolder.Controls.Add(topicControl);
                    i++;
                }

                #region navigators

                var pageNavigator = new PageNavigator
                {
                    CurrentPageNumber = currentPageNumber,
                    EntryCountOnPage  = ForumManager.Settings.TopicCountOnPage,
                    VisiblePageCount  = 5,
                    EntryCount        = topicCount,
                    PageUrl           = "usertopics.aspx?uid=" + _userID.ToString()
                };

                bottomPageNavigatorHolder.Controls.Add(pageNavigator);

                #endregion
            }
            else
            {
                var emptyScreenControl = new EmptyScreenControl
                {
                    ImgSrc   = WebImageSupplier.GetAbsoluteWebPath("forums_icon.png", ForumManager.Settings.ModuleID),
                    Header   = Resources.ForumResource.EmptyScreenSearchCaption,
                    Describe = Resources.ForumResource.EmptyScreenSearchText,
                };

                topicListHolder.Controls.Add(emptyScreenControl);
            }

            //bread crumbs
            (Master as ForumMasterPage).CurrentPageCaption = CoreContext.UserManager.GetUsers(_userID).DisplayUserName(false);

            Title = HeaderStringHelper.GetPageTitle((Master as ForumMasterPage).CurrentPageCaption);
        }
예제 #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.RegisterTypeForAjax(typeof(Default), Page);
            commentList.Visible = CommunitySecurity.CheckPermissions(NewsConst.Action_Comment);

            pgNavigator.EntryCount       = 1;
            pgNavigator.EntryCountOnPage = 1;

            if (IsPostBack)
            {
                return;
            }

            var storage = FeedStorageFactory.Create();

            if (!string.IsNullOrEmpty(Request["docID"]))
            {
                long docID;
                if (long.TryParse(Request["docID"], out docID))
                {
                    //Show panel
                    ContentView.Visible = false;
                    FeedView.Visible    = true;

                    var feed = storage.GetFeed(docID);
                    if (feed != null)
                    {
                        if (!feed.Readed)
                        {
                            storage.ReadFeed(feed.Id, SecurityContext.CurrentAccount.ID.ToString());
                        }
                        FeedViewCtrl.Feed = feed;
                        hdnField.Value    = feed.Id.ToString(CultureInfo.CurrentCulture);
                        InitCommentsView(storage, feed);
                        FeedView.DataBind();
                        EventTitle = feed.Caption;
                        var subscriptionProvider  = NewsNotifySource.Instance.GetSubscriptionProvider();
                        var amAsRecipient         = (IDirectRecipient)NewsNotifySource.Instance.GetRecipientsProvider().GetRecipient(SecurityContext.CurrentAccount.ID.ToString());
                        var isSubsribedOnComments = subscriptionProvider.IsSubscribed(NewsConst.NewComment, amAsRecipient, feed.Id.ToString());

                        var SubscribeTopicLink = string.Format(CultureInfo.CurrentCulture,
                                                               string.Format(CultureInfo.CurrentCulture,
                                                                             "<a id=\"statusSubscribe\" class=\"follow-status " +
                                                                             (isSubsribedOnComments ? "subscribed" : "unsubscribed") +
                                                                             "\" title=\"{0}\" href=\"#\" onclick=\"SubscribeOnComments('{1}');\"></a>",
                                                                             (isSubsribedOnComments ? NewsResource.UnsubscribeFromNewComments : NewsResource.SubscribeOnNewComments), feed.Id));

                        SubscribeLinkBlock.Text = SubscribeTopicLink;

                        Title = HeaderStringHelper.GetPageTitle((Master as NewsMaster).CurrentPageCaption ?? feed.Caption);
                    }
                    else
                    {
                        Response.Redirect(VirtualPathUtility.ToAbsolute("~/products/community/modules/news/"));
                        ContentView.Visible  = true;
                        FeedView.Visible     = false;
                        FeedRepeater.Visible = true;
                    }
                }
            }
            else
            {
                PageNumber = string.IsNullOrEmpty(Request["page"]) ? 1 : Convert.ToInt32(Request["page"]);
                PageSize   = string.IsNullOrEmpty(Request["size"]) ? 20 : Convert.ToInt32(Request["size"]);
                LoadData();
            }
            InitScripts();
        }
예제 #25
0
 protected void ExecListCasesView()
 {
     CommonContainerHolder.Controls.Add(LoadControl(ListCasesView.Location));
     Title = HeaderStringHelper.GetPageTitle(Master.CurrentPageCaption ?? CRMCasesResource.AllCases);
     loaderHolder.Controls.Add(LoadControl(LoaderPage.Location));
 }
예제 #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ForumManager.Instance.SetCurrentPage(ForumPage.TopicList);
            Utility.RegisterTypeForAjax(typeof(ForumEditor), this.Page);
            int idThread;

            if (!int.TryParse(Request["f"], out idThread))
            {
                Response.Redirect("Default.aspx");
            }

            var thread = ForumDataProvider.GetThreadByID(TenantProvider.CurrentTenantID, idThread);

            if (thread == null)
            {
                Response.Redirect("Default.aspx");
            }

            if (thread.TopicCount > 0)
            {
                var topicsControl = LoadControl(ForumManager.Settings.UserControlsVirtualPath + "/TopicListControl.ascx") as UserControls.Forum.TopicListControl;
                topicsControl.SettingsID    = ForumManager.Settings.ID;
                topicsControl.ThreadID      = thread.ID;
                topicsControl.PaggingHolder = PagingHolder;
                topicsHolder.Controls.Add(topicsControl);
            }
            else
            {
                var emptyScreenControl = new EmptyScreenControl
                {
                    ImgSrc     = WebImageSupplier.GetAbsoluteWebPath("forums_icon.png", ForumManager.Settings.ModuleID),
                    Header     = Resources.ForumResource.EmptyScreenTopicCaption,
                    Describe   = Resources.ForumResource.EmptyScreenTopicText,
                    ButtonHTML = ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.TopicCreate, thread) ? String.Format("<a class='link underline blue plus' href='newpost.aspx?f=" + thread.ID + "&m=0'>{0}</a>", Resources.ForumResource.EmptyScreenTopicLink) : String.Empty
                };

                topicsHolder.Controls.Add(emptyScreenControl);
            }

            Utility.RegisterTypeForAjax(typeof(Subscriber));
            var subscriber = new Subscriber();

            var isThreadSubscribe   = subscriber.IsThreadSubscribe(thread.ID);
            var subscribeThreadLink = subscriber.RenderThreadSubscription(!isThreadSubscribe, thread.ID);

            SubscribeLinkBlock.Text = subscribeThreadLink;

            //var master = Master as ForumMasterPage;
            //     master.ActionsPlaceHolder.Controls.Add(new HtmlMenuItem(subscriber.RenderThreadSubscription(!isThreadSubscribe, thread.ID)));

            ForumTitle       = thread.Title;
            ForumParentTitle = Resources.ForumResource.ForumsBreadCrumbs;
            ForumParentURL   = "Default.aspx";

            Title        = HeaderStringHelper.GetPageTitle((Master as ForumMasterPage).CurrentPageCaption ?? Resources.ForumResource.AddonName);
            EnableDelete = ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessForumEditor, null);
            var sb = new StringBuilder();

            sb.Append("<div id=\"forumsActionsMenuPanel\" class=\"studio-action-panel topics\">");
            sb.Append("<ul class=\"dropdown-content\">");
            if (EnableDelete)
            {
                sb.Append("<li><a class=\"dropdown-item\" href=\"javascript:ForumMakerProvider.DeleteThreadTopic('" + thread.ID + "','" + thread.CategoryID + "');\">" + Resources.ForumResource.DeleteButton + "</a></li>");
            }
            sb.Append("</ul>");
            sb.Append("</div>");
            topicsHolder.Controls.Add(new Literal {
                Text = sb.ToString()
            });

            SubscribeStatus = isThreadSubscribe ? "subscribed" : "unsubscribed";
        }
예제 #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _login    = "";
            _password = "";

            //Account link control
            AccountLinkControl accountLink = null;

            if (SetupInfo.ThirdPartyAuthEnabled)
            {
                accountLink = (AccountLinkControl)LoadControl(AccountLinkControl.Location);
                associateAccount.Visible   = true;
                associateAccount.Text      = Resources.Resource.LoginWithAccount;
                accountLink.ClientCallback = "authCallback";
                accountLink.SettingsView   = false;
                signInPlaceholder.Controls.Add(accountLink);
            }

            ((IStudioMaster)this.Master).DisabledSidePanel = true;

            //top panel
            if (this.Master is StudioTemplate)
            {
                ((StudioTemplate)this.Master).TopNavigationPanel.DisableProductNavigation = true;
                ((StudioTemplate)this.Master).TopNavigationPanel.DisableSearch            = true;
            }

            _tenantInfoSettings = SettingsManager.Instance.LoadSettings <TenantInfoSettings>(TenantProvider.CurrentTenantID);

            this.Title = HeaderStringHelper.GetPageTitle(Resources.Resource.Authorization, null, null);

            pwdReminderHolder.Controls.Add(LoadControl(PwdTool.Location));
            pwdReminderHolder.Controls.Add(LoadControl(InviteEmployeeControl.Location));
            _communitations.Controls.Add(LoadControl(AuthCommunications.Location));

            var msg = Request["m"];

            if (!string.IsNullOrEmpty(msg))
            {
                _loginMessage = "<div class='errorBox'>" + HttpUtility.HtmlEncode(msg) + "</div>";
            }

            if (this.IsPostBack && !SecurityContext.IsAuthenticated)
            {
                var uData = new UserTransferData();

                if (!String.IsNullOrEmpty(Request["login"]))
                {
                    _login      = Request["login"];
                    uData.Login = _login;
                }

                if (!String.IsNullOrEmpty(Request["pwd"]))
                {
                    _password      = Request["pwd"];
                    uData.Password = _password;
                }

                bool isDemo = false;
                if (!String.IsNullOrEmpty(Request["authtype"]))
                {
                    isDemo = Request["authtype"] == "demo";
                }

                string hashId = string.Empty;
                if (!string.IsNullOrEmpty(Request["__EVENTARGUMENT"]) && Request["__EVENTTARGET"] == "signInLogin" && accountLink != null)
                {
                    //Login from open id
                    hashId       = Request["__EVENTARGUMENT"];
                    uData.HashId = hashId;
                }

                if (isDemo)
                {
                    SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.Demo);
                }
                else
                {
                    try
                    {
                        string cookiesKey = string.Empty;
                        if (!string.IsNullOrEmpty(hashId))
                        {
                            var accounts = accountLink.GetLinker().GetLinkedObjectsByHashId(hashId);

                            foreach (var account in accounts.Select(x =>
                            {
                                try
                                {
                                    return(new Guid(x));
                                }
                                catch
                                {
                                    return(Guid.Empty);
                                }
                            }))
                            {
                                if (CoreContext.UserManager.UserExists(account) && account != Guid.Empty)
                                {
                                    var coreAcc = CoreContext.UserManager.GetUsers(account);
                                    cookiesKey   = SecurityContext.AuthenticateMe(coreAcc.Email, CoreContext.Authentication.GetUserPasswordHash(coreAcc.ID));
                                    uData.UserId = coreAcc.ID;
                                    ProcessSmsValidation(uData);
                                }
                            }
                            if (string.IsNullOrEmpty(cookiesKey))
                            {
                                _loginMessage = "<div class=\"errorBox\">" + HttpUtility.HtmlEncode(Resources.Resource.LoginWithAccountNotFound) + "</div>";
                                return;
                            }
                        }
                        else
                        {
                            cookiesKey   = SecurityContext.AuthenticateMe(_login, _password);
                            uData.UserId = SecurityContext.CurrentAccount.ID;
                            ProcessSmsValidation(uData);
                        }

                        CookiesManager.SetCookies(CookiesType.AuthKey, cookiesKey);
                    }
                    catch (System.Security.SecurityException)
                    {
                        ProcessLogout();
                        _loginMessage = "<div class=\"errorBox\">" + HttpUtility.HtmlEncode(Resources.Resource.InvalidUsernameOrPassword) + "</div>";
                        return;
                    }
                    catch (Exception exception)
                    {
                        ProcessLogout();
                        _loginMessage = "<div class=\"errorBox\">" + HttpUtility.HtmlEncode(exception.Message) + "</div>";
                        return;
                    }
                }

                UserOnlineManager.Instance.RegistryOnlineUser(SecurityContext.CurrentAccount.ID);

                WebItemManager.Instance.ItemGlobalHandlers.Login(SecurityContext.CurrentAccount.ID);

                string refererURL = (string)Session["refererURL"];
                if (String.IsNullOrEmpty(refererURL))
                {
                    Response.Redirect("~/");
                }
                else
                {
                    Session["refererURL"] = null;
                    Response.Redirect(refererURL);
                }

                return;
            }
            else if (SecurityContext.IsAuthenticated && base.IsLogout)
            {
                ProcessLogout();
                Response.Redirect("~/auth.aspx");
            }

            ProcessConfirmedEmailCondition();
        }
예제 #28
0
 protected void Page_Load(object sender, EventArgs e)
 {
     reportTemplateContainer.Options.IsPopup = true;
     InitReport();
     Page.Title = HeaderStringHelper.GetPageTitle(string.Format(ReportResource.ReportPageTitle, Report.ReportInfo.Title));
 }
예제 #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.RegisterTypeForAjax(GetType());

            if (!CommunitySecurity.CheckPermissions(NewsConst.Action_Add))
            {
                Response.Redirect(FeedUrls.MainPageUrl, true);
            }

            var storage = FeedStorageFactory.Create();

            FeedNS.Feed feed = null;
            if (!string.IsNullOrEmpty(Request["docID"]))
            {
                long docID;
                if (long.TryParse(Request["docID"], out docID))
                {
                    feed = storage.GetFeed(docID);
                    (Master as NewsMaster).CurrentPageCaption = NewsResource.NewsEditBreadCrumbsNews;
                    Title = HeaderStringHelper.GetPageTitle(NewsResource.NewsEditBreadCrumbsNews);
                    _text = (feed != null ? feed.Text : "").HtmlEncode();
                }
            }
            else
            {
                _text = "";
                (Master as NewsMaster).CurrentPageCaption = NewsResource.NewsAddBreadCrumbsNews;
                Title = HeaderStringHelper.GetPageTitle(NewsResource.NewsAddBreadCrumbsNews);
            }

            if (!IsPostBack)
            {
                BindNewsTypes();

                if (feed != null)
                {
                    if (!CommunitySecurity.CheckPermissions(feed, NewsConst.Action_Edit))
                    {
                        Response.Redirect(FeedUrls.MainPageUrl, true);
                    }
                    feedName.Text          = feed.Caption;
                    _text                  = feed.Text;
                    FeedId                 = feed.Id;
                    feedType.SelectedIndex = (int)Math.Log((int)feed.FeedType, 2);
                }
                else
                {
                    if (!string.IsNullOrEmpty(Request["type"]))
                    {
                        var requestFeedType = (FeedType)Enum.Parse(typeof(FeedType), Request["type"], true);
                        var feedTypeInfo    = FeedTypeInfo.FromFeedType(requestFeedType);
                        var item            = feedType.Items.FindByText(feedTypeInfo.TypeName);

                        feedType.SelectedValue = item.Value;
                        feedType.SelectedIndex = (int)Math.Log((int)requestFeedType, 2);
                    }
                }
            }
            else
            {
                var control = FindControl(Request.Params["__EVENTTARGET"]);
                if (lbCancel.Equals(control))
                {
                    CancelFeed(sender, e);
                }
                else
                {
                    SaveFeed();
                }
            }

            RenderScripts();
        }
예제 #30
0
        protected override void PageLoad()
        {
            Utility.RegisterTypeForAjax(typeof(AddBlog));

            if (String.IsNullOrEmpty(BlogId))
            {
                Response.Redirect(Constants.DefaultPageUrl);
            }

            _mobileVer = MobileDetector.IsRequestMatchesMobile(Context);

            //fix for IE 10 && IE11
            var browser = HttpContext.Current.Request.Browser.Browser;

            var userAgent  = Context.Request.Headers["User-Agent"];
            var regExp     = new Regex("MSIE 10.0", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
            var regExpIe11 = new Regex("(?=.*Trident.*rv:11.0).+", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);

            if (browser == "IE" && regExp.Match(userAgent).Success || regExpIe11.Match(userAgent).Success)
            {
                _mobileVer = true;
            }

            var engine = GetEngine();

            Utility.RegisterTypeForAjax(typeof(EditBlog), Page);

            FCKeditor.BasePath      = VirtualPathUtility.ToAbsolute(CommonControlsConfigurer.FCKEditorBasePath);
            FCKeditor.ToolbarSet    = "BlogToolbar";
            FCKeditor.EditorAreaCSS = WebSkin.BaseCSSFileAbsoluteWebPath;

            FCKeditor.Visible = !_mobileVer;

            if (_mobileVer && IsPostBack)
            {
                _text = Request["mobiletext"];
            }

            mainContainer.CurrentPageCaption = BlogsResource.EditPostTitle;
            Title = HeaderStringHelper.GetPageTitle(BlogsResource.EditPostTitle);

            ShowForEdit(engine);

            lbCancel.Attributes["name"] = FCKeditor.ClientID;
            if (IsPostBack)
            {
                var control = FindControl(Request.Params["__EVENTTARGET"]);
                if (lbCancel.Equals(control))
                {
                    Response.Redirect("viewblog.aspx?blogid=" + Request.Params["blogid"]);
                }
                else
                {
                    if (CheckTitle(txtTitle.Text))
                    {
                        var pageEngine = GetEngine();
                        var post       = pageEngine.GetPostById(new Guid(hidBlogID.Value));
                        UpdatePost(post, engine);
                    }
                    else
                    {
                        mainContainer.Options.InfoMessageText = BlogsResource.BlogTitleEmptyMessage;
                        mainContainer.Options.InfoType        = InfoType.Alert;
                    }
                }
            }
            InitScript();
        }