Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(ActionContainer), this.Page);

            _storage = StorageFactory.GetStorage();
            _requestHelper = new RequestHelper(Request, _storage);

            var currentModule = UserOnlineManager.Instance.GetCurrentModule() as Module;
            if (currentModule == null) return;

            var actionsControl = new SideActions();
            if (CommunitySecurity.CheckPermissions(ASC.PhotoManager.PhotoConst.Action_AddPhoto) && !MobileDetector.IsRequestMatchesMobile(Context))
            {
                actionsControl.Controls.Add(new NavigationItem()
                {
                    Name = PhotoManagerResource.UploadPhotosLink,
                    Description = PhotoManagerResource.UploadPhotosLinkDescription,
                    URL = ASC.PhotoManager.PhotoConst.AddPhotoPageUrl
                        + (_requestHelper.EventId != 0 ? "?" + ASC.PhotoManager.PhotoConst.PARAM_EVENT + "=" + _requestHelper.EventId : ""),
                    IsPromo = (SetupInfo.WorkMode == WorkMode.Promo)
                });
            }

            if (IAmAsRecipient != null)
            {
                actionsControl.Controls.Add(new HtmlMenuItem(RenderSubscriptionOnUploadsLink()));
            }
            if (IAmAsRecipient != null && _requestHelper.EventId != 0)
            {
                actionsControl.Controls.Add(new HtmlMenuItem(RenderSubscriptionOnEventLink(_requestHelper.EventId)));
            }
            if (actionsControl.Controls.Count > 0)
            {
                _actionHolder.Controls.Add(actionsControl);
            }
            if (ActionsPlaceHolder.Controls.Count > 0)
            {
                actionsControl.Controls.Add(ActionsPlaceHolder);
            }
            if (currentModule.Navigations.Any())
            {
                var navigationControl = new SideNavigator();
                foreach (var shortcut in currentModule.Navigations)
                {
                    if (shortcut.ID == new Guid("4367C1B3-9F22-41a9-9CF1-DDCC612AFEE0") && !SecurityContext.IsAuthenticated)
                    {
                        // skip My Photos for guest
                        continue;
                    }
                    navigationControl.Controls.Add(new NavigationItem()
                    {
                        Name = shortcut.Name,
                        Description = shortcut.Description,
                        URL = shortcut.StartURL
                    });
                }
                _actionHolder.Controls.Add(navigationControl);
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(ActionContainer), this.Page);

            _storage       = StorageFactory.GetStorage();
            _requestHelper = new RequestHelper(Request, _storage);

            var currentModule = UserOnlineManager.Instance.GetCurrentModule() as Module;

            if (currentModule == null)
            {
                return;
            }

            var actionsControl = new SideActions();

            if (CommunitySecurity.CheckPermissions(ASC.PhotoManager.PhotoConst.Action_AddPhoto) && !MobileDetector.IsRequestMatchesMobile(Context))
            {
                actionsControl.Controls.Add(new NavigationItem()
                {
                    Name        = PhotoManagerResource.UploadPhotosLink,
                    Description = PhotoManagerResource.UploadPhotosLinkDescription,
                    URL         = ASC.PhotoManager.PhotoConst.AddPhotoPageUrl
                                  + (_requestHelper.EventId != 0 ? "?" + ASC.PhotoManager.PhotoConst.PARAM_EVENT + "=" + _requestHelper.EventId : ""),
                    IsPromo = (SetupInfo.WorkMode == WorkMode.Promo)
                });
            }

            if (IAmAsRecipient != null)
            {
                actionsControl.Controls.Add(new HtmlMenuItem(RenderSubscriptionOnUploadsLink()));
            }
            if (IAmAsRecipient != null && _requestHelper.EventId != 0)
            {
                actionsControl.Controls.Add(new HtmlMenuItem(RenderSubscriptionOnEventLink(_requestHelper.EventId)));
            }
            if (actionsControl.Controls.Count > 0)
            {
                _actionHolder.Controls.Add(actionsControl);
            }
            if (ActionsPlaceHolder.Controls.Count > 0)
            {
                actionsControl.Controls.Add(ActionsPlaceHolder);
            }
            if (currentModule.Navigations.Any())
            {
                var navigationControl = new SideNavigator();
                foreach (var shortcut in currentModule.Navigations)
                {
                    if (shortcut.ID == new Guid("4367C1B3-9F22-41a9-9CF1-DDCC612AFEE0") && !SecurityContext.IsAuthenticated)
                    {
                        // skip My Photos for guest
                        continue;
                    }
                    navigationControl.Controls.Add(new NavigationItem()
                    {
                        Name        = shortcut.Name,
                        Description = shortcut.Description,
                        URL         = shortcut.StartURL
                    });
                }
                _actionHolder.Controls.Add(navigationControl);
            }
        }