Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MyProjects = RequestContext.CurrentUserProjects;

            InitControls();

            IsProjectAdmin = Page.Participant.IsAdmin;
            IsFullAdmin    = Page.Participant.IsFullAdmin;
            IsOutsider     = Page.Participant.UserInfo.IsOutsider();

            ParticipantSecurityInfo = new Dictionary <string, bool>
            {
                { "Project", IsProjectAdmin },
                { "Milestone", RequestContext.CanCreateMilestone() },
                { "Task", RequestContext.CanCreateTask() },
                { "Discussion", RequestContext.CanCreateDiscussion() },
                { "Time", RequestContext.CanCreateTime() },
                { "ProjectTemplate", IsProjectAdmin }
            };

            ShowCreateButton = (ParticipantSecurityInfo.Any(r => r.Value) || Page is TMDocs) && !Page.Participant.UserInfo.IsOutsider();


            var mobileAppRegistrator = new CachedMobileAppInstallRegistrator(new MobileAppInstallRegistrator());
            var currentUser          = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            var isRegistered         = mobileAppRegistrator.IsInstallRegistered(currentUser.Email, null);

            DisplayAppsBanner =
                SetupInfo.DisplayMobappBanner("projects") &&
                !CoreContext.Configuration.Standalone &&
                !isRegistered;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            MyProjects = RequestContext.CurrentUserProjects;

            InitControls();

            IsProjectAdmin = Page.Participant.IsAdmin;
            IsFullAdmin    = Page.Participant.IsFullAdmin;

            ParticipantSecurityInfo = new Dictionary <string, bool>
            {
                { "Project", IsProjectAdmin },
                { "Milestone", RequestContext.CanCreateMilestone() },
                { "Task", RequestContext.CanCreateTask() },
                { "Discussion", RequestContext.CanCreateDiscussion() },
                { "Time", RequestContext.CanCreateTime() },
                { "ProjectTemplate", IsProjectAdmin }
            };

            ShowCreateButton = ParticipantSecurityInfo.Any(r => r.Value) || Page is TMDocs;
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CurrentPage = Page.Master.CurrentPage;
            MyProjects  = RequestContext.GetCurrentUserProjects();

            Page.RegisterInlineScript(@"ASC.Projects.navSidePanel.init();");

            InitControls();

            IsProjectAdmin = Page.Participant.IsAdmin;
            IsFullAdmin    = Page.Participant.IsFullAdmin;

            ParticipantSecurityInfo = new Dictionary <string, bool>
            {
                { "Project", IsProjectAdmin },
                { "Milestone", RequestContext.CanCreateMilestone() },
                { "Task", RequestContext.CanCreateTask() },
                { "Discussion", RequestContext.CanCreateDiscussion() },
                { "Time", RequestContext.CanCreateTime() },
                { "ProjectTemplate", IsProjectAdmin }
            };

            CanCreate = ParticipantSecurityInfo.Any(r => r.Value);
        }
Ejemplo n.º 4
0
        protected override void PageLoad()
        {
            Utility.RegisterTypeForAjax(typeof(CommonControlsConfigurer), Page);

            var messageEngine = Global.EngineFactory.GetMessageEngine();

            CanCreate = RequestContext.CanCreateDiscussion(true);

            int discussionId;

            if (int.TryParse(UrlParameters.EntityID, out discussionId))
            {
                Discussion = messageEngine.GetByID(discussionId);

                if (string.Compare(UrlParameters.ActionType, "edit", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    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  = messageEngine.IsSubscribed(Discussion);
                    EssenceTitle = Discussion.Title;

                    Title = HeaderStringHelper.GetPageTitle(Discussion.Title);
                }
                else
                {
                    RedirectNotFound(string.Format("messages.aspx?prjID={0}", Project.ID));
                }
            }
            else
            {
                if (string.Compare(UrlParameters.ActionType, "add", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    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));
                }
            }
        }
Ejemplo n.º 5
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));
                }
            }
        }
Ejemplo n.º 6
0
        private void InitEmptyScreens()
        {
            emptyScreenPlaceHolders.Controls.Add(RenderEmptyScreenForFilter(MessageResource.FilterNoDiscussions, MessageResource.DescrEmptyListMilFilter, "discEmptyScreenForFilter"));
            emptyScreenPlaceHolders.Controls.Add(RenderEmptyScreenForFilter(TaskResource.NoTasks, TaskResource.DescrEmptyListTaskFilter, "tasksEmptyScreenForFilter"));
            emptyScreenPlaceHolders.Controls.Add(RenderEmptyScreenForFilter(MilestoneResource.FilterNoMilestones, MilestoneResource.DescrEmptyListMilFilter, "mileEmptyScreenForFilter"));
            emptyScreenPlaceHolders.Controls.Add(RenderEmptyScreenForFilter(ProjectsCommonResource.Filter_NoProjects, ProjectResource.DescrEmptyListProjFilter, "prjEmptyScreenForFilter"));
            emptyScreenPlaceHolders.Controls.Add(RenderEmptyScreenForFilter(TimeTrackingResource.NoTimersFilter, TimeTrackingResource.DescrEmptyListTimersFilter, "timeEmptyScreenForFilter"));

            emptyScreenPlaceHolders.Controls.Add(new EmptyScreenControl
            {
                ImgSrc     = WebImageSupplier.GetAbsoluteWebPath("empty_screen_tasks.png", ProductEntryPoint.ID),
                Header     = TaskResource.NoTasksCreated,
                Describe   = String.Format(TaskResource.TasksHelpTheManage, TaskResource.DescrEmptyListTaskFilter),
                ID         = "emptyListTask",
                ButtonHTML = RequestContext.CanCreateTask(true) ? String.Format("<span class='link dotline addFirstElement'>{0}</span>", TaskResource.AddFirstTask) : string.Empty
            });

            emptyScreenPlaceHolders.Controls.Add(new EmptyScreenControl
            {
                ImgSrc     = WebImageSupplier.GetAbsoluteWebPath("empty_screen_discussions.png", ProductEntryPoint.ID),
                Header     = MessageResource.DiscussionNotFound_Header,
                Describe   = MessageResource.DiscussionNotFound_Describe,
                ID         = "emptyListDiscussion",
                ButtonHTML = RequestContext.CanCreateDiscussion(true) ?
                             (RequestContext.IsInConcreteProject
                                ? String.Format("<a href='messages.aspx?prjID={0}&action=add' class='link dotline addFirstElement'>{1}</a>", RequestContext.GetCurrentProjectId(), MessageResource.StartFirstDiscussion)
                                : String.Format("<a href='messages.aspx?action=add' class='link dotline addFirstElement'>{0}</a>", MessageResource.StartFirstDiscussion))
                            : string.Empty
            });

            emptyScreenPlaceHolders.Controls.Add(new EmptyScreenControl
            {
                ImgSrc     = WebImageSupplier.GetAbsoluteWebPath("empty_screen_milestones.png", ProductEntryPoint.ID),
                Header     = MilestoneResource.MilestoneNotFound_Header,
                Describe   = String.Format(MilestoneResource.MilestonesMarkMajorTimestamps),
                ID         = "emptyListMilestone",
                ButtonHTML = RequestContext.CanCreateMilestone(true) ? String.Format("<a class='link dotline addFirstElement'>{0}</a>", MilestoneResource.PlanFirstMilestone) : string.Empty
            });

            emptyScreenPlaceHolders.Controls.Add(new EmptyScreenControl
            {
                Header     = ProjectResource.EmptyListProjHeader,
                ImgSrc     = WebImageSupplier.GetAbsoluteWebPath("projects_logo.png", ProductEntryPoint.ID),
                Describe   = ProjectResource.EmptyListProjDescribe,
                ID         = "emptyListProjects",
                ButtonHTML = ProjectSecurity.CanCreateProject() ? string.Format("<a href='projects.aspx?action=add' class='projectsEmpty link dotline addFirstElement'>{0}<a>", ProjectResource.CreateFirstProject) : string.Empty
            });

            emptyScreenPlaceHolders.Controls.Add(new EmptyScreenControl
            {
                ImgSrc     = WebImageSupplier.GetAbsoluteWebPath("empty_screen_time_tracking.png", ProductEntryPoint.ID),
                Header     = TimeTrackingResource.NoTtimers,
                Describe   = String.Format(TimeTrackingResource.NoTimersNote),
                ID         = "emptyListTimers",
                ButtonHTML = String.Format("<span class='link dotline addFirstElement {1}'>{0}</span>", TimeTrackingResource.StartTimer, RequestContext.CanCreateTime(true) ? string.Empty : "display-none")
            });

            emptyScreenPlaceHolders.Controls.Add(new EmptyScreenControl
            {
                Header     = ProjectTemplatesResource.EmptyListTemplateHeader,
                ImgSrc     = WebImageSupplier.GetAbsoluteWebPath("project-templates_logo.png", ProductEntryPoint.ID),
                Describe   = ProjectTemplatesResource.EmptyListTemplateDescr,
                ID         = "emptyListTemplates",
                ButtonHTML = string.Format("<a href='projectTemplates.aspx?action=add' class='projectsEmpty link dotline addFirstElement'>{0}<a>", ProjectTemplatesResource.EmptyListTemplateButton)
            });
        }
Ejemplo n.º 7
0
        protected override void PageLoad()
        {
            InitScripts();

            var messageEngine = Global.EngineFactory.GetMessageEngine();

            if (RequestContext.IsInConcreteProject && !ProjectSecurity.CanReadMessages(Project))
            {
                Response.Redirect("projects.aspx?prjID=" + Project.ID, true);
            }

            CanCreate = RequestContext.CanCreateDiscussion(true);

            int discussionId;

            if (int.TryParse(UrlParameters.EntityID, out discussionId))
            {
                if (Project == null)
                {
                    return;
                }

                Discussion = messageEngine.GetByID(discussionId);

                if (string.Compare(UrlParameters.ActionType, "edit", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (ProjectSecurity.CanEdit(Discussion))
                    {
                        LoadDiscussionActionControl(Project, 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(Project, Discussion);

                    Master.EssenceTitle = Discussion.Title;

                    Title = HeaderStringHelper.GetPageTitle(Discussion.Title);

                    Master.IsSubcribed = messageEngine.IsSubscribed(Discussion);
                }
                else
                {
                    LoadElementNotFoundControl(Project.ID);

                    Title = HeaderStringHelper.GetPageTitle(MessageResource.MessageNotFound_Header);
                }
            }
            else
            {
                if (string.Compare(UrlParameters.ActionType, "add", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (CanCreate)
                    {
                        LoadDiscussionActionControl(Project, null);

                        Title = HeaderStringHelper.GetPageTitle(MessageResource.CreateMessage);
                    }
                    else
                    {
                        Response.Redirect("messages.aspx", true);
                    }
                }
                else
                {
                    var filter = new TaskFilter();

                    if (RequestContext.IsInConcreteProject)
                    {
                        filter.ProjectIds.Add(RequestContext.GetCurrentProjectId());
                    }

                    var allDiscCount = messageEngine.GetByFilterCount(filter);

                    if (allDiscCount > 0)
                    {
                        LoadDiscussionsListControl(Project == null ? -1 : Project.ID, allDiscCount);
                    }

                    var emptyScreenControl = new Studio.Controls.Common.EmptyScreenControl
                    {
                        ImgSrc   = WebImageSupplier.GetAbsoluteWebPath("empty_screen_discussions.png", ProductEntryPoint.ID),
                        Header   = MessageResource.DiscussionNotFound_Header,
                        Describe = MessageResource.DiscussionNotFound_Describe,
                        ID       = "emptyListDiscussion"
                    };

                    if (CanCreate)
                    {
                        emptyScreenControl.ButtonHTML = RequestContext.IsInConcreteProject
                            ? String.Format("<a href='messages.aspx?prjID={0}&action=add' class='baseLinkAction addFirstElement'>{1}</a>", Project.ID, MessageResource.StartFirstDiscussion)
                            : String.Format("<a href='messages.aspx?action=add' class='baseLinkAction addFirstElement'>{0}</a>", MessageResource.StartFirstDiscussion);
                    }

                    contentHolder.Controls.Add(emptyScreenControl);

                    Title = HeaderStringHelper.GetPageTitle(MessageResource.Messages);
                }
            }
        }