Beispiel #1
0
    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))
Beispiel #2
0
    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))
Beispiel #3
0
    def get(self, domain_identifier):
        user = api.get_and_validate_user(domain_identifier)
        if not user:
            self.error(404)  # hides domain identifiers
            return
        session = Session(writer='cookie',
                          wsgiref_headers=self.response.headers)
        view = self.request.get('view', 'all')
        domain = api.get_domain(domain_identifier)
        if view == 'yours':
            tasks = api.get_assigned_tasks(domain_identifier,
                                           user,
                                           root_task=None,
                                           limit=200)
            no_tasks_message = "You do not have any unfinished tasks"
            tasks_heading = "Your Tasks"
        elif view == 'open':
            tasks = api.get_open_tasks(domain_identifier,
                                       root_task=None,
                                       limit=200)
            no_tasks_message = "No open subtasks in this domain"
            tasks_heading = "Open Tasks"
        else:  # view == 'all' or None
            view = 'all'
            user_id = user.identifier()
            tasks = api.get_all_direct_subtasks(domain_identifier,
                                                root_task=None,
                                                limit=200,
                                                user_identifier=user_id)
            tasks_heading = "All Tasks"
            no_tasks_message = "No tasks are created in this domain"

        template_values = {
            'domain_name': domain.name,
            'domain_identifier': domain_identifier,
            'user_name': user.name,
            'user_identifier': user.identifier(),
            'messages': get_and_delete_messages(session),
            'tasks': _task_template_values(tasks, user),
            'tasks_heading': tasks_heading,
            'no_tasks_message': no_tasks_message,
            'view_mode': view,
        }
        self.response.out.write(
            render_template('templates/overview.html', template_values))
Beispiel #4
0
    def get(self, domain_identifier):
        user = api.get_and_validate_user(domain_identifier)
        if not user:
            self.error(404)     # hides domain identifiers
            return
        session = Session(writer='cookie',
                          wsgiref_headers=self.response.headers)
        view = self.request.get('view', 'all')
        domain = api.get_domain(domain_identifier)
        if view == 'yours':
            tasks = api.get_assigned_tasks(domain_identifier,
                                           user,
                                           root_task=None,
                                           limit=200)
            no_tasks_message = "You do not have any unfinished tasks"
            tasks_heading = "Your Tasks"
        elif view == 'open':
            tasks = api.get_open_tasks(domain_identifier,
                                       root_task=None,
                                       limit=200)
            no_tasks_message = "No open subtasks in this domain"
            tasks_heading = "Open Tasks"
        else:                   # view == 'all' or None
            view = 'all'
            user_id = user.identifier()
            tasks = api.get_all_direct_subtasks(domain_identifier,
                                                root_task=None,
                                                limit=200,
                                                user_identifier=user_id)
            tasks_heading = "All Tasks"
            no_tasks_message = "No tasks are created in this domain"

        template_values = {
            'domain_name': domain.name,
            'domain_identifier': domain_identifier,
            'user_name': user.name,
            'user_identifier': user.identifier(),
            'messages': get_and_delete_messages(session),
            'tasks': _task_template_values(tasks, user),
            'tasks_heading': tasks_heading,
            'no_tasks_message': no_tasks_message,
            'view_mode': view,
            }
        self.response.out.write(render_template('templates/overview.html',
                                                template_values))
Beispiel #5
0
    def get(self):
        try:
            domain_identifier = self.request.get('domain')
            task_identifier = self.request.get('task')
            view = self.request.get('view')
            level = int(self.request.get('level', 0))
            show_radio_buttons = bool(self.request.get('radio', False))
        except (ValueError, TypeError):
            self.error(400)
            return
        user = api.get_and_validate_user(domain_identifier)
        if not user:
            self.error(403)
            return

        domain = api.get_domain(domain_identifier)
        task = api.get_task(domain_identifier, task_identifier)
        if view == 'yours':
            tasks = api.get_assigned_tasks(domain_identifier,
                                           user,
                                           root_task=task,
                                           limit=200)
        elif view == 'open':
            tasks = api.get_open_tasks(domain_identifier,
                                       root_task=task,
                                       limit=200)
        else:  # view == 'all' or None
            view = 'all'
            user_id = user.identifier()
            tasks = api.get_all_direct_subtasks(domain_identifier,
                                                root_task=task,
                                                limit=200,
                                                user_identifier=user_id)
        template_values = {
            'domain_name': domain.name,
            'domain_identifier': domain_identifier,
            'user_name': user.name,
            'user_identifier': user.identifier(),
            'tasks': _task_template_values(tasks, user, level=level + 1),
            'view_mode': view,
            'show_radio_buttons': show_radio_buttons,
        }
        self.response.out.write(
            render_template('templates/get-subtasks.html', template_values))
Beispiel #6
0
    def get(self):
        try:
            domain_identifier = self.request.get('domain')
            task_identifier = self.request.get('task')
            view = self.request.get('view')
            level = int(self.request.get('level', 0))
            show_radio_buttons = bool(self.request.get('radio', False))
        except (ValueError,TypeError):
            self.error(400)
            return
        user = api.get_and_validate_user(domain_identifier)
        if not user:
            self.error(403)
            return

        domain = api.get_domain(domain_identifier)
        task = api.get_task(domain_identifier, task_identifier)
        if view == 'yours':
            tasks = api.get_assigned_tasks(domain_identifier,
                                           user,
                                           root_task=task,
                                           limit=200)
        elif view == 'open':
            tasks = api.get_open_tasks(domain_identifier,
                                       root_task=task,
                                       limit=200)
        else:                   # view == 'all' or None
            view = 'all'
            user_id = user.identifier()
            tasks = api.get_all_direct_subtasks(domain_identifier,
                                                root_task=task,
                                                limit=200,
                                                user_identifier=user_id)
        template_values = {
            'domain_name': domain.name,
            'domain_identifier': domain_identifier,
            'user_name': user.name,
            'user_identifier': user.identifier(),
            'tasks': _task_template_values(tasks, user, level=level+1),
            'view_mode': view,
            'show_radio_buttons': show_radio_buttons,
            }
        self.response.out.write(render_template('templates/get-subtasks.html',
                                                template_values))
Beispiel #7
0
    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))
Beispiel #8
0
    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))
Beispiel #9
0
    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)