[cig-commits] r12493 - in cs/portal/trunk/northridge: . SeismoWebPortal SeismoWebPortal/site SeismoWebPortal/templates/SeismoWebPortal
leif at geodynamics.org
leif at geodynamics.org
Tue Jul 29 17:01:19 PDT 2008
Author: leif
Date: 2008-07-29 17:01:18 -0700 (Tue, 29 Jul 2008)
New Revision: 12493
Added:
cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/cpu_time_request_form.html
cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/project_info.html
Modified:
cs/portal/trunk/northridge/SeismoWebPortal/forms.py
cs/portal/trunk/northridge/SeismoWebPortal/management.py
cs/portal/trunk/northridge/SeismoWebPortal/models.py
cs/portal/trunk/northridge/SeismoWebPortal/site/settings.py
cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/contact_info.html
cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/password_change_form.html
cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/register.html
cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_detail.html
cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/splash.html
cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/style.css
cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/userinfo_form.html
cs/portal/trunk/northridge/SeismoWebPortal/urls.py
cs/portal/trunk/northridge/SeismoWebPortal/views.py
cs/portal/trunk/northridge/setup.py
Log:
Added SU request form. Added more stuff to registration form.
Modified: cs/portal/trunk/northridge/SeismoWebPortal/forms.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/forms.py 2008-07-30 00:00:34 UTC (rev 12492)
+++ cs/portal/trunk/northridge/SeismoWebPortal/forms.py 2008-07-30 00:01:18 UTC (rev 12493)
@@ -260,17 +260,23 @@
class RegistrationManipulator(forms.Manipulator):
def __init__(self):
+ from models import ROLE_CHOICES
+
+ roleChoices = (('', '---------'),) + ROLE_CHOICES
+
self.fields = [
# User
forms.TextField('first_name', maxlength=30, is_required=True),
forms.TextField('last_name', maxlength=30, is_required=True),
forms.EmailField('email', is_required=True, validator_list=[self.isUniqueEmail]),
# UserInfo
+ forms.SelectField(field_name='role', choices=roleChoices, is_required=True),
+ forms.TextField('adviser', maxlength=100),
forms.TextField('institution', maxlength=100, is_required=True),
- forms.TextField('address1', maxlength=100),
- forms.TextField('address2', maxlength=100),
- forms.TextField('address3', maxlength=100),
- forms.PhoneNumberField('phone'),
+ forms.TextField('address1', maxlength=100, is_required=True),
+ forms.TextField('address2', maxlength=100, is_required=True),
+ forms.TextField('address3', maxlength=100, is_required=True),
+ forms.PhoneNumberField('phone', is_required=True),
]
def usernameValidatorList(self):
@@ -287,6 +293,9 @@
forms.TextField('username', maxlength=30, is_required=True, validator_list=self.usernameValidatorList()),
forms.PasswordField('password1', maxlength=128, is_required=True),
forms.PasswordField('password2', maxlength=128, is_required=True, validator_list=[passwordsMatch]),
+ # UserInfo
+ forms.LargeTextField('projectAbstract', is_required=True),
+ forms.IntegerField('requestedSUs', is_required=True),
])
def save(self, new_data, inviteCode):
@@ -317,11 +326,15 @@
user.save()
models.UserInfo.objects.create(
user = user,
+ role = new_data['role'],
+ adviser = new_data['adviser'],
institution = new_data['institution'],
address1 = new_data['address1'],
address2 = new_data['address2'],
address3 = new_data['address3'],
phone = new_data['phone'],
+ projectAbstract = new_data['projectAbstract'],
+ requestedSUs = new_data['requestedSUs'],
invite = invite,
approved = approved,
)
@@ -377,6 +390,8 @@
user.first_name = new_data['first_name']
user.last_name = new_data['last_name']
user.email = new_data['email']
+ userInfo.role = new_data['role']
+ userInfo.adviser = new_data['adviser']
userInfo.institution = new_data['institution']
userInfo.address1 = new_data['address1']
userInfo.address2 = new_data['address2']
Modified: cs/portal/trunk/northridge/SeismoWebPortal/management.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/management.py 2008-07-30 00:00:34 UTC (rev 12492)
+++ cs/portal/trunk/northridge/SeismoWebPortal/management.py 2008-07-30 00:01:18 UTC (rev 12493)
@@ -288,6 +288,9 @@
models.UserInfo.objects.create(
user = user,
institution = "CIG",
+ phone = "(626) 395-1699",
+ role = -1,
+ requestedSUs = 0,
approved = True,
)
return
Modified: cs/portal/trunk/northridge/SeismoWebPortal/models.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/models.py 2008-07-30 00:00:34 UTC (rev 12492)
+++ cs/portal/trunk/northridge/SeismoWebPortal/models.py 2008-07-30 00:01:18 UTC (rev 12493)
@@ -923,14 +923,28 @@
list_display = ('name', 'code', 'expires', 'hasExpired')
+ROLE_CHOICES = (
+ # (-1, 'staff'),
+ # (0, 'unknown'),
+ (1, 'faculty'),
+ (2, 'researcher'),
+ (3, 'graduate student'),
+ (4, 'post-doc'),
+ )
+
class UserInfo(Model):
user = models.OneToOneField(User)
- institution = models.CharField(maxlength=100, core=True)
- address1 = models.CharField(maxlength=100, null=True, blank=True)
- address2 = models.CharField(maxlength=100, null=True, blank=True)
- address3 = models.CharField(maxlength=100, null=True, blank=True)
- phone = models.PhoneNumberField(null=True, blank=True)
+ institution = models.CharField(maxlength=100)
+ address1 = models.CharField(maxlength=100)
+ address2 = models.CharField(maxlength=100)
+ address3 = models.CharField(maxlength=100)
+ phone = models.PhoneNumberField()
+ role = models.IntegerField(choices=ROLE_CHOICES)
+ adviser = models.CharField(maxlength=100, blank=True)
+ projectAbstract = models.TextField()
+ requestedSUs = models.IntegerField()
+
# the invitation used, if any
invite = models.ForeignKey(Invite, null=True, blank=True)
Modified: cs/portal/trunk/northridge/SeismoWebPortal/site/settings.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/site/settings.py 2008-07-30 00:00:34 UTC (rev 12492)
+++ cs/portal/trunk/northridge/SeismoWebPortal/site/settings.py 2008-07-30 00:01:18 UTC (rev 12493)
@@ -9,14 +9,19 @@
ADMINS = (
("Leif", "leif at geodynamics.org"),
)
+ MANAGERS = ADMINS
else:
ADMINS = (
("CIG Portal", "portal at geodynamics.org"),
("Boobunny", "boobunny at nabaztag.com"),
("Leif", "leif at geodynamics.org"),
)
+ MANAGERS = (
+ ("Ariel", "ariel at geodynamics.org"),
+ ("Sue", "sue at geodynamics.org"),
+ ("CIG Portal", "portal at geodynamics.org"),
+ )
-MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
# Environment Example: export WEBPORTAL_DATABASE_NAME='/Users/leif/Projects/WebPortal/SiteDatabase.db' # Or path to database file if using sqlite3.
Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/contact_info.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/contact_info.html 2008-07-30 00:00:34 UTC (rev 12492)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/contact_info.html 2008-07-30 00:01:18 UTC (rev 12493)
@@ -18,6 +18,18 @@
</div>
<div>
+ <label for="id_role" class=before>role</label>
+ {{ form.role }}
+ {% if form.role.errors %}<span class=error>{{ form.role.errors|join:", " }}</span>{% endif %}
+ </div>
+
+ <div>
+ <label for="id_adviser" class=before>if student, name of adviser</label>
+ {{ form.adviser }}
+ {% if form.adviser.errors %}<span class=error>{{ form.adviser.errors|join:", " }}</span>{% endif %}
+ </div>
+
+ <div>
<label for="id_institution" class=before>institution</label>
{{ form.institution }}
{% if form.institution.errors %}<span class=error>{{ form.institution.errors|join:", " }}</span>{% endif %}
@@ -25,24 +37,24 @@
<div>
<label for="id_address1" class=before>address</label>
- {{ form.address1 }} (optional)
+ {{ form.address1 }}
{% if form.address1.errors %}<span class=error>{{ form.address1.errors|join:", " }}</span>{% endif %}
</div>
<div>
<label for="id_address2" class=before>city</label>
- {{ form.address2 }} (optional)
+ {{ form.address2 }}
{% if form.address2.errors %}<span class=error>{{ form.address2.errors|join:", " }}</span>{% endif %}
</div>
<div>
<label for="id_address3" class=before>state & ZIP</label>
- {{ form.address3 }} (optional)
+ {{ form.address3 }}
{% if form.address3.errors %}<span class=error>{{ form.address3.errors|join:", " }}</span>{% endif %}
</div>
<div>
<label for="id_phone" class=before>phone number</label>
- {{ form.phone }} (optional)
+ {{ form.phone }}
{% if form.phone.errors %}<span class=error>{{ form.phone.errors|join:", " }}</span>{% endif %}
</div>
Added: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/cpu_time_request_form.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/cpu_time_request_form.html (rev 0)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/cpu_time_request_form.html 2008-07-30 00:01:18 UTC (rev 12493)
@@ -0,0 +1,44 @@
+
+{% extends "SeismoWebPortal/base.html" %}
+
+{% block content %}
+
+<p><a href="{{root}}/">Home</a> ~ <a href="{{root}}/registration/">Edit Contact Information</a> ~ <a href="{{root}}/registration/password/">Change Password</a> ~ <b>Request CPU Time</b></p>
+
+<h2>Profile → Request CPU Time</h2>
+
+{% if form.has_errors %}
+<p><span class=error>Please correct the following error{{ form.error_dict|pluralize }}.</span>
+{% endif %}
+
+<form method="post" action="{{action}}">
+
+ <div class=tab30ex>
+
+ <div>
+ <label for="id_results" class=before>results</label>
+ <div class=blurb>Enter a 100-word description of your results so far.</div>
+ {{ form.results }}
+ {% if form.results.errors %}<span class=error>{{ form.results.errors|join:", " }}</span>{% endif %}
+ </div>
+
+ <div>
+ <label for="id_requestedSUs" class=before>additional SUs</label>
+ {{ form.requestedSUs }}
+ {% if form.requestedSUs.errors %}<span class=error>{{ form.requestedSUs.errors|join:", " }}</span>{% endif %}
+ </div>
+
+ <div>
+ <label for="id_plans" class=before>plans</label>
+ <div class=blurb>Enter a 100-word description of your additional plans that require an increase in SUs.</div>
+ {{ form.plans }}
+ {% if form.plans.errors %}<span class=error>{{ form.plans.errors|join:", " }}</span>{% endif %}
+ </div>
+
+ <div><input class=submit type="submit" value="Send Request"/></div>
+
+ </div> <!-- tab30ex -->
+
+</form>
+
+{% endblock %}
Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/password_change_form.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/password_change_form.html 2008-07-30 00:00:34 UTC (rev 12492)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/password_change_form.html 2008-07-30 00:01:18 UTC (rev 12493)
@@ -3,7 +3,7 @@
{% block content %}
-<p><a href="{{root}}/">Home</a> ~ <a href="{{root}}/registration/">Edit Contact Information</a></p>
+<p><a href="{{root}}/">Home</a> ~ <a href="{{root}}/registration/">Edit Contact Information</a> ~ <b>Change Password</b> ~ <a href="{{root}}/cpu-time/">Request CPU Time</a></p>
<h2>Profile → Change Password</h2>
Added: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/project_info.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/project_info.html (rev 0)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/project_info.html 2008-07-30 00:01:18 UTC (rev 12493)
@@ -0,0 +1,13 @@
+
+ <div>
+ <label for="id_projectAbstract" class=before>abstract</label>
+ <div class=blurb>Enter a description (approx. 100 words) of research planned and how the portal will support these plans.</div>
+ {{ form.projectAbstract }}
+ {% if form.projectAbstract.errors %}<span class=error>{{ form.projectAbstract.errors|join:", " }}</span>{% endif %}
+ </div>
+
+ <div>
+ <label for="id_requestedSUs" class=before>requested SUs</label>
+ {{ form.requestedSUs }}
+ {% if form.requestedSUs.errors %}<span class=error>{{ form.requestedSUs.errors|join:", " }}</span>{% endif %}
+ </div>
Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/register.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/register.html 2008-07-30 00:00:34 UTC (rev 12492)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/register.html 2008-07-30 00:01:18 UTC (rev 12493)
@@ -45,7 +45,11 @@
{% include "SeismoWebPortal/contact_info.html" %}
</fieldset>
+ <fieldset><legend>project information</legend>
+ {% include "SeismoWebPortal/project_info.html" %}
+ </fieldset>
+
<div><input class=submit type="submit" value="Register"/></div>
</div> <!-- tab30ex -->
Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_detail.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_detail.html 2008-07-30 00:00:34 UTC (rev 12492)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/run_detail.html 2008-07-30 00:01:18 UTC (rev 12493)
@@ -4,7 +4,7 @@
{% ifequal object.status 'draft' %}
{% if user.userinfo.approved %}
{% if object.breaksTheBank %}
-<p class="message">You do not have enough SUs to perform this run. Please <a href="mailto:portal at geodynamics.org">contact us</a> to request more SUs.</p>
+<p class="message">You do not have enough SUs to perform this run. Use <a href="{{root}}/cpu-time/">this form</a> to request more SUs.</p>
{% else %}
<p class="message">This run has not been started. Verify that the parameters below are correct. Then click the "Start" button at the bottom of this page.</p>
{% endif %}
Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/splash.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/splash.html 2008-07-30 00:00:34 UTC (rev 12492)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/splash.html 2008-07-30 00:01:18 UTC (rev 12493)
@@ -7,7 +7,7 @@
<h1><img src="{{root}}/images/cig.gif"> <img src="{{root}}/images/seismogram.gif"><br>CIG Seismology Web Portal</h1>
- <p>Version 3.1.2</p>
+ <p>Version 3.2.0</p>
<hr>
Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/style.css
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/style.css 2008-07-30 00:00:34 UTC (rev 12492)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/style.css 2008-07-30 00:01:18 UTC (rev 12493)
@@ -431,6 +431,21 @@
margin-right: .5ex;
}
+.tab30ex textarea.vLargeTextField {
+ vertical-align: top;
+ font-family: "Lucida Grande", Verdana, Lucida, Helvetica, Arial, sans-serif;
+ border: 1px solid #8cacbb;
+ background: white url({{root}}/images/input_background.gif) repeat-x;
+ margin-left: .5ex;
+ margin-right: .5ex;
+}
+
+.blurb {
+ font-style: italic;
+ float: left;
+ width: 30ex;
+}
+
input {
font-family: "Lucida Grande", Verdana, Lucida, Helvetica, Arial, sans-serif;
border: 1px solid #8cacbb;
Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/userinfo_form.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/userinfo_form.html 2008-07-30 00:00:34 UTC (rev 12492)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/userinfo_form.html 2008-07-30 00:01:18 UTC (rev 12493)
@@ -3,7 +3,7 @@
{% block content %}
-<p><a href="{{root}}/">Home</a> ~ <a href="{{root}}/registration/password/">Change Password</a></p>
+<p><a href="{{root}}/">Home</a> ~ <b>Edit Contact Information</b> ~ <a href="{{root}}/registration/password/">Change Password</a> ~ <a href="{{root}}/cpu-time/">Request CPU Time</a></p>
<h2>Profile → Edit Contact Information</h2>
Modified: cs/portal/trunk/northridge/SeismoWebPortal/urls.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/urls.py 2008-07-30 00:00:34 UTC (rev 12492)
+++ cs/portal/trunk/northridge/SeismoWebPortal/urls.py 2008-07-30 00:01:18 UTC (rev 12493)
@@ -18,6 +18,7 @@
(r'^(?P<pathname>registration/)$', 'SeismoWebPortal.views.registration'),
(r'^(?P<pathname>registration/password/)$', 'SeismoWebPortal.views.password_change', dict(template_name = 'SeismoWebPortal/password_change_form.html')),
(r'^(?P<pathname>registration/)(?P<inviteCode>\w+)/$', 'SeismoWebPortal.views.registration'),
+ (r'^(?P<pathname>cpu-time/)$', 'SeismoWebPortal.views.cpuTime'),
(r'^(?P<pathname>style.css)$', 'SeismoWebPortal.views.directToTemplate', dict(template = 'SeismoWebPortal/style.css', mimetype='text/css')),
Modified: cs/portal/trunk/northridge/SeismoWebPortal/views.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/views.py 2008-07-30 00:00:34 UTC (rev 12492)
+++ cs/portal/trunk/northridge/SeismoWebPortal/views.py 2008-07-30 00:01:18 UTC (rev 12493)
@@ -685,6 +685,8 @@
"first name: " + user.first_name,
"last name: " + user.last_name,
"e-mail: " + user.email,
+ "role: " + userInfo.get_role_display(),
+ "adviser: " + userInfo.adviser,
"institution: " + userInfo.institution,
"address1: " + userInfo.address1,
"address2: " + userInfo.address2,
@@ -692,6 +694,9 @@
"phone: " + userInfo.phone,
"invitation: " + str(invite),
"",
+ "requested SUs: " + str(userInfo.requestedSUs),
+ "project abstract:",
+ userInfo.projectAbstract,
])
message = "\n".join(message)
@@ -701,6 +706,57 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# CPU time
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+def cpuTime(request, pathname):
+ root = rootURL(request, pathname)
+ new_data, errors = {}, {}
+ form = forms.Manipulator()
+ form.fields.extend([
+ forms.LargeTextField('results', is_required=True),
+ forms.IntegerField('requestedSUs', is_required=True),
+ forms.LargeTextField('plans', is_required=True),
+ ])
+ if request.POST:
+ new_data = request.POST.copy()
+ errors = form.get_validation_errors(new_data)
+ if not errors:
+ sendCPUTimeRequest(request, new_data)
+ request.user.message_set.create(message="Your request has been sent.")
+ return HttpResponseRedirect("%s/" % root)
+ return render_to_response("SeismoWebPortal/cpu_time_request_form.html", dict(
+ form = forms.FormWrapper(form, new_data, errors),
+ action = request.path,
+ root = root,
+ ), context_instance=RequestContext(request))
+
+
+def sendCPUTimeRequest(request, new_data):
+ from django.core.mail import mail_managers
+
+ username = request.user.username
+
+ subject = 'SU request from %s' % username
+ message = ["The user %s has requested %s SUs." % (username, new_data['requestedSUs']),
+ ""]
+ message.extend([
+ "results",
+ "-------",
+ new_data['results'],
+ "",
+ "plans",
+ "-----",
+ new_data['plans'],
+ ])
+ message = "\n".join(message)
+
+ mail_managers(subject, message, fail_silently=True)
+
+ return
+
+
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# misc.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Modified: cs/portal/trunk/northridge/setup.py
===================================================================
--- cs/portal/trunk/northridge/setup.py 2008-07-30 00:00:34 UTC (rev 12492)
+++ cs/portal/trunk/northridge/setup.py 2008-07-30 00:01:18 UTC (rev 12493)
@@ -3,7 +3,7 @@
setup(
name = 'SeismoWebPortal',
- version = '3.1.2',
+ version = '3.2.0',
url = 'http://www.geodynamics.org/',
author = 'Leif Strand',
author_email = 'leif at geodynamics.org',
More information about the cig-commits
mailing list