def get(self, domain_identifier, task_identifier): task = api.get_task(domain_identifier, task_identifier) user = api.get_and_validate_user(domain_identifier) view = self.request.get('view', 'all') if not task or not user: self.error(404) return session = Session(writer='cookie', wsgiref_headers=self.response.headers) user = api.get_logged_in_user() domain = api.get_domain(domain_identifier) if view == 'yours': subtasks = api.get_assigned_tasks(domain_identifier, user, root_task=task, limit=200) subtasks_heading = "Subtasks of '%s' Assigned to You" % task.title( ) no_subtasks_description = "No subtasks are assigned to you." elif view == 'open': subtasks = api.get_open_tasks(domain_identifier, root_task=task, limit=200) subtasks_heading = "Open Subtasks of '%s'" % task.title() no_subtasks_description = "No open subtasks for this task." else: # view == 'all' or None view = 'all' user_id = user.identifier() subtasks = api.get_all_direct_subtasks(domain_identifier, root_task=task, limit=200, user_identifier=user_id) subtasks_heading = "All Subtasks of '%s'" % task.title() no_subtasks_description = "No subtasks for this task." parent_task = task.parent_task parent_identifier = parent_task.identifier() if parent_task else "" parent_title = parent_task.title() if parent_task else "" template_values = { 'domain_name': domain.name, 'domain_identifier': domain_identifier, 'view_mode': view, 'user_name': user.name, 'user_identifier': user.identifier(), 'messages': get_and_delete_messages(session), 'task_title': task.title(), 'task_description': task.description_body(), 'task_assignee': task.assignee_description(), 'task_identifier': task.identifier(), 'task_has_subtasks': not task.atomic(), 'task_can_assign_to_self': api.can_assign_to_self(task, user), 'task_can_edit': api.can_edit_task(domain, task, user), 'subtasks': _task_template_values(subtasks, user), 'parent_identifier': parent_identifier, 'parent_title': parent_title, 'subtasks_heading': subtasks_heading, 'no_subtasks_description': no_subtasks_description, } self.response.out.write( render_template('templates/taskdetail.html', template_values))
def get(self, domain_identifier, task_identifier): task = api.get_task(domain_identifier, task_identifier) user = api.get_and_validate_user(domain_identifier) view = self.request.get('view', 'all') if not task or not user: self.error(404) return session = Session(writer='cookie', wsgiref_headers=self.response.headers) user = api.get_logged_in_user() domain = api.get_domain(domain_identifier) if view == 'yours': subtasks = api.get_assigned_tasks(domain_identifier, user, root_task=task, limit=200) subtasks_heading = "Subtasks of '%s' Assigned to You" % task.title() no_subtasks_description = "No subtasks are assigned to you." elif view == 'open': subtasks = api.get_open_tasks(domain_identifier, root_task=task, limit=200) subtasks_heading = "Open Subtasks of '%s'" % task.title() no_subtasks_description = "No open subtasks for this task." else: # view == 'all' or None view = 'all' user_id = user.identifier() subtasks = api.get_all_direct_subtasks(domain_identifier, root_task=task, limit=200, user_identifier=user_id) subtasks_heading = "All Subtasks of '%s'" % task.title() no_subtasks_description = "No subtasks for this task." parent_task = task.parent_task parent_identifier = parent_task.identifier() if parent_task else "" parent_title = parent_task.title() if parent_task else "" template_values = { 'domain_name': domain.name, 'domain_identifier': domain_identifier, 'view_mode': view, 'user_name': user.name, 'user_identifier': user.identifier(), 'messages': get_and_delete_messages(session), 'task_title' : task.title(), 'task_description': task.description_body(), 'task_assignee': task.assignee_description(), 'task_identifier': task.identifier(), 'task_has_subtasks': not task.atomic(), 'task_can_assign_to_self': api.can_assign_to_self(task, user), 'task_can_edit': api.can_edit_task(domain, task, user), 'subtasks': _task_template_values(subtasks, user), 'parent_identifier': parent_identifier, 'parent_title': parent_title, 'subtasks_heading': subtasks_heading, 'no_subtasks_description': no_subtasks_description, } self.response.out.write(render_template('templates/taskdetail.html', template_values))
def get(self, domain_identifier, task_identifier): task = api.get_task(domain_identifier, task_identifier) user = api.get_and_validate_user(domain_identifier) if not task or not user: self.error(404) return session = Session(writer='cookie', wsgiref_headers=self.response.headers) domain = api.get_domain(domain_identifier) if not api.can_edit_task(domain, task, user): self.error(403) return # Tasks that are used to create the navigation tasks for # moving the task. user_id = user.identifier() tasks = api.get_all_direct_subtasks(domain_identifier, root_task=None, limit=200, user_identifier=user_id) template_values = { 'domain_name': domain.name, 'domain_identifier': domain_identifier, 'user_name': user.name, 'user_identifier': user.identifier(), 'messages': get_and_delete_messages(session), 'task_title': task.title(), 'task_description': task.description, 'task_identifier': task.identifier(), 'tasks': _task_template_values(tasks, user), 'show_radio_buttons': True, 'view_mode': 'all', } self.response.out.write( render_template('templates/edittask.html', template_values))
def get(self, domain_identifier, task_identifier): task = api.get_task(domain_identifier, task_identifier) user = api.get_and_validate_user(domain_identifier) if not task or not user: self.error(404) return session = Session(writer='cookie', wsgiref_headers=self.response.headers) domain = api.get_domain(domain_identifier) if not api.can_edit_task(domain, task, user): self.error(403) return # Tasks that are used to create the navigation tasks for # moving the task. user_id = user.identifier() tasks = api.get_all_direct_subtasks(domain_identifier, root_task=None, limit=200, user_identifier=user_id) template_values = { 'domain_name': domain.name, 'domain_identifier': domain_identifier, 'user_name': user.name, 'user_identifier': user.identifier(), 'messages': get_and_delete_messages(session), 'task_title' : task.title(), 'task_description': task.description, 'task_identifier': task.identifier(), 'tasks': _task_template_values(tasks, user), 'show_radio_buttons': True, 'view_mode': 'all', } self.response.out.write(render_template('templates/edittask.html', template_values))
def get(self, *args): domain_identifier = args[0] user = api.get_and_validate_user(domain_identifier) if not user: self.abort(404) task_identifier = args[1] if len(args) > 1 else None if task_identifier: task = api.get_task(domain_identifier, task_identifier) if not task: self.abort(404) else: task = None # No task specified view = self.request.get('view', 'all') session = Session(writer='cookie', wsgiref_headers=self.response.headers) domain = api.get_domain(domain_identifier) if view == 'yours': subtasks = api.get_assigned_tasks(domain_identifier, user, root_task=task, limit=500) no_tasks_description = "No tasks are assigned to you." elif view == 'open': subtasks = api.get_open_tasks(domain_identifier, root_task=task, limit=500) no_tasks_description = "No open tasks for this task." else: # view == 'all' or None view = 'all' user_id = user.identifier() subtasks = api.get_all_direct_subtasks(domain_identifier, root_task=task, limit=500, user_identifier=user_id) no_tasks_description = "No subtasks for this task." parent_task = task.parent_task if task else None parent_identifier = parent_task.identifier() if parent_task else "" parent_title = parent_task.title() if parent_task else "" if task: task_values = { 'task_title' : task.title(), 'task_description': task.description_body(), 'task_assignee': task.assignee_description(), 'task_creator': task.user_name(), 'task_identifier': task.identifier(), 'task_has_subtasks': not task.atomic(), 'task_can_assign_to_self': api.can_assign_to_self(task, user), 'task_can_edit': api.can_edit_task(domain, task, user), } else: task_values = {} base_url = '/d/' + domain_identifier if task: base_url += '/task/' + task_identifier template_values = { 'domain_name': domain.name, 'domain_identifier': domain_identifier, 'view_mode': view, 'user_name': user.name, 'user_identifier': user.identifier(), 'messages': get_and_delete_messages(session), 'subtasks': _task_template_values(subtasks, user), 'task_identifier': task_identifier, # None if no task is selected 'parent_identifier': parent_identifier, 'parent_title': parent_title, 'no_tasks_description': no_tasks_description, 'base_url': base_url, } template_values.update(task_values) self.render_template('taskdetail.html', **template_values)