def remove(request,projectid): result=True try: MemberService.remove_member(request,projectid) except Exception as ex: result=ProjectRes.project_member_remove_fail SimpleLogger.error(ex) return HttpResponse(result)
def update_member_role(request,projectid,userid): result=True try: MemberService.update_role(request,projectid,userid) except Exception as ex: result=ProjectRes.project_member_update_role_fail SimpleLogger.error(ex) return HttpResponse(result)
def add(request,projectid): result=True try: member_ids=request.POST.get("user_ids") if member_ids!="null": print(eval(member_ids)) for member_id in eval(member_ids+","): MemberService.add_member(int(member_id),projectid,request.user) except Exception as ex: result=ProjectRes.project_member_save_fail SimpleLogger.error(ex) return HttpResponse(result)
def import_member(request,projectid): result=True try: from_project_id=request.POST.get("from_project") from_project_members=MemberService.get_member_users(int(from_project_id)) current_project_members=MemberService.get_member_users(int(projectid)) for member in from_project_members: if member not in current_project_members: MemberService.add_member(int(member.id),projectid,request.user) except Exception as ex: result=ProjectRes.project_member_save_fail SimpleLogger.error(ex) return HttpResponse(result)
def get_issue_detail(self,issue_id): dm_issue=ProjectIssue.objects.get(issue_id) vm_issue=VM_ProjectIssue(self.request.user.id,dm_issue) status_dropdown_menu=ProjectCommonControllPageWorker.get_issue_field_dropdown_menu(self,models.ProjectIssueStatus,dm_issue.Status) solution_dropdown_menu=ProjectCommonControllPageWorker.get_issue_field_dropdown_menu(self,models.ProjectIssueResolvedResult,dm_issue.Solution) severity_dropdown_menu=ProjectCommonControllPageWorker.get_issue_field_dropdown_menu(self,models.ProjectIssueSeverity,dm_issue.Severity) category_dropdown_menu=ProjectCommonControllPageWorker.get_issue_field_dropdown_menu(self,models.ProjectIssueCategory,dm_issue.IssueCategory) phase_dropdown_menu=ProjectCommonControllPageWorker.get_issue_field_dropdown_menu(self,models.ProjectPhase,dm_issue.ProjectPhase) os_dropdown_menu=ProjectCommonControllPageWorker.get_issue_field_dropdown_menu(self,models.ProjectOS,dm_issue.DeviceOS) os_version_dropdown_menu=ProjectCommonControllPageWorker.get_issue_device_version_dropdown_menu(self,dm_issue.DeviceOS,dm_issue.OSVersion) member_users=MemberService.get_member_users(dm_issue.Project) member_dropdown_menu=ProjectCommonControllPageWorker.get_member_dropdown_menu(self, member_users, dm_issue.Project, dm_issue.Processor) module_dropdown_menu=ProjectCommonControllPageWorker.get_module_dropdown_menu(self,dm_issue.Project, dm_issue.Module) version_dropdown_menu=ProjectCommonControllPageWorker.get_version_dropdown_menu(self,dm_issue.Project, dm_issue.Version) issue_attachment_upload_dropdown_menu=ProjectCommonControllPageWorker.get_issue_upload_dropdown_menu(self) issue_detail_activity=self.get_issue_detail_activity(issue_id) team_dropdown_menu=ProjectCommonControllPageWorker.get_team_dropdown_menu(self,dm_issue.Team) pagefileds={"issue":vm_issue,"status_dropdown_menu":status_dropdown_menu} pagefileds['member_dropdown_menu']=member_dropdown_menu pagefileds['module_dropdown_menu']=module_dropdown_menu pagefileds['version_dropdown_menu']=version_dropdown_menu pagefileds['solution_dropdown_menu']=solution_dropdown_menu pagefileds['severity_dropdown_menu']=severity_dropdown_menu pagefileds['category_dropdown_menu']=category_dropdown_menu pagefileds['phase_dropdown_menu']=phase_dropdown_menu pagefileds['os_dropdown_menu']=os_dropdown_menu pagefileds['os_version_dropdown_menu']=os_version_dropdown_menu pagefileds['issue_attachment_upload_dropdown_menu']=issue_attachment_upload_dropdown_menu pagefileds['issue_detail_activity']=issue_detail_activity pagefileds['team_dropdown_menu']=team_dropdown_menu return self.get_webpart(pagefileds,ProjectIssuePath.issue_detail)
def get_member_list(request, project_id): result = "" project = Project.objects.get(int(project_id)) if project: page_worker = ProjectCommonControllPageWorker(request) member_users = MemberService.get_member_users(project_id) result = page_worker.get_member_dropdownlist(member_users, project.id) return HttpResponse(result)
def get_issue_context(self,project_id): dm_members=MemberService.get_member_users(project_id) members=list() for dm_member in dm_members: temp_vm_member=VM_ProjectMember(project_id,dm_member,None,None) members.append(temp_vm_member) pagefileds={"members":members} return self.get_webpart(pagefileds,ProjectIssuePath.issue_context_menu)
def get_project_member_email_list(project_id, outputemaillist): email_list = outputemaillist members = MemberService.get_member_users(project_id) for member in members: if member.email in email_list: pass else: email_list.append(member.email) return email_list
def post(self, request, *args, **kwargs): member_list = list() project_id = int(self.kwargs.get('project_id', 0)) user_list = request.data.get("userID") for user_id in user_list: member = MemberService.add_member(user_id,project_id,request.user) if member: member_list.append(member) serializer = self.get_serializer(member_list, many=True) return response.Response(serializer.data, status=status.HTTP_201_CREATED)
def get_project_members(self, project_id, login_user): vm_members = list() for user in MemberService.get_member_users(project_id): member = ProjectMember.objects.get_members(project_id).filter( PMMember=user.id) role_menu = self.get_settings_project_member_role_menu( member[0].PMRoleID, login_user) tmp_member = VM_ProjectMember(project_id, user, role_menu, login_user) vm_members.append(tmp_member) return vm_members
def get_tasks(self, all_tasks, page_fullpart=True, show_user=True, show_tag=True): task_list = list() for dm_task in all_tasks: tag_menu = self.get_task_tag_menu(dm_task, "tag-inline") owners = MemberService.get_member_users(dm_task.ProjectID) owner_menu = self.get_task_owner_menu(dm_task, owners, None, "member-inline") tmp_task = VM_ProjectTask(dm_task, tag_menu, owner_menu, None, False, page_fullpart, show_user, show_tag) task_list.append(tmp_task) return task_list
def get_project_member_add_dialog(self, request, projectid): project_common_page_worker = ProjectCommonControllPageWorker(request) project_list_controll = project_common_page_worker.get_myproject_dropdown_list( request, 0) member_users = MemberService.get_member_users(projectid) member_user_ids = [user.id for user in member_users] not_member_users = UserService.all_users().exclude( id__in=member_user_ids) source_user_list = project_common_page_worker.get_user_listbox( not_member_users, projectid) member_user_list = project_common_page_worker.get_user_listbox( member_users, projectid) pagefileds = { "project_list_controll": project_list_controll, "source_user_list": source_user_list, 'member_user_list': member_user_list } return self.get_webpart(pagefileds, ProjectSettingsPath.project_member_add_dialog)
def get_issue_form_controll(self,request,projectid,vm_issue): project_dorpdownlist=ProjectCommonControllPageWorker.get_myproject_dropdown_list(self, request, 0) module_dorpdownlist=ProjectCommonControllPageWorker.get_module_dropdown_list(self, projectid,0) version_dorpdownlist=ProjectCommonControllPageWorker.get_version_dropdown_list(self,projectid,0,False) issue_category=ProjectCommonControllPageWorker.get_issue_field_dropdown_list(self,models.ProjectIssueCategory,0) issue_severity=ProjectCommonControllPageWorker.get_issue_field_dropdown_list(self,models.ProjectIssueSeverity,0) member_users=MemberService.get_member_users(projectid) project_members=ProjectCommonControllPageWorker.get_member_dropdownlist(self, member_users, projectid,request.user.id) project_phase=ProjectCommonControllPageWorker.get_issue_field_dropdown_list(self,models.ProjectPhase,0) os_dropdown_list=ProjectCommonControllPageWorker.get_issue_field_dropdown_list(self,models.ProjectOS,0) os_version_dropdown_list=ProjectCommonControllPageWorker.get_os_version_dropdown_list(self,models.ProjectOSVersion,1,0) team_dropdown_list=ProjectCommonControllPageWorker.get_team_dropdown_list(self,0) pagefileds={'issue':vm_issue,"module_dorpdownlist":module_dorpdownlist,"project_dorpdownlist":project_dorpdownlist} pagefileds['version_dorpdownlist']=version_dorpdownlist pagefileds["issue_category"]=issue_category pagefileds["issue_severity"]=issue_severity pagefileds["project_phase"]=project_phase pagefileds["project_members"]=project_members pagefileds["os_dropdown_list"]=os_dropdown_list pagefileds["os_version_dropdown_list"]=os_version_dropdown_list pagefileds["team_dropdown_list"]=team_dropdown_list return self.get_webpart(pagefileds, ProjectIssuePath.issue_create_form_path)
def get_issue_filter_body(self,projectid,filter_id=0): if str(filter_id)!="0": issue_filter=IssueFilter.objects.get(int(filter_id)) vm_issue_filter=VM_IssueFilter(issue_filter,projectid) else: vm_issue_filter=VM_IssueFilter(None,projectid) project_dropdown_list=ProjectCommonControllPageWorker.get_myproject_dropdown_list(self, self.request,vm_issue_filter.project()) member_users=MemberService.get_member_users(vm_issue_filter.project()) processor_dropdown_list=ProjectCommonControllPageWorker.get_member_dropdownlist(self, member_users, vm_issue_filter.project(),vm_issue_filter.processors()) reporter_dropdown_list=ProjectCommonControllPageWorker.get_member_dropdownlist(self, member_users, vm_issue_filter.project(),vm_issue_filter.creators()) project_version_dropdown_list=ProjectCommonControllPageWorker.get_version_dropdown_list(self,vm_issue_filter.project(),vm_issue_filter.versions(),True) team_dropdown_list=ProjectCommonControllPageWorker.get_team_dropdown_list(self,0) pagefileds={"processor_dropdown_list":processor_dropdown_list} pagefileds['reporter_dropdown_list']=reporter_dropdown_list pagefileds['project_dropdown_list']=project_dropdown_list pagefileds['status_list']=self.get_issue_field_list(models.ProjectIssueStatus.objects.all(),vm_issue_filter.status()) pagefileds['severity_list']=self.get_issue_field_list(models.ProjectIssueSeverity.objects.all(),vm_issue_filter.severity()) pagefileds['solution_list']=self.get_issue_field_list(models.ProjectIssueResolvedResult.objects.all(),vm_issue_filter.solution()) pagefileds['project_version_dropdown_list']=project_version_dropdown_list pagefileds['create_date']=vm_issue_filter.create_date pagefileds['team_dropdown_list']=team_dropdown_list return self.get_webpart(pagefileds,ProjectIssuePath.issue_filter_body)