Skip to content
This repository has been archived by the owner on Mar 2, 2019. It is now read-only.

Commit

Permalink
Made reset excuses optional for users via a setting. Changed language…
Browse files Browse the repository at this point in the history
… to allow purchase of resets as an option. Made option that changes default quota amount.
  • Loading branch information
micolous committed Apr 29, 2011
1 parent 3adbe31 commit 4e823cf
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 28 deletions.
5 changes: 3 additions & 2 deletions frontend/forms.py
Expand Up @@ -44,7 +44,8 @@ class ResetLectureForm(forms.Form):
excuse = forms.CharField(
label=_('Why did you exceed your quota usage?'),
min_length=3,
max_length=256
max_length=256,
required=settings.RESET_EXCUSE_REQUIRED
)

def check_answers(self):
Expand Down Expand Up @@ -97,7 +98,7 @@ class SignInForm3(forms.Form):
label=_('Quota Amount'),
help_text=_('The amount of quota to give to the user, in megabytes.'),
min_value=1,
initial=150L
initial=long(settings.DEFAULT_QUOTA_AMOUNT)
)

quota_unlimited = forms.BooleanField(
Expand Down
5 changes: 4 additions & 1 deletion frontend/models.py
Expand Up @@ -129,12 +129,15 @@ class Meta:
user_profile = ForeignKey(UserProfile)
quota_used = PositiveIntegerField(default=0)
quota_multiplier = PositiveIntegerField(default=1)
quota_amount = PositiveIntegerField(default=100000000)
quota_amount = PositiveIntegerField(default=long(settings.DEFAULT_QUOTA_AMOUNT)*1048576L)
quota_unmetered = BooleanField(default=False)

# ALTER TABLE `tollgate`.`frontend_eventattendance` ADD COLUMN `coffee` TINYINT(1) NOT NULL DEFAULT 0 AFTER `quota_unmetered`;
coffee = BooleanField(default=False)

registered_by = ForeignKey(UserProfile, null=True, blank=True, related_name="registered_by")
registered_on = DateTimeField(auto_now_add=True)

def is_unmetered(self):
return self.quota_unmetered

Expand Down
1 change: 1 addition & 0 deletions frontend/views.py
Expand Up @@ -269,6 +269,7 @@ def host_refresh(request):
# pass
#return HttpResponseRedirect('/')

@login_required
def host_refresh_quick(request):
refresh_networkhost_quick()
return HttpResponseRedirect('/internet/')
Expand Down
7 changes: 7 additions & 0 deletions settings.py
Expand Up @@ -114,6 +114,13 @@
LAN_IFACE = 'eth1'
LOGIN_URL = '/login/'
LOGOUT_URL = '/logout/'
# the default amount of quota
DEFAULT_QUOTA_AMOUNT = 150
# are reset excuses required?
RESET_EXCUSE_REQUIRED = True
# changes some texts to imply that quota resets are purchasable
RESET_PURCHASE = False


ONLY_CONSOLE = False
SOURCE_URL = None
Expand Down
9 changes: 3 additions & 6 deletions templates/frontend/internet_login.html
@@ -1,7 +1,7 @@
{% extends "frontend/base-internet.html" %}
{% comment %}
tollgate login success page
Copyright 2008-2010 Michael Farrell <http://micolous.id.au/>
Copyright 2008-2011 Michael Farrell <http://micolous.id.au/>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
Expand All @@ -21,16 +21,13 @@
{% block title %}internet login success{% endblock %}

{% block content %}
<!-- $Id: internet_login.html 112 2010-11-10 12:42:16Z michael $
-->

<p>{{ u.username }} has been logged in for the MAC address <code>{{ mac }}</code>.</p>

<p>You should be able to access the internet now, if you have quota available.</p>

<p><strong>Warning:</strong> All internet access is metered. You have a limited amount of quota available, please see the <a href="/quota/">quota page</a> to show the current status.</p>
<p><strong>Warning:</strong> All internet access is metered, including uploads and downloads. You have a limited amount of quota available, please see the <a href="/quota/">quota page</a> to show the current status.</p>

<p>Disable programs that are downloading in the background, pause Steam updates, and <strong>shut down peer to peer programs, including Bear Share, Bittorrent, Gnutella, Hamachi, Limewire and Skype</strong>. <strong>Both uploads and downloads are counted</strong>, and the unmetered sites list is <strong>not</strong> the same as what is available on your ISP, <strong>nor the same as the ISP we are using</strong>. Failure to comply with this will result in <em>termination</em> of your internet connectivity after you exceed your quota.</p>
<p>Disable programs that are downloading in the background, pause Steam updates, and <strong>shut down peer to peer programs, such as Bear Share, Bittorrent, Gnutella, Hamachi, Limewire, Skype and World of Warcraft (under some configurations)</strong>. <strong>Both uploads and downloads are counted</strong>, and the unmetered sites list is <strong>not</strong> the same as what is available on your ISP, <strong>nor the same as the ISP we are using</strong>. Failure to comply with this will result in <em>termination</em> of your internet connectivity after you exceed your quota.</p>

<p>Downloads from local file shares on the LAN are unmetered.</p>

Expand Down
12 changes: 10 additions & 2 deletions templates/frontend/quota.html
Expand Up @@ -73,14 +73,22 @@ <h2>Quota Details</h2>
{% endif %}&nbsp;&nbsp;
</td>
{% if could_get_a_reset_later %}
<td>You could get one free reset later. However you have to have used a certain percentage of your quota before this option is available to you. After you have used the reset, no more quota will be available.</td>
<td>You could get one free reset later. However you have to have used a certain percentage of your quota before this option is available to you. After you have used the reset, no more free resets will be available.</td>
{% endif %}

{% if has_free_reset %}
<td>
<a href="/quota/user-reset/">You have one free reset available.</a> No more quota will be available after you have used it.
<a href="/quota/user-reset/">You have one free reset available.</a> No more free resets will be available after you have used it.
</td>
{% endif %}

{% if attendance.reset_count >= 1 %}
{% if settings.RESET_PURCHASE %}
<td>
No more free resets are available. You may purchase additional quota resets from the admins.
</td>
{% endif %}
{% endif %}
</tr>
</table>
</td>
Expand Down
27 changes: 10 additions & 17 deletions templates/frontend/reset-lecture.html
@@ -1,7 +1,7 @@
{% extends "frontend/base.html" %}
{% comment %}
tollgate reset lecture page
Copyright 2008-2010 Michael Farrell <http://micolous.id.au/>
Copyright 2008-2011 Michael Farrell <http://micolous.id.au/>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
Expand All @@ -21,12 +21,11 @@
{% block title %}request usage reset{% endblock %}

{% block content %}
<!-- $Id: reset-lecture.html 110 2010-11-10 12:40:08Z michael $ -->
<p>Just so you know, you're about to use your <strong>only free reset</strong>. After this, there will be no additional resets available, and when you have used your quota you will no longer have internet connectivity for the remainder of the LAN.</p>
<p>Just so you know, you're about to use your <strong>only free reset</strong>. After this, there will be no additional resets available, and when you have used your quota you will {% if settings.RESET_PURCHASE %}need to purchase additional resets to{% else %}no longer{% endif %} have internet connectivity for the remainder of the LAN.</p>

<p>Now is your <strong>only</strong> chance to make sure something isn't siphoning away your internet usage without you knowing, that you haven't logged in to someone else's computer and they're using all your quota, making sure you've disabled automatic updates or redirected them to local sources, and so-forth.</p>
<p>Now is your <strong>only</strong> chance to make sure something isn't siphoning away your internet usage without you knowing, that you haven't logged in to someone else's computer and they're using all your quota, making sure you've disabled automatic updates or redirected them to local sources, disabling any peer-to-peer applications (eg: BitTorrent, Skype, World of Warcraft...), and so-forth.</p>

<p>To make sure you're <strong>really sure you want to do this</strong>, you'll need to enter the text in the image below (remembering to include the punctuation as well), and provide a short reason (less than 250 characters) as to why you exceeded your quota usage this time.</p>
<p>To make sure you're <strong>really sure you want to do this</strong>, you'll need to enter the text in the image below (remembering to include the punctuation as well){% if settings.RESET_EXCUSE_REQUIRED %}, and provide a short reason (less than 250 characters) as to why you exceeded your quota usage this time{% endif %}.</p>

<p>If you believe there are extenuating circumstances as to why you're perhaps using the internet a lot faster than you should be, then <strong>now is the time to approach an admin about it</strong>.</p>

Expand All @@ -41,17 +40,11 @@
</div>
{% endif %}

<form method="post" action="">
<table class="internet">
{{ reset_form.as_table }}
<tr>
<td></td>
<td><input type="submit" value="Submit"/></td>
</tr>
</table>
<form method="post" action=""> {% csrf_token %}
<p>{{ reset_form.q1.label_tag }} {{ reset_form.q1 }}</p>
{% if settings.RESET_EXCUSE_REQUIRED %}
<p>{{ reset_form.excuse.label_tag }} {{ reset_form.excuse }}</p>
{% endif %}
<p><input type="submit" value="Submit"/></p>
</form>




{% endblock %}

0 comments on commit 4e823cf

Please sign in to comment.