protected override void PageLoad() { CanLinkContact = ProjectSecurity.CanLinkContact(Project); var button = ""; if (CanLinkContact) { button = "<a class='link-with-entity link dotline'>" + ProjectsCommonResource.EmptyScreenContactsButton + "</a>"; } var escNoContacts = new Studio.Controls.Common.EmptyScreenControl { Header = ProjectsCommonResource.EmptyScreenContasctsHeader, ImgSrc = WebImageSupplier.GetAbsoluteWebPath("empty_screen_persons.png", ProductEntryPoint.ID), Describe = ProjectsCommonResource.EmptyScreenContactsDescribe, ID = "escNoContacts", ButtonHTML = button, CssClass = "display-none" }; emptyScreen.Controls.Add(escNoContacts); Page.Title = HeaderStringHelper.GetPageTitle(ProjectsCommonResource.ModuleContacts); Master.RegisterCRMResources(); Page.RegisterBodyScripts(PathProvider.GetFileStaticRelativePath, "contacts.js"); }
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); }
protected override void PageLoad() { if (!ProjectSecurity.CanReadContacts(Project)) { Response.Redirect("projects.aspx?prjID=" + Project.ID, true); } var crmEnabled = WebItemManager.Instance[new Guid("6743007C-6F95-4d20-8C88-A8601CE5E76D")]; if (crmEnabled == null || crmEnabled.IsDisabled()) { Response.Redirect(String.Concat(PathProvider.BaseAbsolutePath, "tasks.aspx?prjID=" + RequestContext.GetCurrentProjectId())); } CanLinkContact = ProjectSecurity.CanLinkContact(Project); var button = ""; if (CanLinkContact) { button = "<a class='link-with-entity baseLinkAction'>" + ProjectsCommonResource.EmptyScreenContactsButton + "</a>"; } var escNoContacts = new Studio.Controls.Common.EmptyScreenControl { Header = ProjectsCommonResource.EmptyScreenContasctsHeader, ImgSrc = WebImageSupplier.GetAbsoluteWebPath("empty_screen_persons.png", ProductEntryPoint.ID), Describe = ProjectsCommonResource.EmptyScreenContactsDescribe, ID = "escNoContacts", ButtonHTML = button, CssClass = "display-none" }; emptyScreen.Controls.Add(escNoContacts); Page.Title = HeaderStringHelper.GetPageTitle(ProjectsCommonResource.ModuleContacts); Master.RegisterCRMResources(); Page.RegisterBodyScripts(PathProvider.GetFileStaticRelativePath("contacts.js")); }
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); }
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); }