diff options
author | nishanth | 2010-03-03 11:19:42 +0530 |
---|---|---|
committer | nishanth | 2010-03-03 11:19:42 +0530 |
commit | 5784f10c1e2be71e3fcb4690810ef4eb4bd154a6 (patch) | |
tree | 3f21f249b07940b522e0f2299e362a78506489bb | |
parent | 2e905d31b36a5b5cc46962dae2270bfc33c76caf (diff) | |
download | pytask-5784f10c1e2be71e3fcb4690810ef4eb4bd154a6.tar.gz pytask-5784f10c1e2be71e3fcb4690810ef4eb4bd154a6.tar.bz2 pytask-5784f10c1e2be71e3fcb4690810ef4eb4bd154a6.zip |
now requested mentors can see unpublished task but not comment on it.
-rw-r--r-- | taskapp/views/task.py | 4 | ||||
-rw-r--r-- | templates/task/addmentor.html | 4 | ||||
-rw-r--r-- | templates/task/view.html | 263 |
3 files changed, 139 insertions, 132 deletions
diff --git a/taskapp/views/task.py b/taskapp/views/task.py index 195d98e..f9c95ea 100644 --- a/taskapp/views/task.py +++ b/taskapp/views/task.py @@ -82,7 +82,9 @@ def view_task(request, tid): claimed_users = task.claimed_users.all() - context['task_viewable'] = True if ( task.status != "UP" ) or is_mentor else False + task_viewable = True if ( task.status != "UP" ) or is_mentor or user.request_sent_to.filter(is_valid=True,is_replied=False,role="MT",task=task)else False + if not task_viewable: + return show_msg(user, "You are not authorised to view this task", "/task/browse/", "browse the tasks") context['can_publish'] = True if task.status == "UP" and user == task.created_by else False context['can_edit'] = True if task.status == "UP" and is_mentor else False diff --git a/templates/task/addmentor.html b/templates/task/addmentor.html index 1c6c1d4..2db13c9 100644 --- a/templates/task/addmentor.html +++ b/templates/task/addmentor.html @@ -3,9 +3,9 @@ <a href="/task/view/tid={{task.id}}">Click here</a> to return to the task.<br /><br /> Requesting a user to act as a mentor for the task sends him a request. If he accepts the request, he will also be the mentor for this task {% ifequal task.status "UP" %} - and can view/edit<sup><a href="/about/edittask/" target="_blank">learn more</a></sup> the task. But only the creator of a task can publish the task. + and can view/edit<sup><a href="/about/mentor/" target="_blank">learn more</a></sup> the task. But only the creator of a task can publish the task. {% else %} - and will have all the rights<sup><a href="/about/mentorrights/" target="_blank">learn more</a></sup> you posses over the task. + and will have all the rights<sup><a href="/about/mentor/" target="_blank">learn more</a></sup> you posses over the task. {% endifequal %} <br /> <br /> diff --git a/templates/task/view.html b/templates/task/view.html index c95fe13..aef0083 100644 --- a/templates/task/view.html +++ b/templates/task/view.html @@ -3,165 +3,170 @@ {{task.title}} {% endblock %} {% block content %} - {% if task_viewable %} - <h3>{{ task.title }}</h3><br /> + <h3>{{ task.title }}</h3> - {% if can_edit %} - <a href="/task/edit/tid={{task.id}}">Edit task</a> - {% endif %} - - {% if can_publish %} - <a href="/task/publish/tid={{task.id}}">Publish task</a> - {% endif %} - - {% if can_close %} - <a href="/task/close/tid={{task.id}}">Close this task</a> - {% endif %} - - {% if can_delete %} - <a href="/task/delete/tid={{task.id}}">Delete task</a> - {% endif %} + {% if can_edit %} + <a href="/task/edit/tid={{task.id}}">Edit task</a> + {% endif %} + + {% if can_publish %} + <a href="/task/publish/tid={{task.id}}">Publish task</a> + {% endif %} + + {% if can_close %} + <a href="/task/close/tid={{task.id}}">Close this task</a> + {% endif %} + + {% if can_delete %} + <a href="/task/delete/tid={{task.id}}">Delete task</a> + {% endif %} - <hr />created by <a href="/user/view/uid={{ task.created_by.id }}">{{ task.created_by.username }}</a> - on {{task.creation_datetime|date:"D d M Y"}} at {{task.creation_datetime|time:"H:i"}}<br /> - + <hr />created by <a href="/user/view/uid={{ task.created_by.id }}">{{ task.created_by.username }}</a> + on {{task.creation_datetime|date:"D d M Y"}} at {{task.creation_datetime|time:"H:i"}}<br /> + + {% ifequal task.status "UP" %} + Task can be viewed by: + {% else %} + Mentors: + {% endifequal %} + + {% for mentor in mentors %} + <a href="/user/view/uid={{mentor.id}}">{{mentor.username}}</a> + {% endfor %} + + {% if can_mod_mentors %} + <a href="/task/addmentor/tid={{task.id}}"> {% ifequal task.status "UP" %} - Task can be viewed by: + Request others to view/edit the task {% else %} - Mentors: - {% endifequal %} - - {% for mentor in mentors %} - <a href="/user/view/uid={{mentor.id}}">{{mentor.username}}</a> + Add another Mentor to this task + {% endifequal %}</a> + {% endif %} + <br /> + + <hr /> + <b>Description:</b><br /> + {{ task.desc|linebreaksbr }} + <br /><br /><hr /> + {% if task.tags.count %} + Tags: + {% for tag in task.tags %} + {{tag}} {% endfor %} - - {% if can_mod_mentors %} - <a href="/task/addmentor/tid={{task.id}}"> - {% ifequal task.status "UP" %} - Request others to view/edit the task - {% else %} - Add another Mentor to this task - {% endifequal %}</a> - {% endif %} - <br /> - <hr /> - <b>Description:</b><br /> - {{ task.desc|linebreaksbr }} - <br /><br /><hr /> - {% if task.tags.count %} - Tags: - {% for tag in task.tags %} - {{tag}} - {% endfor %} - <hr /> - {% endif %} + {% endif %} - {% if deps %} + {% if deps %} + + <br />The task has following dependencies.<ul> + {% for dep in deps %} + <li><a href="/task/view/tid={{dep.id}}">{{dep.title}}</a></li> + {% endfor %} + </ul> - <br />The task has following dependencies.<ul> - {% for dep in deps %} - <li><a href="/task/view/tid={{dep.id}}">{{dep.title}}</a></li> + {% if can_mod_tasks %} + <a href="/task/addtask/tid={{task.id}}">add more dependencies</a> + <a href="/task/remtask/tid={{task.id}}">remove an existing dependency</a> + {% endif %} + + {% else %} + + {% if subs %} + The task has following sub tasks.<ul> + {% for sub in subs %} + <li><a href="/task/view/tid={{sub.id}}">{{sub.title}}</a></li> {% endfor %} </ul> {% if can_mod_tasks %} - <a href="/task/addtask/tid={{task.id}}">add more dependencies</a> - <a href="/task/remtask/tid={{task.id}}">remove an existing dependency</a> + <a href="/task/addtask/tid={{task.id}}">add more subtasks</a> + <a href="/task/remtask/tid={{task.id}}">remove an existing subtask</a> {% endif %} {% else %} - {% if subs %} - The task has following sub tasks.<ul> - {% for sub in subs %} - <li><a href="/task/view/tid={{sub.id}}">{{sub.title}}</a></li> - {% endfor %} - </ul> - - {% if can_mod_tasks %} - <a href="/task/addtask/tid={{task.id}}">add more subtasks</a> - <a href="/task/remtask/tid={{task.id}}">remove an existing subtask</a> - {% endif %} - - {% else %} - - {% if can_mod_tasks %} - <a href="/task/addtask/tid={{task.id}}">add a subtask/dependency </a> - {% endif %} - + {% if can_mod_tasks %} + <a href="/task/addtask/tid={{task.id}}">add a subtask/dependency </a> {% endif %} - {% endif %} - - {% ifequal task.status "CD" %} - Task has been closed by <a href="/user/view={{closing_notification.sent_from.id}}">{{closing_notification.sent_from.username}}</a> - on {{closing_notification.sent_date|date:"D d M Y"}} at {{closing_notification.sent_date|time:"H:i"}}<br /> - <b>Reason: </b>{{closing_notification.remarks}}<br /> - {% endifequal %} - - {% ifequal task.status "CM" %} - Task has been marked complete by <a href="/user/view={{completed_notification.sent_from.id}}"> - {{completed_notification.sent_from.username}}</a> - on {{completed_notification.sent_date|date:"D d M Y"}} at {{completed_notification.sent_date|time:"H:i"}}<br /> - {% endifequal %} - {% ifequal task.status "OP" %} - <br />There are no users working on this task.<br /> - {% endifequal %} - - {% if subs %} - <br />This task cannot be claimed.. It exists only to show all of its sub tasks in one place.<br /> - {% endif %} - - {% if assigned_users %} - Users working on this task: - {% for user in assigned_users %} - <a href="/user/view/uid={{user.id}}">{{user.username}}</a> - {% endfor %} - {% if is_mentor %} - <a href="/task/remuser/tid={{task.id}}">Remove an existing user</a> - {% endif %} - <br /> - {% endif %} - - {% if can_assign_credits %} - <a href="/task/assigncredits/tid={{task.id}}">View/Assign credits</a> {% endif %} + {% endif %} + + {% ifequal task.status "CD" %} + Task has been closed by <a href="/user/view={{closing_notification.sent_from.id}}">{{closing_notification.sent_from.username}}</a> + on {{closing_notification.sent_date|date:"D d M Y"}} at {{closing_notification.sent_date|time:"H:i"}}<br /> + <b>Reason: </b>{{closing_notification.remarks}}<br /> + {% endifequal %} + + {% ifequal task.status "CM" %} + Task has been marked complete by <a href="/user/view={{completed_notification.sent_from.id}}"> + {{completed_notification.sent_from.username}}</a> + on {{completed_notification.sent_date|date:"D d M Y"}} at {{completed_notification.sent_date|time:"H:i"}}<br /> + {% endifequal %} - {% if task_claimable %} - <a href="/task/claim/tid={{task.id}}"> - {% if is_mentor %} - View claims - {% else %} - Claim the task - {% endif %}</a> - {% endif %} + {% ifequal task.status "OP" %} + <br />There are no users working on this task.<br /> + {% endifequal %} + + {% if subs %} + <br />This task cannot be claimed.. It exists only to show all of its sub tasks in one place.<br /> + {% endif %} - {% if comments %} - <hr /> - comments:<br /><br /> - {% for comment in comments %} - <a href="/user/view/uid={{comment.created_by.id}}">{{ comment.created_by.username }}</a> - on {{ comment.creation_datetime|date:"D d M Y"}} at {{comment.creation_datetime|time:"H:i"}} wrote:<br /> - {{ comment.data|linebreaksbr }}<br /><br /> - {% endfor %} + {% if assigned_users %} + Users working on this task: + {% for user in assigned_users %} + <a href="/user/view/uid={{user.id}}">{{user.username}}</a> + {% endfor %} + {% if is_mentor %} + <a href="/task/remuser/tid={{task.id}}">Remove an existing user</a> {% endif %} + <br /> + {% endif %} + + {% if can_assign_credits %} + <a href="/task/assigncredits/tid={{task.id}}">View/Assign credits</a> + {% endif %} + + {% if task_claimable %} + <a href="/task/claim/tid={{task.id}}"> + {% if is_mentor %} + View claims + {% else %} + Claim the task + {% endif %}</a> + {% endif %} + + {% if comments %} + <hr /> + comments:<br /><br /> + {% for comment in comments %} + <a href="/user/view/uid={{comment.created_by.id}}">{{ comment.created_by.username }}</a> + on {{ comment.creation_datetime|date:"D d M Y"}} at {{comment.creation_datetime|time:"H:i"}} wrote:<br /> + {{ comment.data|linebreaksbr }}<br /><br /> + {% endfor %} + {% endif %} - {% if not is_guest %} + {% if not is_guest %} <hr /> {% if error_msg %} {{error_msg}}<br /> {% endif %} - {% ifnotequal task.status "CM" %} - Add comment:<br /> + {% ifnotequal task.status "UP" %} + Add comment:<br /> + <form action="" method="post"> + <!-- we might even want to use forms here --> + <textarea name="data"></textarea><br /> + <input type="submit" value="Submit"> + </form> + {% else %} + {% if is_mentor %} + Add comment:<br /> <form action="" method="post"> <!-- we might even want to use forms here --> <textarea name="data"></textarea><br /> <input type="submit" value="Submit"> - </form> - {% endifnotequal %} - {% endif %} - {% else %} - You are not authorised to view this task. <a href="/task/browse/">click here</a> to return to browsing the tasks. + </form> + {% endif %} + {% endifnotequal %} {% endif %} {% endblock %} |