예제 #1
0
def proccess_delete_category(parsed):
    username = getattr(parsed, 'username', None)
    password = getattr(parsed, 'password', None)
    pid = getattr(parsed, 'project id', None)
    name = getattr(parsed, 'name', None)
    CategoryController.delete_category(username, password, pid, name)
    ct_pres.success_delete()
예제 #2
0
def proccess_edit_desc_category(parsed):
    username = getattr(parsed, 'username', None)
    password = getattr(parsed, 'password', None)
    pid = getattr(parsed, 'project id', None)
    cid = getattr(parsed, 'category id', None)
    desc = getattr(parsed, 'new desc', None)
    CategoryController.edit_desc_by_id(username, password, pid, cid, desc)
    ct_pres.success_edit()
예제 #3
0
def proccess_create_category(parsed):
    username = getattr(parsed, 'username', None)
    password = getattr(parsed, 'password', None)
    pid = getattr(parsed, 'project id', None)
    name = getattr(parsed, 'name', None)
    description = getattr(parsed, 'description', None)
    CategoryController.create_category(username, password, pid, name,
                                       description)
    ct_pres.success_create()
예제 #4
0
 def post(self, request, category_id):
     project = ProjectController.get_project_by_id(
         request.user.username, request.user.password,
         CategoryController.get_category_by_id(category_id).project_id)
     CategoryController.edit_name_by_id(request.user.username,
                                        request.user.password, project.id,
                                        category_id, request.POST['name'])
     CategoryController.edit_desc_by_id(request.user.username,
                                        request.user.password, project.id,
                                        category_id,
                                        request.POST['description'])
     return redirect("tracker:column_info", category_id=category_id)
예제 #5
0
 def post(self, request):
     name = request.POST['name']
     description = request.POST['description']
     project = ProjectController.get_project_by_id(
         request.user.username, request.user.password,
         request.POST['select_project'])
     CategoryController.create_category(username=request.user.username,
                                        password=request.user.password,
                                        project_id=project.id,
                                        name=name,
                                        description=description)
     return redirect('tracker:column_list')
예제 #6
0
 def get(self, request, task_id):
     task = TaskStorage.get_task_by_id(task_id)
     user = UserController.get_user_by_name(request.user.username)
     if task.project_id is not None:
         project = ProjectController.get_project_by_id(
             request.user.username, request.user.password, task.project_id)
         category = CategoryController.get_category_by_id(task.category_id)
         if ProjectController.check_permission(request.user.username,
                                               request.user.password,
                                               project.id):
             return render(request, 'tasks/delete.html', {
                 'project': project,
                 'category': category,
                 'task': task
             })
     elif task.user_id == user.id:
         project = None
         category = None
         return render(request, 'tasks/delete.html', {
             'project': project,
             'category': category,
             'task': task
         })
     else:
         return render(request, '501.html')
예제 #7
0
 def get(self, request):
     username = request.user.username
     password = request.user.password
     projects = ProjectController.show_all(username, password)
     category_list = []
     for project in projects:
         categories = CategoryController.show_all(username, password,
                                                  project)
         category_list = category_list + categories
     return render(request, 'categories/list.html',
                   {'category_list': category_list})
예제 #8
0
 def get(self, request, category_id):
     category = CategoryController.get_category_by_id(category_id)
     project = ProjectController.get_project_by_id(request.user.username,
                                                   request.user.password,
                                                   category.project_id)
     if ProjectController.is_admin(request.user.username, project.id):
         return render(request, 'categories/edit.html', {
             'project': project,
             'category': category
         })
     else:
         return render(request, '501.html')
예제 #9
0
 def get(self, request, **kwargs):
     f = ToDoForm
     projects = ProjectController.show_all(request.user.username,
                                           request.user.password)
     categories_to_send = []
     for project in projects:
         categories = CategoryController.show_all(request.user.username,
                                                  request.user.password,
                                                  project)
         categories_to_send += categories
     return render(request, 'tasks/create.html', {
         'form': f,
         'projects': projects,
         'categories': categories_to_send
     })
예제 #10
0
 def get(self, request, category_id):
     category = CategoryController.get_category_by_id(category_id)
     project = ProjectController.get_project_by_id(request.user.username,
                                                   request.user.password,
                                                   category.project_id)
     tasks = TaskStorage.get_all_tasks(category.id)
     if ProjectController.check_permission(request.user.username,
                                           request.user.password,
                                           project.id):
         return render(request, 'categories/info.html', {
             'project': project,
             'category': category,
             'tasks': tasks
         })
     else:
         return render(request, '501.html')
예제 #11
0
def proccess_show_all_category(parsed):
    username = getattr(parsed, 'username', None)
    password = getattr(parsed, 'password', None)
    pid = getattr(parsed, 'project id', None)
    cats = CategoryController.show_all(username, password, pid)
    ct_pres.show_all(cats)
예제 #12
0
 def get(self, request, task_id):
     task = TaskStorage.get_task_by_id(task_id)
     if task.project_id is not None:
         project = ProjectController.get_project_by_id(
             request.user.username, request.user.password, task.project_id)
         if ProjectController.check_permission(request.user.username,
                                               request.user.password,
                                               project.id):
             category = CategoryController.get_category_by_id(
                 task.category_id)
     else:
         project = None
         category = None
     badge = None
     status_badge = None
     if task.priority == "max":
         badge = "label label-danger"
     elif task.priority == "medium":
         badge = "label label-primary"
     elif task.priority == "min":
         badge = "label label-success"
     status = None
     archive = None
     if task.is_archive == 0:
         status_badge = "label label-danger"
         status = "In progress"
     elif task.is_archive == 1:
         status_badge = "label label-success"
         status = "Done"
         archive = 1
     task_list = TaskStorage.get_all_tasks(task.category_id)
     new_list = []
     for tsk in task_list:
         if tsk.id == task_id:
             task_list.remove(tsk)
     for tsk in task_list:
         if tsk.is_archive == 1 or tsk.assosiated_task_id is not None or tsk.type == 2:
             pass
         else:
             new_list.append(tsk)
     a_task = None
     parent_task = None
     if task.assosiated_task_id is not None:
         a_task = TaskController.get_assosiated_task(
             request.user.username, request.user.password, task)
     if task.parent_task_id is not None:
         parent_task = TaskController.get_parent_task(
             request.user.username, request.user.password, task)
     subtasks = None
     if task.is_parent == 1:
         subtasks = TaskController.get_all_subtask(task)
     return render(
         request, 'tasks/info.html', {
             'project': project,
             'category': category,
             'task': task,
             'badge': badge,
             'status': status,
             'status_badge': status_badge,
             'archive': archive,
             'task_list': new_list,
             'a_task': a_task,
             'parent': parent_task,
             'subtasks': subtasks
         })
예제 #13
0
 def post(self, request, category_id):
     category = CategoryController.get_category_by_id(category_id)
     CategoryController.delete_category(request.user.username,
                                        request.user.password,
                                        category.project_id, category.name)
     return redirect('tracker:column_list')