Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _hintPopup.Options.IsPopup = true;

            ParticipiantCount = Page.EngineFactory.MessageEngine.GetSubscribers(Discussion).Count;

            CanEdit           = ProjectSecurity.CanEdit(Discussion);
            CanReadFiles      = ProjectSecurity.CanReadFiles(Discussion.Project);
            CanEditFiles      = ProjectSecurity.IsInTeam(Project) && Discussion.Status == MessageStatus.Open && Project.Status == ProjectStatus.Open;
            Author            = CoreContext.UserManager.GetUsers(Discussion.CreateBy);
            FilesCount        = Page.EngineFactory.MessageEngine.GetFiles(Discussion).Count();
            FilesAvailable    = CanReadFiles && (CanEditFiles || FilesCount > 0);
            CommentsAvailable = Discussion.Status == MessageStatus.Open || Discussion.CommentsCount > 0;

            CommentsCountTitle = Discussion.CommentsCount != 0 ? Discussion.CommentsCount.ToString(CultureInfo.InvariantCulture) : "";

            if (FilesAvailable)
            {
                LoadDiscussionFilesControl();
            }

            if (Discussion.Status == MessageStatus.Archived)
            {
                Page.EssenceStatus = MessageResource.ArchiveDiscussionStatus;
            }

            if (CommentsAvailable)
            {
                InitCommentBlock(discussionComments, Discussion);
            }
            else
            {
                discussionComments.Visible = false;
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.RegisterTypeForAjax(typeof(DiscussionDetails), Page);

            _hintPopup.Options.IsPopup = true;

            LoadCommentsControl();

            BindDiscussionParticipants();
            CanEdit = ProjectSecurity.CanEdit(Discussion);

            if (CanEdit)
            {
                LoadDiscussionParticipantsSelector();
            }

            CanReadFiles = ProjectSecurity.CanReadFiles(Discussion.Project);
            CanEditFiles = ProjectSecurity.IsInTeam(Project);
            IsMobile     = MobileDetector.IsRequestMatchesMobile(Context);

            FilesCount = GetDiscussionFilesCount();

            if (CanReadFiles && (CanEditFiles || FilesCount > 0))
            {
                LoadDiscussionFilesControl();
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.RegisterTypeForAjax(typeof(DiscussionDetails), Page);

            _hintPopup.Options.IsPopup = true;

            LoadCommentsControl();

            BindDiscussionParticipants();
            CanEdit = ProjectSecurity.CanEdit(Discussion);

            if (CanEdit)
            {
                LoadDiscussionParticipantsSelector();
            }

            CanReadFiles = ProjectSecurity.CanReadFiles(Discussion.Project);
            CanEditFiles = ProjectSecurity.IsInTeam(Project);
            Author       = CoreContext.UserManager.GetUsers(Discussion.CreateBy);
            FilesCount   = FileEngine2.GetMessageFiles(Discussion).Count();

            if (CanReadFiles && (CanEditFiles || FilesCount > 0))
            {
                LoadDiscussionFilesControl();
            }
            Page.EssenceStatus = string.Empty;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.RegisterTypeForAjax(typeof(DiscussionDetails), Page);

            _hintPopup.Options.IsPopup = true;

            BindDiscussionParticipants();

            CanEdit           = ProjectSecurity.CanEdit(Discussion);
            CanReadFiles      = ProjectSecurity.CanReadFiles(Discussion.Project);
            CanEditFiles      = ProjectSecurity.IsInTeam(Project) && Discussion.Status == MessageStatus.Open;
            Author            = CoreContext.UserManager.GetUsers(Discussion.CreateBy);
            FilesCount        = FileEngine2.GetMessageFiles(Discussion).Count();
            FilesAvailable    = CanReadFiles && !MobileDetector.IsMobile && (CanEditFiles || FilesCount > 0);
            CommentsAvailable = Discussion.Status == MessageStatus.Open || Discussion.CommentsCount > 0;

            if (FilesAvailable)
            {
                LoadDiscussionFilesControl();
            }

            if (Discussion.Status == MessageStatus.Archived)
            {
                Page.EssenceStatus = MessageResource.ArchiveDiscussionStatus;
            }

            if (CommentsAvailable)
            {
                LoadCommentsControl();
            }
            else
            {
                discussionComments.Visible = false;
            }
        }
Example #5
0
 public ProjectSecurityInfo(Project project)
 {
     CanCreateMilestone = ProjectSecurity.CanCreateMilestone(project);
     CanCreateMessage   = ProjectSecurity.CanCreateMessage(project);
     CanCreateTask      = ProjectSecurity.CanCreateTask(project);
     CanEditTeam        = ProjectSecurity.CanEditTeam(project);
     CanReadFiles       = ProjectSecurity.CanReadFiles(project);
     CanReadMilestones  = ProjectSecurity.CanReadMilestones(project);
     CanReadMessages    = ProjectSecurity.CanReadMessages(project);
     CanReadTasks       = ProjectSecurity.CanReadTasks(project);
     IsInTeam           = ProjectSecurity.IsInTeam(project, SecurityContext.CurrentAccount.ID, false);
     CanLinkContact     = ProjectSecurity.CanLinkContact(project);
 }
Example #6
0
        protected override IEnumerable <KeyValuePair <string, object> > GetClientVariables(HttpContext context)
        {
            var result = new List <KeyValuePair <string, object> >(5)
            {
                RegisterObject("EntryCountOnPage", Global.EntryCountOnPage),
                RegisterObject("VisiblePageCount", Global.VisiblePageCount)
            };

            var filter = new TaskFilter
            {
                SortBy          = "title",
                SortOrder       = true,
                ProjectStatuses = new List <ProjectStatus> {
                    ProjectStatus.Open
                }
            };

            var projects = Global.EngineFactory.ProjectEngine.GetByFilter(filter)
                           .Select(pr => new
            {
                id          = pr.ID,
                title       = pr.Title,
                responsible = pr.Responsible,
                //created = (ApiDateTime) pr.CreateOn,
                security = new
                {
                    canCreateMilestone = ProjectSecurity.CanCreateMilestone(pr),
                    canCreateMessage   = ProjectSecurity.CanCreateMessage(pr),
                    canCreateTask      = ProjectSecurity.CanCreateTask(pr),
                    canEditTeam        = ProjectSecurity.CanEditTeam(pr),
                    canReadFiles       = ProjectSecurity.CanReadFiles(pr),
                    canReadMilestones  = ProjectSecurity.CanReadMilestones(pr),
                    canReadMessages    = ProjectSecurity.CanReadMessages(pr),
                    canReadTasks       = ProjectSecurity.CanReadTasks(pr),
                    isInTeam           = ProjectSecurity.IsInTeam(pr, SecurityContext.CurrentAccount.ID, false),
                    canLinkContact     = ProjectSecurity.CanLinkContact(pr),
                },
                isPrivate = pr.Private,
                status    = pr.Status
            });

            var tags = Global.EngineFactory.TagEngine.GetTags().Select(r => new { value = r.Key, title = r.Value.HtmlEncode() });

            result.Add(RegisterObject("Projects", new { response = projects }));
            result.Add(RegisterObject("Tags", new { response = tags }));


            if (context.Request.UrlReferrer != null && string.IsNullOrEmpty(HttpUtility.ParseQueryString(context.Request.GetUrlRewriter().Query)["prjID"]) && string.IsNullOrEmpty(HttpUtility.ParseQueryString(context.Request.UrlReferrer.Query)["prjID"]))
            {
                filter = new TaskFilter
                {
                    SortBy            = "deadline",
                    SortOrder         = false,
                    MilestoneStatuses = new List <MilestoneStatus> {
                        MilestoneStatus.Open
                    }
                };

                var milestones = Global.EngineFactory.MilestoneEngine.GetByFilter(filter)
                                 .Select(m => new
                {
                    id           = m.ID,
                    title        = m.Title,
                    deadline     = SetDate(m.DeadLine, TimeZoneInfo.Local),
                    projectOwner = new { id = m.Project.ID }
                });

                result.Add(RegisterObject("Milestones", new { response = milestones }));
            }

            return(result);
        }
Example #7
0
        protected override IEnumerable <KeyValuePair <string, object> > GetClientVariables(HttpContext context)
        {
            var filter = new TaskFilter
            {
                SortBy          = "title",
                SortOrder       = true,
                ProjectStatuses = new List <ProjectStatus> {
                    ProjectStatus.Open
                }
            };

            var projects = Global.EngineFactory.ProjectEngine.GetByFilter(filter)
                           .Select(pr => new
            {
                id          = pr.ID,
                title       = pr.Title,
                responsible = pr.Responsible,
                //created = (ApiDateTime) pr.CreateOn,
                security = new
                {
                    canCreateMilestone = ProjectSecurity.CanCreateMilestone(pr),
                    canCreateMessage   = ProjectSecurity.CanCreateMessage(pr),
                    canCreateTask      = ProjectSecurity.CanCreateTask(pr),
                    canCreateTimeSpend = ProjectSecurity.CanCreateTimeSpend(pr),
                    canEditTeam        = ProjectSecurity.CanEditTeam(pr),
                    canReadFiles       = ProjectSecurity.CanReadFiles(pr),
                    canReadMilestones  = ProjectSecurity.CanReadMilestones(pr),
                    canReadMessages    = ProjectSecurity.CanReadMessages(pr),
                    canReadTasks       = ProjectSecurity.CanReadTasks(pr),
                    isInTeam           = ProjectSecurity.IsInTeam(pr, SecurityContext.CurrentAccount.ID, false),
                    canLinkContact     = ProjectSecurity.CanLinkContact(pr)
                },
                isPrivate      = pr.Private,
                status         = pr.Status,
                taskCountTotal = pr.TaskCountTotal
            }).ToList();

            var tags = Global.EngineFactory.TagEngine.GetTags().Select(r => new { value = r.Key, title = r.Value.HtmlEncode() }).ToList();

            var result = new List <KeyValuePair <string, object> >(1)
            {
                RegisterObject(
                    new
                {
                    Global.EntryCountOnPage,
                    Global.VisiblePageCount,
                    Projects      = new { response = projects },
                    Tags          = new { response = tags },
                    ProjectsCount = Global.EngineFactory.ProjectEngine.GetByFilterCount(new TaskFilter())
                })
            };

            filter = new TaskFilter
            {
                SortBy            = "deadline",
                SortOrder         = false,
                MilestoneStatuses = new List <MilestoneStatus> {
                    MilestoneStatus.Open
                }
            };

            var milestones = Global.EngineFactory.MilestoneEngine.GetByFilter(filter)
                             .Select(m => new
            {
                id           = m.ID,
                title        = m.Title,
                deadline     = SetDate(m.DeadLine, TimeZoneInfo.Local),
                projectOwner = new { id = m.Project.ID },
                status       = (int)m.Status
            }).ToList();

            result.Add(RegisterObject(new { Milestones = new { response = milestones } }));

            return(result);
        }