protected void Page_Load(object sender, EventArgs e)
        {
            if (DebugInfo.ShowDebugInfo)
            {
                debugInfoPopUpContainer.Options.IsPopup = true;
            }

            if (Page is Auth || Page is _Default)
            {
                CurrentProductID = Guid.Empty;
            }
            else
            {
                CurrentProductID =
                    !String.IsNullOrEmpty(Request["productID"])
                        ? new Guid(Request["productID"])
                        : CommonLinkUtility.GetProductID();

                if (!String.IsNullOrEmpty(Request["moduleID"]))
                {
                    CurrentModuleID = new Guid(Request["moduleID"]);
                }
            }

            CurrentProduct = (IProduct)WebItemManager.Instance[CurrentProductID];

            if (SecurityContext.CurrentAccount.IsAuthenticated && !TenantStatisticsProvider.IsNotPaid())
            {
                Page.RegisterBodyScripts(ResolveUrl("~/UserControls/Common/TopStudioPanel/js/FeedReaderScripts.js"));
            }

            RenderVideoHandlers();

            if (!DisableSearch)
            {
                RenderSearchProducts();
                DisableSearch = DisableSearch || !SearchProducts.Any() || CoreContext.Configuration.YourDocs;
            }

            _guestInfoHolder.Visible = false;
            _userInfoHolder.Visible  =
                (!DisableUserInfo.HasValue || !DisableUserInfo.Value) &&
                SecurityContext.IsAuthenticated &&
                !(Page is Wizard);

            ShowTopPanelNavigation = SecurityContext.IsAuthenticated && !(Page is Wizard);

            if (SecurityContext.IsAuthenticated)
            {
                CurrentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            }

            TariffNotify = TenantExtra.GetTariffNotify();
            if (!SecurityContext.IsAuthenticated || !TenantExtra.EnableTarrifSettings || CoreContext.Configuration.YourDocs || CurrentUser.IsVisitor())
            {
                DisableTariffNotify = true;
                DisableTariff       = true;
            }
            else if (string.IsNullOrEmpty(TariffNotify))
            {
                DisableTariffNotify = true;
            }
            _customNavItems = WebItemManager.Instance.GetItems(WebZoneType.CustomProductList, ItemAvailableState.Normal);

            if (CurrentUser.IsVisitor())
            {
                _customNavItems.RemoveAll(item => item.ID == WebItemManager.MailProductID); // remove mail for guest
            }

            if (DisableProductNavigation)
            {
                _productListHolder.Visible = false;
            }
            else
            {
                var productsList = WebItemManager.Instance.GetItems(WebZoneType.TopNavigationProductList, ItemAvailableState.Normal); //.Where(pr => !CurrentProductID.Equals(pr.ID));
                DisplayModuleList           = productsList.Any() && !CoreContext.Configuration.YourDocs;
                _productRepeater.DataSource = productsList;

                _productRepeater.DataBind();

                var addons = _customNavItems.Where(pr => ((pr.ID == WebItemManager.CalendarProductID || pr.ID == WebItemManager.TalkProductID || pr.ID == WebItemManager.MailProductID)));
                //if (GetCurrentWebItem != null)
                //    _addons = _addons.Where(pr => pr.ID != GetCurrentWebItem.ID);
                _addonRepeater.DataSource = addons.ToList();
                _addonRepeater.DataBind();

                MoreProductsRepeater.DataBind();
            }

            foreach (var item in _customNavItems)
            {
                var render = WebItemManager.Instance[item.ID] as IRenderCustomNavigation;
                if (render == null)
                {
                    continue;
                }

                try
                {
                    var control = render.LoadCustomNavigationControl(Page);
                    if (control != null)
                    {
                        _customNavControls.Controls.Add(control);
                    }
                }
                catch (Exception ex)
                {
                    log4net.LogManager.GetLogger("ASC.Web.Studio").Error(ex);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            debugInfoPopUpContainer.Options.IsPopup = true;

            aboutCompanyPopupContainer.Options.IsPopup = true;
            RenderVideoHandlers();

            if (!DisableSearch)
            {
                RenderSearchProducts();
                DisableSearch = DisableSearch || !SearchProducts.Any() || CoreContext.Configuration.Personal;
            }

            UserInfoVisible =
                (!DisableUserInfo.HasValue || !DisableUserInfo.Value) &&
                SecurityContext.IsAuthenticated;

            if (SecurityContext.IsAuthenticated)
            {
                CurrentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            }

            if (!SecurityContext.IsAuthenticated || !TenantExtra.EnableTarrifSettings || CoreContext.Configuration.Personal || CurrentUser.IsVisitor())
            {
                DisableTariff = true;
            }

            _customNavItems = WebItemManager.Instance.GetItems(WebZoneType.CustomProductList, ItemAvailableState.Normal);

            if (CurrentUser.IsVisitor())
            {
                _customNavItems.RemoveAll(item => item.ID == WebItemManager.MailProductID); // remove mail for guest
            }

            if (DisableProductNavigation && SecurityContext.IsAuthenticated)
            {
                _productListHolder.Visible = false;
            }
            else
            {
                var productsList = WebItemManager.Instance.GetItems(WebZoneType.TopNavigationProductList, ItemAvailableState.Normal);
                DisplayModuleList           = productsList.Any() && !CoreContext.Configuration.Personal;
                _productRepeater.DataSource = productsList;

                _productRepeater.DataBind();

                var addons = _customNavItems.Where(pr => ((pr.ID == WebItemManager.CalendarProductID || pr.ID == WebItemManager.TalkProductID || pr.ID == WebItemManager.MailProductID)));
                _addonRepeater.DataSource = addons.ToList();
                _addonRepeater.DataBind();
            }

            foreach (var item in _customNavItems)
            {
                var render = WebItemManager.Instance[item.ID] as IRenderCustomNavigation;
                if (render == null)
                {
                    continue;
                }

                try
                {
                    var control = render.LoadCustomNavigationControl(Page);
                    if (control != null)
                    {
                        _customNavControls.Controls.Add(control);
                    }
                }
                catch (Exception ex)
                {
                    log4net.LogManager.GetLogger("ASC.Web.Studio").Error(ex);
                }
            }
            if (CoreContext.Configuration.PartnerHosted)
            {
                IsAutorizePartner = false;
                var partner = CoreContext.PaymentManager.GetApprovedPartner();
                if (partner != null)
                {
                    IsAutorizePartner = !string.IsNullOrEmpty(partner.AuthorizedKey);
                    Partner           = partner;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!DisableSearch)
            {
                RenderSearchProducts();
                DisableSearch = DisableSearch || !SearchProducts.Any() || CoreContext.Configuration.Personal;
            }

            if (SecurityContext.IsAuthenticated)
            {
                CurrentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);

                if (CurrentUser.IsOutsider())
                {
                    DisableUserInfo = true;
                }

                UserInfoVisible = !DisableUserInfo.HasValue || !DisableUserInfo.Value;
            }

            if (!SecurityContext.IsAuthenticated || !TenantExtra.EnableTarrifSettings || CoreContext.Configuration.Personal || CurrentUser.IsVisitor())
            {
                DisableTariff = true;
            }

            _customNavItems = WebItemManager.Instance.GetItems(WebZoneType.CustomProductList, ItemAvailableState.Normal);

            if (DisableProductNavigation && SecurityContext.IsAuthenticated)
            {
                _productListHolder.Visible = false;
            }
            else
            {
                var productsList = WebItemManager.Instance.GetItems(WebZoneType.TopNavigationProductList, ItemAvailableState.Normal);
                DisplayModuleList           = productsList.Any() && !CoreContext.Configuration.Personal;
                _productRepeater.DataSource = productsList;

                _productRepeater.DataBind();

                var addons = _customNavItems.Where(pr => ((pr.ID == WebItemManager.CalendarProductID || pr.ID == WebItemManager.TalkProductID || pr.ID == WebItemManager.MailProductID)));
                _addonRepeater.DataSource = addons.ToList();
                _addonRepeater.DataBind();
            }

            foreach (var item in _customNavItems)
            {
                var render = WebItemManager.Instance[item.ID] as IRenderCustomNavigation;
                if (render == null)
                {
                    continue;
                }

                try
                {
                    var control = render.LoadCustomNavigationControl(Page);
                    if (control != null)
                    {
                        _customNavControls.Controls.Add(control);
                    }
                }
                catch (Exception ex)
                {
                    log4net.LogManager.GetLogger("ASC.Web.Studio").Error(ex);
                }
            }

            if (CoreContext.Configuration.PartnerHosted)
            {
                IsAuthorizedPartner = false;
                var partner = CoreContext.PaymentManager.GetApprovedPartner();
                if (partner != null)
                {
                    IsAuthorizedPartner = !string.IsNullOrEmpty(partner.AuthorizedKey);
                    Partner             = partner;
                }
            }

            if (!DisableTariff)
            {
                var tariff = TenantExtra.GetCurrentTariff();
                TariffDays = tariff.DueDate.Date.Subtract(DateTime.Today).Days;

                if (tariff.State == TariffState.Trial && TariffDays >= 0)
                {
                    DisplayTrialCountDays = true;
                }
            }

            if (VoipNavigation.VoipEnabled)
            {
                _voipPhonePlaceholder.Controls.Add(LoadControl(VoipPhoneControl.Location));
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var currentProductId = string.IsNullOrEmpty(Request["productID"]) ? CommonLinkUtility.GetProductID() : new Guid(Request["productID"]);

            CurrentProduct = WebItemManager.Instance[currentProductId] as IProduct;

            if (CurrentProduct != null)
            {
                CurrentProductClassName = CurrentProduct.ProductClassName;
                CurrentProductName      = CurrentProduct.Name;
            }
            else
            {
                GetAddonNameAndClass();
            }

            if (!DisableSearch)
            {
                RenderSearchProducts();
                DisableSearch = DisableSearch || !SearchProducts.Any() || CoreContext.Configuration.Personal;
            }

            if (SecurityContext.IsAuthenticated)
            {
                CurrentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);

                if (CurrentUser.IsOutsider())
                {
                    DisableUserInfo = true;
                }

                UserInfoVisible = !DisableUserInfo.HasValue || !DisableUserInfo.Value;
            }

            if (!SecurityContext.IsAuthenticated ||
                !TenantExtra.EnableTariffSettings ||
                CoreContext.Configuration.Personal ||
                CurrentUser.IsVisitor() ||
                (!CurrentUser.IsAdmin() && (TariffSettings.HidePricingPage || CoreContext.Configuration.Standalone)))
            {
                DisableTariff = true;
            }

            _customNavItems = WebItemManager.Instance.GetItems(WebZoneType.CustomProductList, ItemAvailableState.Normal);

            if (DisableProductNavigation && SecurityContext.IsAuthenticated)
            {
                _productListHolder.Visible = false;
            }
            else
            {
                var productsList = WebItemManager.Instance.GetItems(WebZoneType.TopNavigationProductList, ItemAvailableState.Normal);

                DisplayModuleList = productsList.Any() && !CoreContext.Configuration.Personal;

                Modules       = new List <IWebItem>();
                CustomModules = new List <IWebItem>();

                foreach (var webItem in productsList)
                {
                    if (webItem.ID != WebItemManager.DocumentsProductID &&
                        webItem.ID != WebItemManager.ProjectsProductID &&
                        webItem.ID != WebItemManager.CRMProductID &&
                        webItem.ID != WebItemManager.PeopleProductID &&
                        webItem.ID != WebItemManager.CommunityProductID)
                    {
                        CustomModules.Add(webItem);
                    }
                }

                var currentItem = productsList.Find(r => r.ID == WebItemManager.DocumentsProductID);
                if (currentItem != null)
                {
                    Modules.Add(currentItem);
                    productsList.Remove(currentItem);
                }
                currentItem = productsList.Find(r => r.ID == WebItemManager.ProjectsProductID);
                if (currentItem != null)
                {
                    Modules.Add(currentItem);
                    productsList.Remove(currentItem);
                }
                currentItem = productsList.Find(r => r.ID == WebItemManager.CRMProductID);
                if (currentItem != null)
                {
                    Modules.Add(currentItem);
                    productsList.Remove(currentItem);
                }
                if (CurrentUser != null && !CurrentUser.IsOutsider())
                {
                    currentItem = _customNavItems.Find(r => r.ID == WebItemManager.MailProductID);
                    if (currentItem != null)
                    {
                        Modules.Add(currentItem);
                    }
                }
                currentItem = productsList.Find(r => r.ID == WebItemManager.PeopleProductID);
                if (currentItem != null)
                {
                    Modules.Add(currentItem);
                    productsList.Remove(currentItem);
                }
                currentItem = productsList.Find(r => r.ID == WebItemManager.CommunityProductID);
                if (currentItem != null)
                {
                    Modules.Add(currentItem);
                    productsList.Remove(currentItem);
                }

                var isEnabledTalk = ConfigurationManagerExtension.AppSettings["web.talk"] ?? "false";
                Addons = _customNavItems
                         .Where(item =>
                                (item.ID == WebItemManager.CalendarProductID ||
                                 (item.ID == WebItemManager.TalkProductID && isEnabledTalk == "true")))
                         .OrderBy(item => item.Context.DefaultSortOrder);

                CustomNavigationItems = CustomNavigationSettings.Load().Items.Where(x => x.ShowInMenu);
            }

            foreach (var item in _customNavItems)
            {
                var render = WebItemManager.Instance[item.ID] as IRenderCustomNavigation;
                if (render == null)
                {
                    continue;
                }

                try
                {
                    var control = render.LoadCustomNavigationControl(Page);
                    if (control != null)
                    {
                        _customNavControls.Controls.Add(control);
                    }
                }
                catch (Exception ex)
                {
                    LogManager.GetLogger("ASC.Web.Studio").Error(ex);
                }
            }

            if (!DisableTariff)
            {
                var tariff = TenantExtra.GetCurrentTariff();
                TariffDays = tariff.DueDate.Date.Subtract(DateTime.Today).Days;

                if (tariff.State == TariffState.Trial && TariffDays >= 0)
                {
                    DisplayTrialCountDays = true;
                }
            }

            Settings = CompanyWhiteLabelSettings.Instance;

            ShowAppsNavItem = SetupInfo.IsVisibleSettings("AppsNavItem");

            ShowDesktopNavItem = !CoreContext.Configuration.CustomMode;

            if (!DisableGift)
            {
                DisableGift = !SecurityContext.IsAuthenticated ||
                              CoreContext.Configuration.Personal ||
                              !TenantExtra.Opensource ||
                              string.IsNullOrEmpty(SetupInfo.ControlPanelUrl) ||
                              OpensourceGiftSettings.LoadForCurrentUser().Readed;
            }

            Startup = !CoreContext.Configuration.CustomMode && TenantExtra.Saas && TenantExtra.GetTenantQuota().Free;
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var currentProductID = string.IsNullOrEmpty(Request["productID"]) ? CommonLinkUtility.GetProductID() : new Guid(Request["productID"]);

            CurrentProduct = WebItemManager.Instance[currentProductID] as IProduct;
            if (CurrentProduct != null)
            {
                CurrentProductClassName = CurrentProduct.ProductClassName;
                CurrentProductName      = CurrentProduct.Name;
            }
            else
            {
                GetAddonNameAndClass();
            }

            if (!DisableSearch)
            {
                RenderSearchProducts();
                DisableSearch = DisableSearch || !SearchProducts.Any() || CoreContext.Configuration.Personal;
            }

            if (SecurityContext.IsAuthenticated)
            {
                CurrentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);

                if (CurrentUser.IsOutsider())
                {
                    DisableUserInfo = true;
                }

                UserInfoVisible = !DisableUserInfo.HasValue || !DisableUserInfo.Value;
            }

            if (!SecurityContext.IsAuthenticated || !TenantExtra.EnableTarrifSettings || CoreContext.Configuration.Personal || CurrentUser.IsVisitor() || (!CurrentUser.IsAdmin() && TariffSettings.HidePricingPage))
            {
                DisableTariff = true;
            }

            _customNavItems = WebItemManager.Instance.GetItems(WebZoneType.CustomProductList, ItemAvailableState.Normal);

            if (DisableProductNavigation && SecurityContext.IsAuthenticated)
            {
                _productListHolder.Visible = false;
            }
            else
            {
                var productsList = WebItemManager.Instance.GetItems(WebZoneType.TopNavigationProductList, ItemAvailableState.Normal);
                DisplayModuleList           = productsList.Any() && !CoreContext.Configuration.Personal;
                _productRepeater.DataSource = productsList;

                _productRepeater.DataBind();

                var addons = _customNavItems.Where(pr => ((pr.ID == WebItemManager.CalendarProductID || pr.ID == WebItemManager.TalkProductID || pr.ID == WebItemManager.MailProductID)));
                _addonRepeater.DataSource = addons.ToList();
                _addonRepeater.DataBind();
            }

            foreach (var item in _customNavItems)
            {
                var render = WebItemManager.Instance[item.ID] as IRenderCustomNavigation;
                if (render == null)
                {
                    continue;
                }

                try
                {
                    var control = render.LoadCustomNavigationControl(Page);
                    if (control != null)
                    {
                        _customNavControls.Controls.Add(control);
                    }
                }
                catch (Exception ex)
                {
                    log4net.LogManager.GetLogger("ASC.Web.Studio").Error(ex);
                }
            }

            if (!DisableTariff)
            {
                var tariff = TenantExtra.GetCurrentTariff();
                TariffDays = tariff.DueDate.Date.Subtract(DateTime.Today).Days;

                if (tariff.State == TariffState.Trial && TariffDays >= 0)
                {
                    DisplayTrialCountDays = true;
                }
            }


            Settings = CompanyWhiteLabelSettings.Instance;
        }