예제 #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;
            }
        }
예제 #2
0
        protected override void PageLoad()
        {
            if (!Global.ModuleManager.IsVisible(ModuleType.TMDocs))
            {
                Response.Redirect(ProjectsCommonResource.StartURL);
            }

            int projectID;

            int.TryParse(UrlParameters.ProjectID, out projectID);
            var project = Global.EngineFactory.GetProjectEngine().GetByID(projectID);

            if (project == null || !ProjectSecurity.CanReadFiles(project))
            {
                Response.Redirect(ProjectsCommonResource.StartURL.ToLower());
            }

            var mainMenu = (MainMenu)LoadControl(MainMenu.Location);

            mainMenu.EnableImport     = false;
            mainMenu.EnableThirdParty = false;
            CommonContainerHolder.Controls.Add(mainMenu);

            var mainContent = (MainContent)LoadControl(MainContent.Location);

            mainContent.FolderIDCurrentRoot = FileEngine2.GetRoot(projectID);
            mainContent.TitlePage           = ProjectsCommonResource.ModuleName;
            mainContent.CurrentUserAdmin    = project.Responsible == SecurityContext.CurrentAccount.ID || ProjectSecurity.IsAdministrator(SecurityContext.CurrentAccount.ID);
            CommonContainerHolder.Controls.Add(mainContent);

            Title = HeaderStringHelper.GetPageTitle(ProjectsFileResource.Files, Master.BreadCrumbs);

            Master.DisabledSidePanel = true;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.RegisterTypeForAjax(typeof(DiscussionDetails), Page);
            Global.EngineFactory.GetParticipantEngine().Read(Page.Participant.ID, Discussion.UniqID, TenantUtil.DateTimeNow());

            _hintPopup.Options.IsPopup = true;

            LoadEmptyCommentsControl();
            LoadCommentsControl();

            BindDiscussionParticipants();

            CanEdit = ProjectSecurity.CanEdit(Discussion);

            if (CanEdit)
            {
                LoadDiscussionParticipantsSelector();
            }

            CanReadFiles = ProjectSecurity.CanReadFiles(Discussion.Project) && Global.ModuleManager.IsVisible(ModuleType.TMDocs);

            if (CanReadFiles)
            {
                LoadDiscussionFilesControl();
            }
        }
예제 #4
0
        public static List <ProjectCommonModule> GetModules(Project project)
        {
            var modules = new List <ProjectCommonModule>
            {
                new MilestonesModule(project),
                new TasksModule(project),
                new ProjectTeamModule(project)
            };

            if (ProjectSecurity.CanReadFiles(project))
            {
                modules.Add(new DocumentsModule(project));
            }

            if (ProjectSecurity.CanReadMessages(project))
            {
                modules.Add(new MessagesModule(project));
            }

            if (ProjectSecurity.CanCreateTimeSpend(project))
            {
                modules.Add(new TimeTrackingModule(project));
            }


            var crmEnabled = WebItemManager.Instance[new Guid("6743007C-6F95-4d20-8C88-A8601CE5E76D")];

            if (crmEnabled != null && !crmEnabled.IsDisabled() && ProjectSecurity.CanReadContacts(project))
            {
                modules.Add(new ContactsModule(project));
            }

            return(modules.OrderBy(r => r.Context.DefaultSortOrder).ToList());
        }
예제 #5
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();
            }
        }
예제 #6
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;
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _hintPopup.Options.IsPopup           = true;
            _hintPopupTaskRemove.Options.IsPopup = true;

            var subtasks = (Subtasks)LoadControl(PathProvider.GetControlVirtualPath("Subtasks.ascx"));

            _subtasksTemplates.Controls.Add(subtasks);

            CanReadFiles = ProjectSecurity.CanReadFiles(Task.Project) && Global.ModuleManager.IsVisible(ModuleType.TMDocs);

            if (CanReadFiles)
            {
                InitAttachments();
            }

            InitEmptySubtasksPanel();
            InitEmptyCommentsPanel();
            InitCommentBlock();

            var timeList = Global.EngineFactory.GetTimeTrackingEngine().GetByTask(Task.ID);

            TaskTimeSpend = timeList.Sum(timeSpend => timeSpend.Hours).ToString();
            TaskTimeSpend = TaskTimeSpend.Replace(',', '.');

            Global.EngineFactory.GetParticipantEngine().Read(Page.Participant.ID, Task.UniqID, TenantUtil.DateTimeNow());
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.RegisterTypeForAjax(typeof(TaskDescriptionView), Page);

            _hintPopup.Options.IsPopup           = true;
            _hintPopupTaskRemove.Options.IsPopup = true;
            _newLinkError.Options.IsPopup        = true;

            IsMobile = MobileDetector.IsRequestMatchesMobile(Context);

            CanReadFiles       = ProjectSecurity.CanReadFiles(Task.Project);
            CanEditTask        = ProjectSecurity.CanEdit(Task);
            CanCreateSubtask   = ProjectSecurity.CanCreateSubtask(Task);
            CanCreateTimeSpend = ProjectSecurity.CanCreateTimeSpend(Task);
            CanDeleteTask      = ProjectSecurity.CanDelete(Task);
            SubtasksCount      = Task.SubTasks.Count;

            if (CanReadFiles)
            {
                InitAttachments();
            }

            InitCommentBlock();

            var timeList = Global.EngineFactory.GetTimeTrackingEngine().GetByTask(Task.ID);

            TaskTimeSpend = timeList.Sum(timeSpend => timeSpend.Hours).ToString();
            TaskTimeSpend = TaskTimeSpend.Replace(',', '.');
        }
        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;
            }
        }
예제 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _hintPopup.Options.IsPopup           = true;
            _hintPopupTaskRemove.Options.IsPopup = true;
            _newLinkError.Options.IsPopup        = true;

            CanReadFiles       = ProjectSecurity.CanReadFiles(Task.Project);
            CanEditTask        = ProjectSecurity.CanEdit(Task);
            CanCreateSubtask   = ProjectSecurity.CanCreateSubtask(Task);
            CanCreateTimeSpend = ProjectSecurity.CanCreateTimeSpend(Task);
            CanDeleteTask      = ProjectSecurity.CanDelete(Task);
            SubtasksCount      = Task.SubTasks.Count;

            if (CanReadFiles)
            {
                InitAttachments();
            }

            InitCommentBlock(commentList, Task);

            var timeList = Page.EngineFactory.TimeTrackingEngine.GetByTask(Task.ID);

            TaskTimeSpend = timeList.Sum(timeSpend => timeSpend.Hours).ToString();
            TaskTimeSpend = TaskTimeSpend.Replace(',', '.');

            var taskCount = Page.EngineFactory.CommentEngine.Count(Task);

            CommentsCountTitle = taskCount != 0 ? string.Format("({0})", taskCount.ToString(CultureInfo.InvariantCulture)) : "";
        }
예제 #11
0
 public MessageWrapperFull(Message message, ProjectWrapperFull project, IEnumerable <EmployeeWraperFull> subscribers) : base(message)
 {
     CanEditFiles = ProjectSecurity.CanEditFiles(message);
     CanReadFiles = ProjectSecurity.CanReadFiles(message.Project);
     Text         = HtmlUtility.GetFull(Text);
     Project      = project;
     Subscribers  = subscribers.ToList();
 }
예제 #12
0
        private bool Can(FileEntry fileEntry, Guid userId, SecurityAction action)
        {
            if (fileEntry == null || project == null)
            {
                return(false);
            }

            if (!ProjectSecurity.CanReadFiles(project, userId))
            {
                return(false);
            }

            if (project.Status == ProjectStatus.Closed &&
                action != SecurityAction.Read)
            {
                return(false);
            }

            if (ProjectSecurity.IsAdministrator(userId))
            {
                return(true);
            }

            using (var scope = DIHelper.Resolve())
            {
                var projectEngine = scope.Resolve <EngineFactory>().ProjectEngine;

                var folder = fileEntry as Folder;
                if (folder != null && folder.FolderType == FolderType.DEFAULT && folder.CreateBy == userId)
                {
                    return(true);
                }

                var file = fileEntry as File;
                if (file != null && file.CreateBy == userId)
                {
                    return(true);
                }

                switch (action)
                {
                case SecurityAction.Read:
                    return(!project.Private || projectEngine.IsInTeam(project.ID, userId));

                case SecurityAction.Create:
                case SecurityAction.Edit:
                    return(projectEngine.IsInTeam(project.ID, userId) &&
                           (!ProjectSecurity.IsVisitor(userId) ||
                            folder != null && folder.FolderType == FolderType.BUNCH));

                case SecurityAction.Delete:
                    return(!ProjectSecurity.IsVisitor(userId) && project.Responsible == userId);

                default:
                    return(false);
                }
            }
        }
예제 #13
0
        public TaskWrapper(Task task)
        {
            Id          = task.ID;
            Title       = task.Title;
            Description = task.Description;
            Status      = (int)task.Status;

            if (Status > 2)
            {
                Status = 1;
            }

            if (task.Responsibles != null)
            {
                Responsibles = task.Responsibles.Select(EmployeeWraper.Get).OrderBy(r => r.DisplayName).ToList();
            }


            Deadline     = (task.Deadline == DateTime.MinValue ? null : new ApiDateTime(task.Deadline, TimeZoneInfo.Local));
            Priority     = task.Priority;
            ProjectOwner = new SimpleProjectWrapper(task.Project);
            MilestoneId  = task.Milestone;
            Created      = (ApiDateTime)task.CreateOn;
            CreatedBy    = EmployeeWraper.Get(task.CreateBy);
            Updated      = (ApiDateTime)task.LastModifiedOn;
            StartDate    = task.StartDate.Equals(DateTime.MinValue) ? null : (ApiDateTime)task.StartDate;

            if (task.CreateBy != task.LastModifiedBy)
            {
                UpdatedBy = EmployeeWraper.Get(task.LastModifiedBy);
            }

            if (task.SubTasks != null)
            {
                Subtasks = task.SubTasks.Select(x => new SubtaskWrapper(x, task)).ToList();
            }

            Progress = task.Progress;

            if (task.Milestone != 0 && task.MilestoneDesc != null)
            {
                Milestone = new SimpleMilestoneWrapper(task.MilestoneDesc);
            }

            if (task.Links.Any())
            {
                Links = task.Links.Select(r => new TaskLinkWrapper(r));
            }

            CanEdit            = ProjectSecurity.CanEdit(task);
            CanCreateSubtask   = ProjectSecurity.CanCreateSubtask(task);
            CanCreateTimeSpend = ProjectSecurity.CanCreateTimeSpend(task);
            CanDelete          = ProjectSecurity.CanDelete(task);
            CanReadFiles       = ProjectSecurity.CanReadFiles(task.Project);
        }
예제 #14
0
        private bool Can(FileEntry fileEntry, Guid userId, SecurityAction action)
        {
            if (fileEntry == null || Project == null)
            {
                return(false);
            }

            if (!ProjectSecurity.CanReadFiles(Project, userId))
            {
                return(false);
            }

            if (Project.Status != ProjectStatus.Open &&
                action != SecurityAction.Read)
            {
                return(false);
            }

            if (ProjectSecurity.IsAdministrator(userId))
            {
                return(true);
            }

            var folder = fileEntry as Folder;

            if (folder != null && folder.FolderType == FolderType.DEFAULT && folder.CreateBy == userId)
            {
                return(true);
            }

            var file = fileEntry as File;

            if (file != null && file.CreateBy == userId)
            {
                return(true);
            }

            switch (action)
            {
            case SecurityAction.Read:
                return(!Project.Private || Global.EngineFactory.ProjectEngine.IsInTeam(Project.ID, userId));

            case SecurityAction.Create:
            case SecurityAction.Edit:
                return(Global.EngineFactory.ProjectEngine.IsInTeam(Project.ID, userId) &&
                       (!ProjectSecurity.IsVisitor(userId) || folder != null && folder.FolderType == FolderType.BUNCH));

            case SecurityAction.Delete:
                return(!ProjectSecurity.IsVisitor(userId) && Project.Responsible == userId);

            default:
                return(false);
            }
        }
예제 #15
0
 public ProjectSecurityInfo(Project project)
 {
     CanCreateMessage   = ProjectSecurity.CanCreateMessage(project);
     CanCreateMilestone = ProjectSecurity.CanCreateMilestone(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);
 }
예제 #16
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);
 }
예제 #17
0
        private bool Can(FileEntry fileEntry, Guid userId, SecurityAction action)
        {
            if (!ProjectSecurity.CanReadFiles(Project, userId))
            {
                return(false);
            }

            if (ProjectSecurity.IsAdministrator(userId))
            {
                return(true);
            }
            if (fileEntry == null || Project == null)
            {
                return(false);
            }
            if (fileEntry is Folder && ((Folder)fileEntry).FolderType == FolderType.DEFAULT && fileEntry.CreateBy == userId)
            {
                return(true);
            }
            if (fileEntry is File && fileEntry.CreateBy == userId)
            {
                return(true);
            }

            switch (action)
            {
            case SecurityAction.Read:
                return(!Project.Private || dao.IsInTeam(Project.ID, userId));

            case SecurityAction.Create:
            case SecurityAction.Edit:
                return(dao.IsInTeam(Project.ID, userId) &&
                       (!ProjectSecurity.IsVisitor(userId) || fileEntry is Folder && ((Folder)fileEntry).FolderType == FolderType.BUNCH));

            case SecurityAction.Delete:
                return(!ProjectSecurity.IsVisitor(userId) && Project.Responsible == userId);

            default:
                return(false);
            }
        }
예제 #18
0
        protected override void PageLoad()
        {
            if (RequestContext.IsInConcreteProject && !ProjectSecurity.CanReadFiles(Project))
            {
                Response.Redirect("projects.aspx?prjID=" + Project.ID, true);
            }

            var mainContent = (MainContent)LoadControl(MainContent.Location);

            mainContent.FolderIDCurrentRoot = Project == null ? Files.Classes.Global.FolderProjects : FileEngine2.GetRoot(Project.ID);
            mainContent.TitlePage           = ProjectsCommonResource.ModuleName;
            CommonContainerHolder.Controls.Add(mainContent);

            Title = HeaderStringHelper.GetPageTitle(ProjectsFileResource.Files);

            Page.RegisterStyleControl(LoadControl(VirtualPathUtility.ToAbsolute("~/products/files/masters/styles.ascx")));
            Page.RegisterBodyScripts(LoadControl(VirtualPathUtility.ToAbsolute("~/products/files/masters/FilesScripts.ascx")));
            Page.RegisterClientLocalizationScript(typeof(Files.Masters.ClientScripts.FilesLocalizationResources));
            Page.RegisterClientScript(typeof(Files.Masters.ClientScripts.FilesConstantsResources));
            Page.RegisterInlineScript(@"ZeroClipboard.setMoviePath('" + CommonLinkUtility.ToAbsolute("~/js/flash/zeroclipboard/zeroclipboard10.swf") + "');", true);
        }
예제 #19
0
        private bool Can(FileEntry file, Guid userId, SecurityAction action)
        {
            if (!ProjectSecurity.CanReadFiles(Project))
            {
                return(false);
            }

            if (IsAdmin(userId))
            {
                return(true);
            }
            if (file == null || Project == null)
            {
                return(false);
            }
            if (file is Folder && ((Folder)file).FolderType == FolderType.DEFAULT && file.CreateBy == userId)
            {
                return(true);
            }
            if (file is File && file.CreateBy == userId)
            {
                return(true);
            }

            switch (action)
            {
            case SecurityAction.Read: return(Project.Private ? dao.IsInTeam(Project.ID, userId) : true);

            case SecurityAction.Create: return(dao.IsInTeam(Project.ID, userId));

            case SecurityAction.Edit: return(Project.Responsible == userId);

            case SecurityAction.Delete: return(Project.Responsible == userId);

            default: return(false);
            }
        }
        public void InitAttachments()
        {
            var attachments = Page.EngineFactory.TaskEngine.GetFiles(Task);

            AttachmentsCount = attachments.Count();

            CanAddFiles       = CanEditTask && Task.Project.Status == ProjectStatus.Open;
            DoInitAttachments = ProjectSecurity.CanReadFiles(Task.Project) && (CanAddFiles || AttachmentsCount > 0);

            if (!DoInitAttachments)
            {
                return;
            }

            ProjectFolderId = (int)Page.EngineFactory.FileEngine.GetRoot(Task.Project.ID);

            var taskAttachments = (Studio.UserControls.Common.Attachments.Attachments)LoadControl(Studio.UserControls.Common.Attachments.Attachments.Location);

            taskAttachments.EmptyScreenVisible = false;
            taskAttachments.EntityType         = "task";
            taskAttachments.ModuleName         = "projects";
            taskAttachments.CanAddFile         = CanAddFiles;
            phAttachmentsControl.Controls.Add(taskAttachments);
        }
예제 #21
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);
        }
예제 #22
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);
        }
예제 #23
0
        protected void RenderHeader()
        {
            var topNavigationPanel = (TopNavigationPanel)LoadControl(TopNavigationPanel.Location);

            topNavigationPanel.SingleSearchHandlerType = typeof(SearchHandler);

            var absolutePathWithoutQuery = Request.Url.AbsolutePath.Substring(0, Request.Url.AbsolutePath.IndexOf(".aspx"));
            var sysName   = absolutePathWithoutQuery.Substring(absolutePathWithoutQuery.LastIndexOf('/') + 1);
            var project   = RequestContext.GetCurrentProject(false);
            var projectID = -1;

            if (RequestContext.IsInConcreteProject())
            {
                projectID = project.ID;

                var rigthItems = new List <NavigationItem>();
                foreach (var webitem in WebItemManager.Instance.GetSubItems(ProductEntryPoint.ID))
                {
                    var module = webitem as IModule;

                    var navigationItem = new NavigationItem()
                    {
                        URL         = String.Format(webitem.StartURL, projectID),
                        Name        = webitem.Name,
                        Description = webitem.Description,
                        Selected    = String.Compare(sysName, module.ModuleSysName, true) == 0
                    };

                    var added = false;
                    if (String.Compare(module.ModuleSysName, "History", true) == 0 ||
                        String.Compare(module.ModuleSysName, "ProjectAction", true) == 0 ||
                        String.Compare(module.ModuleSysName, "ProjectTeam", true) == 0)
                    {
                        navigationItem.RightAlign = true;
                        rigthItems.Add(navigationItem);
                        added = true;
                    }

                    //hide in private projects
                    if (String.Compare(module.ModuleSysName, "Messages", true) == 0 && !ProjectSecurity.CanReadMessages(RequestContext.GetCurrentProject()))
                    {
                        continue;
                    }
                    if (String.Compare(module.ModuleSysName, "TMDocs", true) == 0 && !ProjectSecurity.CanReadFiles(RequestContext.GetCurrentProject()))
                    {
                        continue;
                    }

                    if (String.Compare(module.ModuleSysName, "TMDocs", true) == 0)
                    {
                        navigationItem.Selected = String.Compare(sysName, "tmdocs", true) == 0;
                        navigationItem.Name     = ProjectsFileResource.Documents;
                        navigationItem.URL      = PathProvider.BaseAbsolutePath + "tmdocs.aspx?prjID=" + projectID;
                    }

                    if (!added)
                    {
                        topNavigationPanel.NavigationItems.Add(navigationItem);
                    }
                }

                rigthItems.Reverse();
                topNavigationPanel.NavigationItems.AddRange(rigthItems);
            }
            else
            {
                topNavigationPanel.NavigationItems.Add(new NavigationItem
                {
                    URL         = String.Concat(PathProvider.BaseAbsolutePath, "default.aspx"),
                    Name        = ProjectsCommonResource.Dashboard,
                    Description = "",
                    Selected    = String.Compare(sysName, "Default", true) == 0
                });

                topNavigationPanel.NavigationItems.Add(new NavigationItem
                {
                    URL         = String.Concat(PathProvider.BaseAbsolutePath, "projects.aspx"),
                    Name        = ProjectResource.Projects,
                    Description = "",
                    Selected    = String.Compare(sysName, "Projects", true) == 0 || String.Compare(sysName, "ProjectAction", true) == 0
                });


                topNavigationPanel.NavigationItems.Add(new NavigationItem
                {
                    URL         = String.Concat(PathProvider.BaseAbsolutePath, "milestones.aspx"),
                    Name        = MilestoneResource.Milestones,
                    Description = "",
                    Selected    = String.Compare(sysName, "milestones", true) == 0
                });

                topNavigationPanel.NavigationItems.Add(new NavigationItem
                {
                    URL         = String.Concat(PathProvider.BaseAbsolutePath, "tasks.aspx"),
                    Name        = TaskResource.Tasks,
                    Description = "",
                    Selected    = String.Compare(sysName, "tasks", true) == 0
                });

                topNavigationPanel.NavigationItems.Add(new NavigationItem
                {
                    URL         = String.Concat(PathProvider.BaseAbsolutePath, "messages.aspx"),
                    Name        = MessageResource.Messages,
                    Description = "",
                    Selected    = String.Compare(sysName, "messages", true) == 0
                });

                topNavigationPanel.NavigationItems.Add(new NavigationItem
                {
                    URL         = String.Concat(PathProvider.BaseAbsolutePath, "reports.aspx"),
                    Name        = ReportResource.Reports,
                    Description = "",
                    Selected    = String.Compare(sysName, "Reports", true) == 0 || String.Compare(sysName, "Templates", true) == 0
                });

                topNavigationPanel.NavigationItems.Add(new NavigationItem
                {
                    URL         = String.Concat(PathProvider.BaseAbsolutePath, "history.aspx"),
                    Name        = ProjectsCommonResource.History,
                    Description = "",
                    Selected    = String.Compare(sysName, "History", true) == 0
                });


                if (ProjectSecurity.IsAdministrator(SecurityContext.CurrentAccount.ID))
                {
                    topNavigationPanel.NavigationItems.Add(new NavigationItem
                    {
                        URL         = String.Concat(PathProvider.BaseAbsolutePath, "projectTemplates.aspx"),
                        Name        = ProjectResource.ProjectTemplates,
                        Description = "",
                        Selected    = String.Compare(sysName, "ProjectTemplates", true) == 0,
                        RightAlign  = true
                    });
                }

                topNavigationPanel.NavigationItems.Add(new NavigationItem
                {
                    URL         = CommonLinkUtility.GetEmployees(ProductEntryPoint.ID),
                    Name        = CustomNamingPeople.Substitute <ProjectsCommonResource>("Employees"),
                    Description = "",
                    Selected    = UserOnlineManager.Instance.IsEmployeesPage() || UserOnlineManager.Instance.IsUserProfilePage(),
                    RightAlign  = true
                });
            }
            if (RequestContext.HasAnyProjects())
            {
                var pageName = "default";
                switch (sysName)
                {
                case "userprofile":
                case "default":
                case "reports":
                case "projectTemplates":
                case "createprojectfromtemplate":
                case "editprojecttemplate":
                    pageName = "projects";
                    break;

                case "settings":
                    pageName = "projectAction";
                    break;

                case "employee":
                    pageName = "projectTeam";
                    break;

                default:
                    pageName = sysName;
                    break;
                }
                topNavigationPanel.CustomInfoHTML = RenderAllProjectsBlock(projectID, pageName);
            }
            _topNavigationPanelPlaceHolder.Controls.Add(topNavigationPanel);
        }