Switch to use Django Permissions for identifying HR permissions, in addition move HR templates

This commit is contained in:
2011-03-07 13:47:30 +00:00
parent 1670eee9eb
commit 1ef7bd9081
20 changed files with 27 additions and 16 deletions

View File

@@ -1,14 +0,0 @@
{% extends "base.html" %}
{% block title %}Accept Application{% endblock %}
{% block content %}
<p>Fill in a note you want to send to the user.</p>
<form action="{% url hr.views.accept_application applicationid %}" method="post">
<table>
{{ form.as_table }}
{% csrf_token %}
</table>
<input type="submit" value="Apply" />
</form>
{% endblock %}

View File

@@ -1,15 +0,0 @@
{% extends "base.html" %}
{% block title %}Create Application{% endblock %}
{% block content %}
<p>Select the character you wish to apply with, then the corporation you wish to apply for.</p>
<form action="{% url hr.views.add_application %}" method="post">
<table>
{{ form.as_table }}
</table>
{% csrf_token %}
<input type="submit" value="Apply" />
</form>
{% endblock %}

View File

@@ -1,13 +0,0 @@
{% extends "base.html" %}
{% block title %}Send Message to Applicant{% endblock %}
{% block content %}
<form action="{% url hr.views.add_message applicationid %}" method="post">
<table>
{{ form.as_table }}
</table>
{% csrf_token %}
<input type="submit" value="Apply" />
</form>
{% endblock %}

View File

@@ -1,13 +0,0 @@
{% extends "base.html" %}
{% block title %}Add Note to Application{% endblock %}
{% block content %}
<form action="{% url hr.views.add_note applicationid %}" method="post">
<table>
{{ form.as_table }}
</table>
{% csrf_token %}
<input type="submit" value="Apply" />
</form>
{% endblock %}

View File

@@ -1,35 +0,0 @@
{% extends "base.html" %}
{% block title %}Applications{% endblock %}
{% block content %}
<h3>Search All Applications</h3>
<form method="GET" action="{% url hr.views.admin_applications %}">
<input type="text" name="q" />
<input type="submit" value="Search" />
</form>
{% if apps %}
<table>
<tr><th><a href="{% url hr.views.admin_applications %}?o=id">Application ID</a></th>
<th><a href="{% url hr.views.admin_applications %}?o=character">Character</a></th>
<th><a href="{% url hr.views.admin_applications %}?o=corporation">Corporation</a></th>
<th>Application Status</th>
<th>Last Action Date</th>
<th>Last Action User</th></tr>
{% for app in apps %}
<tr {% if app.alt_application %}id="alt-application"{% endif %}><td><a href="{% url hr.views.view_application app.id %}">{{ app.id }}</a></td>
<td>{{ app.character }}</td>
<td>{{ app.corporation }}</td>
<td>{{ app.get_status_display }}</td>
<td>{{ app.last_action.date }}</td>
<td>{{ app.last_action.user }}</td>
</tr>
{% endfor %}
</table>
{% else %}
<p>No applications found.</p>
{% endif %}
{% endblock %}

View File

@@ -1,7 +0,0 @@
{% extends "base.html" %}
{% block title %}Create Application{% endblock %}
{% block content %}
<p>Unfortunatly, no Corporations are accepting applications at the moment.</p>
{% endblock %}

View File

@@ -1,14 +0,0 @@
{% extends "base.html" %}
{% block title %}Reject Application{% endblock %}
{% block content %}
<p>Fill in the rejection reason below, please note, this will be sent out to the user.</p>
<form action="{% url hr.views.reject_application applicationid %}" method="post">
<table>
{{ form.as_table }}
</table>
{% csrf_token %}
<input type="submit" value="Apply" />
</form>
{% endblock %}

View File

@@ -1,171 +0,0 @@
{% extends "base.html" %}
{% load humanize %}
{% load if_extra %}
{% load installed %}
{% block title %}View Application{% endblock %}
{% block content %}
<h3>Application Details</h3>
<ul>
<li>Applying Auth User: <a href="{% url sso.views.user_view app.user %}">{{ app.user }}</a></li>
<li>Applying Character: <a href="{% url eve_api.views.eveapi_character app.character.id %}">{{ app.character }}</a></li>
<li>Applying To: <a href="{% url eve_api.views.eveapi_corporation app.corporation.id %}">{{ app.corporation }}</a></li>
<li>Application Status: <b>{{ app.get_status_display }}</b></li>
<li>Blacklist Status: <b>{% if app.blacklisted %}<font color='red'>BLACKLISTED</font>{% else %}<font color='geen'>OK</font>{% endif %}</b></li>
</ul>
{% ifnotequal app.status 5 %}
<h3>Actions</h3>
<div class="skill_controls">
<p>
{% if app.status < 1 %}
<a href="{% url hr.views.update_application app.id 1 %}">Submit Application</a>
{% else %}
<a href="{% url hr.views.update_application app.id 0 %}">Withdraw Application</a>
{% endif %}
<a href="{% url hr.views.add_message app.id %}">Add Message</a>
{% if hrstaff %}
<a href="{% url hr.views.add_note app.id %}">Add Staff Note</a>
{% if app.status < 2 or app.status = 4 or app.status = 6 %}
<a href="{% url hr.views.reject_application app.id %}">Reject Application</a>
{% ifequal app.blacklisted 0 %}
<a href="{% url hr.views.accept_application app.id %}">Accept Application</a>
{% endifequal %}
{% ifnotequal app.status 4 %}
<a href="{% url hr.views.update_application app.id 4 %}">Mark as In Query</a>
{% endifnotequal %}
{% ifnotequal app.status 6 %}
<a href="{% url hr.views.update_application app.id 6 %}">Flag for Review</a>
{% endifnotequal %}
{% endif %}
{% ifequal app.status 3 %}
<a href="{% url hr.views.update_application app.id 5 %}">Mark as Complete</a>
{% endifequal %}
{% endif %}
</p>
</div>
{% endifnotequal %}
{% if audit %}
<h3>Event Log</h3>
<table width="100%">
<tr><th width="50px">Event Type</th><th width="75px">User</th><th width="50px">Date</th><th>Event Details</th></tr>
{% for a in audit %}
<tr><td>{{ a.get_event_display }}</td><td>{{ a.user }}</td><td>{{ a.date|date:"Y/m/d H:i:s" }}</td><td>{{ a.text|linebreaks }}</td></tr>
{% endfor %}
</table>
{% endif %}
{% if app.blacklisted %}
<h3>Blacklist Triggers</h3>
<table>
<tr><th>Blacklist Type</th><th>Blacklisted Value</th><th>Reason</th><th>Source</th></tr>
{% for a in app.blacklist_values %}
<tr><td>{{ a.get_type_display }}</td><td>{{ a.value }}</td><td>{{ a.reason }}</td><td>{{ a.source }}</td></tr>
{% endfor %}
</table>
{% endif %}
{% if app.recommendation_set.all %}
<h3>Recommendations</h3>
<table>
<tr><th>User</th><th>Character</th><th>Corporation</th><th>Valid Recommendation</th><th>Total User Recomendations</th></tr>
{% for rec in app.recommendation_set.all %}
<tr><td><a href="{% url sso.views.user_view rec.user %}">{{ rec.user }}</a></td>
<td><a href="{% url eve_api.views.eveapi_character rec.user_character.id %}">{{ rec.user_character }}</a></td>
<td><a href="http://evemaps.dotlan.net/corp/{{ rec.user_character.corporation.name }}">{{ rec.user_character.corporation }}</a></td>
<td>{% if rec.is_valid %}<font color="green">Yes</font>{% else %}<font color="red">No</font>{% endif %}</td>
<td>{{ rec.user.recommendation_set.all.count }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% if hrstaff %}
<h3>EVE Characters</h3>
<table>
<tr><th>Character</th><th>Corp / Alliance</th><th>ISK</th><th>SP</th><th>Links</th></tr>
{% for acc in app.user.eveaccount_set.all %}
{% for char in acc.characters.all %}
<tr><td><a href="{% url eve_api.views.eveapi_character char.id %}">{{ char.name }}</a></td>
<td><a href="http://evemaps.dotlan.net/corp/{{ char.corporation }}">{{ char.corporation }}</a>{% if char.corporation.alliance %} /
<a href="http://evemaps.dotlan.net/alliance/{{ char.corporation.alliance }}">{{ char.corporation.alliance }}</a>{% endif %}
</td>
<td align="right">{{ char.balance|intcomma }} ISK</td>
<td align="right">{{ char.total_sp|intcomma }} SP</td>
<td>{% if request.is_igb %}<a href="javascript:CCPEVE.showInfo(1377, {{ char.id }})">Show In Eve</a> / {% endif %}<a href="https://gate.eveonline.com/Profile/{{ char.name }}/">EveGate Profile</a> / <a href="http://eve-search.com/search/author/{{ char.name }}">EveSearch</a></td>
</tr>
{% endfor %}
{% endfor %}
</table>
{% if "reddit"|installed %}
{% if app.user.redditaccount_set.all %}
<h3>Reddit Accounts</h3>
<table>
<tr><th>Account</th><th>Karma</th><th>Validated</th><th>Creation Date</th><th>Matches Criteria?</th></tr>
{% for acc in app.user.redditaccount_set.all %}
<tr><td><a href="http://reddit.com/user/{{ acc.username }}/">{{ acc.username }}</a></td>
<td>{{ acc.link_karma }} / {{ acc.comment_karma }}</td>
<td>{% if acc.validated %}Validated{%else %}<b>NOT VALIDATED</b>{% endif %}</td>
<td>{{ acc.date_created }}</td>
<td>{% if acc.is_valid %}<font color="green">Yes</font>{% else %}<font color="red">No</font>{% endif %}</td>
</tr>
{% endfor %}
</table>
<h3>Recent Reddit Posts</h3>
<span id="loadlink">
<a href="javascript:redditposts()">Load recent Reddit posts</a>
</span>
<script type="text/javascript">
function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP");
}else{
ro = new XMLHttpRequest();
}
return ro;
}
var http = createRequestObject();
function redditposts(action) {
http.open('get', '{% url hr.views.view_application app.id %}?redditxhr');
http.onreadystatechange = handleResponse;
http.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
http.send(null);
}
function handleResponse() {
if(http.readyState == 4){
var response = eval('(' + http.responseText + ')');
var update = new Array();
document.getElementById('loadlink').style.display = 'none';
var out = '';
for (var obj in response) {
if (response[obj]['kind'] == 2) {
var out = out + "<p><b><a href=\"http://reddit.com" + response[obj]['permalink'] + "\">" + response[obj]['title'] + "</a></b> - (/r/" + response[obj]['subreddit']+ ")</p>";
} else {
var out = out + "<p>" + response[obj]['body'] + "<br/><b>/r/" + response[obj]['subreddit'] + "</b> <a href=\"" + response[obj]['permalink'] + "\">Permalink</a></p>";
}
}
document.getElementById('redditposts').innerHTML = out;
}
}
</script>
<div id="redditposts">
</div>
{% endif %}
{% endif %}
{% endif %}
{% endblock %}

View File

@@ -1,22 +0,0 @@
{% extends "base.html" %}
{% block title %}Applications{% endblock %}
{% block content %}
<p>This list shows your current open applications</p>
{% if apps %}
<table>
<tr><th>Application ID</th><th>Character</th><th>Corporation</th><th>Application Status</th></tr>
{% for app in apps %}
<tr><td><a href="{% url hr.views.view_application app.id %}">{{ app.id }}</a></td>
<td>{{ app.character }}</td>
<td>{{ app.corporation }}</td>
<td>{{ app.get_status_display }}</td>
</tr>
{% endfor %}
</table>
{% else %}
<p>You have no current applications</p>
{% endif %}
{% endblock %}

View File

@@ -1,13 +0,0 @@
Hi {{ app.character }},
Congratulations, Your application to {{ app.corporation }} has been accepted. You will be accepted into the {{ app.corporation }} within the next 24 hours.
{% if note %}
{{ note }}
{% endif %}
If you have any further questions regarding your application, please contact {{ app.corporation }} via the normal channels.
Regards,
{{ app.corporation }} HR Bot

View File

@@ -1 +0,0 @@
Application to {{ app.corporation }} accepted.

View File

@@ -1,13 +0,0 @@
Hi {{ app.character }},
A message was sent to you regarding your current application to {{ app.corporation }}:
{% if note %}
{{ note }}
{% endif %}
If you have any further questions regarding your application, please contact {{ app.corporation }} via the normal channels.
Regards,
{{ app.corporation }} HR Bot

View File

@@ -1 +0,0 @@
A message regarding your application to {{ app.corporation }}.

View File

@@ -1,15 +0,0 @@
Hi {{ app.character }},
Your application to {{ app.corporation }} has been rejected.
{% if note %}
{{ note }}
{% else %}
One of our Personnel people will contact you in a seperate method to explain why you have been rejected.
{% endif %}
If you have any further questions regarding your application, please contact {{ app.corporation }} via the normal channels.
Regards,
{{ app.corporation }} HR Bot

View File

@@ -1 +0,0 @@
Application to {{ app.corporation }} rejected.

View File

@@ -1,22 +0,0 @@
{% extends "base.html" %}
{% block title %}HR{% endblock %}
{% block content %}
<h3>Applications</h3>
<p><a href="{% url hr.views.view_applications %}">View your current open applications</a><br/>
<a href="{% url hr.views.add_application %}">Create a application</a><br/></p>
<h3>Recommendations</h3>
<p>
<a href="{% url hr.views.view_recommendations %}">View your current open recommendations</a><br/>
<a href="{% url hr.views.add_recommendation %}">Add a recommendation</a><br/>
</p>
{% if hrstaff %}
<h3>HR Admin</h3>
<p>
<a href="{% url hr.views.admin_applications %}">View applications</a><br/>
</p>
{% endif %}
{% endblock %}

View File

@@ -1,17 +0,0 @@
{% extends "base.html" %}
{% block title %}Add Recommendation{% endblock %}
{% block content %}
<p>Select a character you wish to recommend from, then select your friend's current application.
The person you are recommending needs to have created their application before you can add a recommendation.</p>
<form action="{% url hr.views.add_recommendation %}" method="post">
<table>
{{ form.as_table }}
</table>
{% csrf_token %}
<input type="submit" value="Add Recommendation" />
</form>
{% endblock %}

View File

@@ -1,26 +0,0 @@
{% extends "base.html" %}
{% block title %}Recommendations{% endblock %}
{% block content %}
<p>This list shows your current open recommendations that are yet to be submitted, as
soon as the recommended user submits their application your recommendation will be removed from this list.</p>
{% if recs %}
<table>
<thead>
<tr><th>Recommender</th><th>Recommended Application</th><th>Application Status</th></tr>
</thead>
<tbody>
{% for rec in recs %}
<tr><td>{{ rec.user_character }}</td>
<td>{{ rec.application }}</td>
<td>{{ rec.application.get_status_display }}</td>
</tr>
</tbody>
{% endfor %}
</table>
{% else %}
<p>You have no current recommendations</p>
{% endif %}
{% endblock %}