virtualcommons-svn Mailing List for Virtual Commons Experiment Software (Page 46)
Status: Beta
Brought to you by:
alllee
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(21) |
Aug
(31) |
Sep
(6) |
Oct
(15) |
Nov
(2) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(4) |
Feb
(6) |
Mar
(12) |
Apr
(52) |
May
(14) |
Jun
(19) |
Jul
(81) |
Aug
(115) |
Sep
(36) |
Oct
(88) |
Nov
(46) |
Dec
(58) |
2010 |
Jan
(52) |
Feb
(55) |
Mar
(48) |
Apr
(15) |
May
(5) |
Jun
(38) |
Jul
(27) |
Aug
(24) |
Sep
(28) |
Oct
(1) |
Nov
(2) |
Dec
(29) |
2011 |
Jan
(87) |
Feb
(39) |
Mar
(63) |
Apr
(42) |
May
(26) |
Jun
(53) |
Jul
(23) |
Aug
(43) |
Sep
(37) |
Oct
(25) |
Nov
(4) |
Dec
(7) |
2012 |
Jan
(73) |
Feb
(79) |
Mar
(62) |
Apr
(28) |
May
(12) |
Jun
(2) |
Jul
(9) |
Aug
(1) |
Sep
(8) |
Oct
|
Nov
(3) |
Dec
(3) |
2013 |
Jan
(8) |
Feb
(16) |
Mar
(38) |
Apr
(74) |
May
(62) |
Jun
(15) |
Jul
(49) |
Aug
(19) |
Sep
(9) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(25) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <vir...@li...> - 2010-08-02 21:55:51
|
Subject: hg.virtualcommons 33 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/02c593012cf3 changeset: 33:02c593012cf3 user: alllee date: Mon Aug 02 11:10:23 2010 -0700 description: updated models and templates TODO: change some TimeFields to DateTimeFields diffstat: vcweb/core/models.py | 23 +++++++++++++++++++---- vcweb/core/templates/base-experimenter.html | 2 +- vcweb/core/templates/experimenter-index.html | 19 +++++++++++++------ vcweb/core/templates/participant-index.html | 10 ++++++---- 4 files changed, 39 insertions(+), 15 deletions(-) diffs (154 lines): diff -r dd396c037594 -r 02c593012cf3 vcweb/core/models.py --- a/vcweb/core/models.py Sun Aug 01 22:57:39 2010 -0700 +++ b/vcweb/core/models.py Mon Aug 02 11:10:23 2010 -0700 @@ -279,7 +279,7 @@ url = models.URLField(null=True, blank=True, verify_exists=True) def __unicode__(self): - return "{0} ({2})".format(self.name, self.description, self.url) + return "{0} ({1})".format(self.name, self.url) class CommonsUser(models.Model): # for docs on related_name see http://docs.djangoproject.com/en/dev/topics/db/models/#be-careful-with-related-name @@ -293,7 +293,7 @@ return self.user.is_authenticated() def __unicode__(self): - return self.user.__unicode__() + return "{0} ({1})".format(self.user.get_full_name(), self.user.username) class Meta: abstract = True @@ -342,8 +342,12 @@ tick_duration = models.CharField(max_length=32) end_time = models.DateTimeField(null=True, blank=True) + @property + def namespace(self): + return self.game_metadata.namespace + def __unicode__(self): - return "instance of {game} created by {experimenter} on {date_created}: {status}".format(game=self.game_metadata, experimenter=self.experimenter, date_created=self.date_created, status=self.status) + return "{game} created by {experimenter} on {date_created}: {status}".format(game=self.game_metadata, experimenter=self.experimenter, date_created=self.date_created, status=self.status) def ___eq___(self, other): return self.id == other.id @@ -372,6 +376,9 @@ name = models.CharField(max_length=255) type = models.CharField(max_length=32, choices=PARAMETER_TYPES) + def __unicode__(self): + return "{0} ({1})".format(self.name, self.type) + class Meta: abstract = True ordering = ['name'] @@ -397,7 +404,7 @@ def __unicode__(self): - return 'Data Parameter - [name: ' + self.name + '] [type: ' + self.type + ']' + return "Name: {0} - Type: {1}".format(self.name, self.type) # class Meta: # db_table = 'vcweb_data_parameter' @@ -408,6 +415,9 @@ parameter = models.ForeignKey(ConfigurationParameter) parameter_value = models.CharField(max_length=255) + def __unicode__(self): + return "{0} -- Parameter: {1} Value: {2}".format(self.round_configuration, self.parameter, self.parameter_value) + class Group(models.Model): number = models.PositiveIntegerField() max_size = models.PositiveIntegerField() @@ -423,6 +433,9 @@ group = models.ForeignKey(Group) round = models.ForeignKey(RoundConfiguration) + def __unicode__(self): + return "Round Data for {0} in {1}".format(self.group, self.round) + # class Meta: # db_table = 'vcweb_group_round_data' @@ -436,6 +449,8 @@ def find(incoming_parameter, incoming_game_instance): DataValue.objects.filter(parameter=incoming_parameter, game_instance=incoming_game_instance) + def __unicode__(self): + return "Data value: parameter {0}, value {1}, time recorded {2}, game {3}".format(self.parameter, self.parameter_value, self.time_recorded, self.game_instance) class Meta: abstract = True diff -r dd396c037594 -r 02c593012cf3 vcweb/core/templates/base-experimenter.html --- a/vcweb/core/templates/base-experimenter.html Sun Aug 01 22:57:39 2010 -0700 +++ b/vcweb/core/templates/base-experimenter.html Mon Aug 02 11:10:23 2010 -0700 @@ -3,7 +3,7 @@ {% block title %} Virtual Commons Web Experimenter Interface {% endblock %} {% block content %} -<div id="page_content"> +<div id="post"> <p> This is the base for the experimenter interface. </p> diff -r dd396c037594 -r 02c593012cf3 vcweb/core/templates/experimenter-index.html --- a/vcweb/core/templates/experimenter-index.html Sun Aug 01 22:57:39 2010 -0700 +++ b/vcweb/core/templates/experimenter-index.html Mon Aug 02 11:10:23 2010 -0700 @@ -7,18 +7,25 @@ {% endblock header %} {% block content %} -<div id="page_content"> -<p> -This is the base for the experimenter interface. -</p> +<div class='notice'> +Welcome to the experimenter interface. You are logged in as {{experimenter}}. +</div> +<div id="post"> <fieldset> -<legend>Your games</legend> +<legend>Your experiments</legend> +<div class='sidebar'> <ul> {% for game in games %} -<li>{{ game }}</li> +<li> +<a href='/experimenter/{{game.namespace}}/manage/{{game.id}}'> +{{ game }} +</a> + +</li> {% endfor %} </ul> +</div> </fieldset> </div> diff -r dd396c037594 -r 02c593012cf3 vcweb/core/templates/participant-index.html --- a/vcweb/core/templates/participant-index.html Sun Aug 01 22:57:39 2010 -0700 +++ b/vcweb/core/templates/participant-index.html Mon Aug 02 11:10:23 2010 -0700 @@ -7,14 +7,16 @@ {% endblock %} {% block content %} -<h2>Welcome back, {{ user }}</h2> +<div class='notice'> +Welcome back, {{participant}}. Games you are participating in are listed below. +</div> <fieldset> -<legend>Your games</legend> +<legend>Your experiments</legend> <ul> {% for game in games %} -<li>{{ game }}</li> - +<li> +<a href='/participate/{{game.namespace}}/{{game.id}}'>{{ game }}</a></li> {% endfor %} </ul> </fieldset> |
From: <vir...@li...> - 2010-08-02 05:56:49
|
Subject: hg.virtualcommons 32 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/dd396c037594 changeset: 32:dd396c037594 user: alllee date: Sun Aug 01 22:57:39 2010 -0700 description: added logout diffstat: vcweb/core/urls.py | 1 + vcweb/core/views.py | 4 ++++ 2 files changed, 5 insertions(+), 0 deletions(-) diffs (25 lines): diff -r 8be0fe1ce5c8 -r dd396c037594 vcweb/core/urls.py --- a/vcweb/core/urls.py Sun Aug 01 22:31:06 2010 -0700 +++ b/vcweb/core/urls.py Sun Aug 01 22:57:39 2010 -0700 @@ -6,6 +6,7 @@ ''' urlpatterns = patterns('vcweb.core.views', url(r'accounts/login/$', 'login', name='login'), + url(r'accounts/logout/$', 'logout', name='logout'), url(r'accounts/register/$', 'register', name='register'), url(r'accounts/profile/$', 'account_profile', name='profile'), url(r'experimenter/$', 'experimenter_index', name='experimenter-index'), diff -r 8be0fe1ce5c8 -r dd396c037594 vcweb/core/views.py --- a/vcweb/core/views.py Sun Aug 01 22:31:06 2010 -0700 +++ b/vcweb/core/views.py Sun Aug 01 22:57:39 2010 -0700 @@ -30,6 +30,10 @@ form = LoginForm() return render_to_response('registration/login.html', locals(), context_instance=RequestContext(request)) +def logout(request): + auth.logout(request) + return redirect('home') + def register(request): if request.method == 'POST': form = RegistrationForm(request.POST) |
From: <vir...@li...> - 2010-08-02 05:30:19
|
Subject: hg.virtualcommons 31 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/8be0fe1ce5c8 changeset: 31:8be0fe1ce5c8 user: alllee date: Sun Aug 01 22:31:06 2010 -0700 description: updated nav menus for experimenters and participants. diffstat: vcweb/core/templates/base-experimenter.html | 16 ---------------- vcweb/core/templates/base-participant.html | 15 --------------- vcweb/core/templates/experimenter-index.html | 11 ++++++++++- vcweb/core/templates/includes/experimenter-nav-menu.inc | 15 +++++++++++++++ vcweb/core/templates/includes/participant-nav-menu.inc | 15 +++++++++++++++ vcweb/core/urls.py | 4 ++-- vcweb/core/views.py | 10 ++++++++-- 7 files changed, 50 insertions(+), 36 deletions(-) diffs (159 lines): diff -r e234fbde8e51 -r 8be0fe1ce5c8 vcweb/core/templates/base-experimenter.html --- a/vcweb/core/templates/base-experimenter.html Sun Aug 01 22:21:57 2010 -0700 +++ b/vcweb/core/templates/base-experimenter.html Sun Aug 01 22:31:06 2010 -0700 @@ -2,22 +2,6 @@ {% block title %} Virtual Commons Web Experimenter Interface {% endblock %} -{% block header %} - -<div id='menu'> - <ul> - <li class='current_page_item'><a href='/' class='first'>Home</a></li> - <!-- if not logged in, otherwise present logout url.. --> - <li>{% url login %}</li> - <li><a href='login'>Participate</a></li> - <li><a href='analyze'>analyze</a></li> - - <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> - </ul> -</div> - -{% endblock header %} - {% block content %} <div id="page_content"> <p> diff -r e234fbde8e51 -r 8be0fe1ce5c8 vcweb/core/templates/base-participant.html --- a/vcweb/core/templates/base-participant.html Sun Aug 01 22:21:57 2010 -0700 +++ b/vcweb/core/templates/base-participant.html Sun Aug 01 22:31:06 2010 -0700 @@ -2,21 +2,6 @@ {% block title %}Virtual Commons Web Participant Interface{% endblock %} -{% block header %} -<div id="masthead"> -<table width="100%" - style="background-color: #9ACD32; background-repeat: no-repeat;" - border="0"> - <tr> - <th align="left" valign="top" style="background-color: #9ACD32;"> - <img height="35" alt="imageTree" src="/static/images/Logo3.png/" /></th> - <th align="right" valign="bottom"><b style="color:purple; margin-right:10px;">{{username}}</b></th> - </tr> -</table> -</div> - -{% endblock header %} - {% block content %} <div id="page_content"> <p> diff -r e234fbde8e51 -r 8be0fe1ce5c8 vcweb/core/templates/experimenter-index.html --- a/vcweb/core/templates/experimenter-index.html Sun Aug 01 22:21:57 2010 -0700 +++ b/vcweb/core/templates/experimenter-index.html Sun Aug 01 22:31:06 2010 -0700 @@ -3,7 +3,7 @@ {% block title %} Virtual Commons Web Experimenter Interface {% endblock %} {% block header %} - +{% include "includes/experimenter-nav-menu.inc" %} {% endblock header %} {% block content %} @@ -11,6 +11,15 @@ <p> This is the base for the experimenter interface. </p> +<fieldset> +<legend>Your games</legend> +<ul> +{% for game in games %} +<li>{{ game }}</li> + +{% endfor %} +</ul> +</fieldset> </div> {% endblock content %} diff -r e234fbde8e51 -r 8be0fe1ce5c8 vcweb/core/templates/includes/experimenter-nav-menu.inc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/includes/experimenter-nav-menu.inc Sun Aug 01 22:31:06 2010 -0700 @@ -0,0 +1,15 @@ +{% load tags %} + +{% url home as home %} +{% url core:experimenter-index as experiments %} +{% url core:login as login %} +{% url core:logout as logout %} +{% url core:profile as profile %} + +<div id='menu'> +<ul> + <li class='{% active request profile %}'><a href='{{ profile }}'>Your account</a> + <li class='{% active request experiments %}'><a href='{{ experiments }}'>Your experiments</a></li> + <li><a href='{{ logout }}'>Logout</a></li> +</ul> +</div> \ No newline at end of file diff -r e234fbde8e51 -r 8be0fe1ce5c8 vcweb/core/templates/includes/participant-nav-menu.inc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/includes/participant-nav-menu.inc Sun Aug 01 22:31:06 2010 -0700 @@ -0,0 +1,15 @@ +{% load tags %} + +{% url home as home %} +{% url core:participant-index as games %} +{% url core:login as login %} +{% url core:logout as logout %} +{% url core:profile as profile %} + +<div id='menu'> +<ul> + <li class='{% active request games %}'><a href='{{ games }}'>Your games</a></li> + <li class='{% active request profile %}'><a href='{{ profile }}'>Your account</a> + <li><a href='{{ logout }}'>Logout</a></li> +</ul> +</div> \ No newline at end of file diff -r e234fbde8e51 -r 8be0fe1ce5c8 vcweb/core/urls.py --- a/vcweb/core/urls.py Sun Aug 01 22:21:57 2010 -0700 +++ b/vcweb/core/urls.py Sun Aug 01 22:31:06 2010 -0700 @@ -8,7 +8,7 @@ url(r'accounts/login/$', 'login', name='login'), url(r'accounts/register/$', 'register', name='register'), url(r'accounts/profile/$', 'account_profile', name='profile'), - url(r'list/$', 'experimenter_index', name='experimenter_index'), - url(r'participate/$', 'participant_index', name='participant-index'), + url(r'experimenter/$', 'experimenter_index', name='experimenter-index'), + url(r'participant/$', 'participant_index', name='participant-index'), url(r'experimenter/configure/(?P<game_instance_id>\d+)$', 'configure', name='configure-experiment'), ) diff -r e234fbde8e51 -r 8be0fe1ce5c8 vcweb/core/views.py --- a/vcweb/core/views.py Sun Aug 01 22:21:57 2010 -0700 +++ b/vcweb/core/views.py Sun Aug 01 22:31:06 2010 -0700 @@ -5,7 +5,7 @@ from django.shortcuts import render_to_response, redirect from django.template.context import RequestContext from vcweb.core.forms import RegistrationForm, LoginForm -from vcweb.core.models import Participant +from vcweb.core.models import Participant, GameInstance, Experimenter import logging logger = logging.getLogger("core-views") @@ -44,7 +44,13 @@ @login_required def experimenter_index(request): - return render_to_response('experimenter-index.html', RequestContext(request)) + user = request.user + try: + experimenter = user.experimenter + games = GameInstance.objects.filter(experimenter=experimenter) + return render_to_response('experimenter-index.html', RequestContext(request, locals())) + except Experimenter.DoesNotExist: + return redirect('home') @login_required def participant_index(request): |
From: <vir...@li...> - 2010-08-02 05:21:12
|
Subject: hg.virtualcommons 30 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/e234fbde8e51 changeset: 30:e234fbde8e51 user: alllee date: Sun Aug 01 22:21:57 2010 -0700 description: turning participant<->group relationship to a many-to-many diffstat: vcweb/core/admin.py | 2 +- vcweb/core/models.py | 26 +++++++++++++++- vcweb/core/templates/participant-index.html | 31 ++++++++----------- vcweb/core/urls.py | 4 +- vcweb/core/views.py | 44 ++++++++++++++-------------- 5 files changed, 62 insertions(+), 45 deletions(-) diffs (165 lines): diff -r ed59cf11bf96 -r e234fbde8e51 vcweb/core/admin.py --- a/vcweb/core/admin.py Sun Aug 01 20:44:05 2010 -0700 +++ b/vcweb/core/admin.py Sun Aug 01 22:21:57 2010 -0700 @@ -16,4 +16,4 @@ admin.site.register(Participant) admin.site.register(Group) admin.site.register(GameInstance) - +admin.site.register(ParticipantGroup) diff -r ed59cf11bf96 -r e234fbde8e51 vcweb/core/models.py --- a/vcweb/core/models.py Sun Aug 01 20:44:05 2010 -0700 +++ b/vcweb/core/models.py Sun Aug 01 22:21:57 2010 -0700 @@ -445,12 +445,34 @@ class Meta: ordering = [ 'parameter' ] +class ParticipantManager(models.Manager): + def get_all_game_instances(self, participant_id): + # generate appropriate query using Groups? + # link from groups to game instances + participant_groups = ParticipantGroup.objects.filter(participant__id=participant_id) + + return GameInstance.objects.filter(pk__in=[]) + class Participant(CommonsUser): - number = models.PositiveIntegerField() can_receive_invitations = models.BooleanField(default=False) + group = models.ManyToManyField(Group, through='ParticipantGroup', related_name='groups') + objects = ParticipantManager() + class Meta: + ordering = ['user'] + + +class ParticipantGroup(models.Model): + participant_number = models.PositiveIntegerField() + participant = models.ForeignKey(Participant) group = models.ForeignKey(Group) + round_joined = models.ForeignKey(RoundConfiguration) + date_joined = models.DateTimeField(auto_now_add=True) + + def __unicode__(self): + return "{0}: {1} (in {2})".format(self.participant, self.participant_number, self.group) + class Meta: - ordering = ['number', 'user'] + ordering = ['participant_number', 'participant'] class ParticipantData(models.Model): participant = models.ForeignKey(Participant) diff -r ed59cf11bf96 -r e234fbde8e51 vcweb/core/templates/participant-index.html --- a/vcweb/core/templates/participant-index.html Sun Aug 01 20:44:05 2010 -0700 +++ b/vcweb/core/templates/participant-index.html Sun Aug 01 22:21:57 2010 -0700 @@ -3,24 +3,19 @@ {% block title %}Virtual Commons Web Participant Interface{% endblock %} {% block header %} -<div id="masthead"> -<table width="100%" - style="background-color: #9ACD32; background-repeat: no-repeat;" - border="0"> - <tr> - <th align="left" valign="top" style="background-color: #9ACD32;"> - <img height="35" alt="imageTree" src="/static/images/Logo3.png/" /></th> - <th align="right" valign="bottom"><b style="color:purple; margin-right:10px;">{{username}}</b></th> - </tr> -</table> -</div> +{% include "includes/participant-nav-menu.inc" %} -{% endblock header %} +{% endblock %} +{% block content %} +<h2>Welcome back, {{ user }}</h2> -{% block content %} -<div id="page_content"> -<p> -The base participant interface, will be customized for each experiment. -</p> -</div> +<fieldset> +<legend>Your games</legend> +<ul> +{% for game in games %} +<li>{{ game }}</li> + +{% endfor %} +</ul> +</fieldset> {% endblock content %} diff -r ed59cf11bf96 -r e234fbde8e51 vcweb/core/urls.py --- a/vcweb/core/urls.py Sun Aug 01 20:44:05 2010 -0700 +++ b/vcweb/core/urls.py Sun Aug 01 22:21:57 2010 -0700 @@ -7,8 +7,8 @@ urlpatterns = patterns('vcweb.core.views', url(r'accounts/login/$', 'login', name='login'), url(r'accounts/register/$', 'register', name='register'), - - url(r'list/$', 'experimenter_index', name='experimenter-index'), + url(r'accounts/profile/$', 'account_profile', name='profile'), + url(r'list/$', 'experimenter_index', name='experimenter_index'), url(r'participate/$', 'participant_index', name='participant-index'), url(r'experimenter/configure/(?P<game_instance_id>\d+)$', 'configure', name='configure-experiment'), ) diff -r ed59cf11bf96 -r e234fbde8e51 vcweb/core/views.py --- a/vcweb/core/views.py Sun Aug 01 20:44:05 2010 -0700 +++ b/vcweb/core/views.py Sun Aug 01 22:21:57 2010 -0700 @@ -1,15 +1,11 @@ # Create your views here. -from django.conf import settings + from django.contrib import auth -from django.contrib.auth.decorators import * -from django.contrib.auth.models import User -from django.http import HttpResponse +from django.contrib.auth.decorators import login_required from django.shortcuts import render_to_response, redirect -from django.template import Context, loader from django.template.context import RequestContext from vcweb.core.forms import RegistrationForm, LoginForm -from vcweb.core.models import Experimenter - +from vcweb.core.models import Participant import logging logger = logging.getLogger("core-views") @@ -50,19 +46,23 @@ def experimenter_index(request): return render_to_response('experimenter-index.html', RequestContext(request)) +@login_required +def participant_index(request): + user = request.user + try: + participant = user.participant + games = [ group.game_instance for group in participant.group.all() ] + return render_to_response('participant-index.html', RequestContext(request, locals())) + except Participant.DoesNotExist: + # what to do? + return redirect('home') + +@login_required +def account_profile(request): + return redirect('home') + + +@login_required def configure(request, game_instance_id): -# lookup game instance id (or create a new one?) - t = loader.get_template('base_participant.html') - c = RequestContext(request, { - 'main': "configuration of the experiment!", - 'username':"foo", - - }) - return HttpResponse(t.render(c)) - -def participant_index(request): - # FIXME: check if logged in - t = loader.get_template('participant-index.html') - c = RequestContext(request) - return HttpResponse(t.render(c)) - + # lookup game instance id (or create a new one?) + return render_to_response('configure.html', RequestContext(request)) |
From: <vir...@li...> - 2010-08-02 03:44:00
|
Subject: hg.virtualcommons 29 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/ed59cf11bf96 changeset: 29:ed59cf11bf96 user: alllee date: Sun Aug 01 20:44:05 2010 -0700 description: still mucking about with registration. Going to slurp django-registration module into our own app so we can incorporate email activation more directly. diffstat: vcweb/core/auth.py | 1 + vcweb/core/fixtures/initial_data.json | 14 + vcweb/core/forms.py | 3 + vcweb/core/models.py | 314 +++++++++- vcweb/core/templates/includes/nav-menu.inc | 6 +- vcweb/core/templates/index.html | 2 +- vcweb/core/templates/registration/login.html | 2 +- vcweb/core/templates/registration/register.html | 24 +- vcweb/core/templates/registration/registration_complete.html | 26 + vcweb/core/urls.py | 5 +- vcweb/core/views.py | 3 +- vcweb/forestry/urls.py | 6 +- vcweb/settings.py | 6 +- vcweb/urls.py | 14 +- 14 files changed, 376 insertions(+), 50 deletions(-) diffs (670 lines): diff -r 06dcd9bae8a9 -r ed59cf11bf96 vcweb/core/auth.py --- a/vcweb/core/auth.py Thu Jul 29 22:51:41 2010 -0700 +++ b/vcweb/core/auth.py Sun Aug 01 20:44:05 2010 -0700 @@ -25,6 +25,7 @@ # FIXME: check for Participant game codes. if user.check_password(password): return user + # password may be game code. check it against participant's game game codes. except User.DoesNotExist: return None return None diff -r 06dcd9bae8a9 -r ed59cf11bf96 vcweb/core/fixtures/initial_data.json --- a/vcweb/core/fixtures/initial_data.json Thu Jul 29 22:51:41 2010 -0700 +++ b/vcweb/core/fixtures/initial_data.json Sun Aug 01 20:44:05 2010 -0700 @@ -1,6 +1,20 @@ [ { "pk": 1, + "model": "core.gamemetadata", + "fields": { + "description": "Web-based version of the forestry field experiments.", + "title": "Forestry Web Experiment", + "namespace": "forestry", + "last_modified": "2010-08-01", + "date_created": "2010-08-01", + "logo_url": "", + "about_url": "http://commons.asu.edu", + "default_game_configuration": null + } + }, + { + "pk": 1, "model": "core.institution", "fields": { "url": "http://www.asu.edu", diff -r 06dcd9bae8a9 -r ed59cf11bf96 vcweb/core/forms.py --- a/vcweb/core/forms.py Thu Jul 29 22:51:41 2010 -0700 +++ b/vcweb/core/forms.py Sun Aug 01 20:44:05 2010 -0700 @@ -4,6 +4,9 @@ @author: alllee ''' from django import forms +from django.contrib import admin +from django.contrib.auth.admin import UserAdmin +from django.contrib.auth.models import User from django.forms import widgets #from django.forms import ModelForm diff -r 06dcd9bae8a9 -r ed59cf11bf96 vcweb/core/models.py --- a/vcweb/core/models.py Thu Jul 29 22:51:41 2010 -0700 +++ b/vcweb/core/models.py Sun Aug 01 20:44:05 2010 -0700 @@ -1,24 +1,271 @@ -from django.contrib.auth.models import User, UserManager +from django.contrib.auth.models import User from django.core.validators import RegexValidator -from django.db import models +from django.db import models, transaction +from django.template.loader import render_to_string +from vcweb import settings +import datetime +import hashlib +import logging +import random +import re +from django.utils.translation import ugettext_lazy as _ -import logging +SHA1_RE = re.compile('^[a-f0-9]{40}$') logger = logging.getLogger('vcweb.core.models') -# FIXME: split this into multiple modules or have one monolithic models file? Seems -# like the standard is to have a single models.py per app +# FIXME: separate accounts / registration / experimenter / participant app from the core app + +# registration manager included / forked from http://bitbucket.org/ubernostrum/django-registration/ +class RegistrationManager(models.Manager): + """ + Custom manager for the ``RegistrationProfile`` model. + + The methods defined here provide shortcuts for account creation + and activation (including generation and emailing of activation + keys), and for cleaning out expired inactive accounts. + + """ + def activate_user(self, activation_key): + """ + Validate an activation key and activate the corresponding + ``User`` if valid. + + If the key is valid and has not expired, return the ``User`` + after activating. + + If the key is not valid or has expired, return ``False``. + + If the key is valid but the ``User`` is already active, + return ``False``. + + To prevent reactivation of an account which has been + deactivated by site administrators, the activation key is + reset to the string constant ``RegistrationProfile.ACTIVATED`` + after successful activation. + + """ + # Make sure the key we're trying conforms to the pattern of a + # SHA1 hash; if it doesn't, no point trying to look it up in + # the database. + if SHA1_RE.search(activation_key): + try: + profile = self.get(activation_key=activation_key) + except self.model.DoesNotExist: + return False + if not profile.activation_key_expired(): + user = profile.user + user.is_active = True + user.save() + profile.activation_key = self.model.ACTIVATED + profile.save() + return user + return False + + def create_inactive_user(self, username, email, password, + site, send_email=True): + """ + Create a new, inactive ``User``, generate a + ``RegistrationProfile`` and email its activation key to the + ``User``, returning the new ``User``. + + By default, an activation email will be sent to the new + user. To disable this, pass ``send_email=False``. + + """ + new_user = User.objects.create_user(username, email, password) + new_user.is_active = False + new_user.save() + + registration_profile = self.create_profile(new_user) + + if send_email: + registration_profile.send_activation_email(site) + + return new_user + create_inactive_user = transaction.commit_on_success(create_inactive_user) + + def create_profile(self, user): + """ + Create a ``RegistrationProfile`` for a given + ``User``, and return the ``RegistrationProfile``. + + The activation key for the ``RegistrationProfile`` will be a + SHA1 hash, generated from a combination of the ``User``'s + username and a random salt. + + """ + + salt = hashlib.sha1(str(random.random())).hexdigest()[:5] + activation_key = hashlib.sha1(salt + user.username).hexdigest() + return self.create(user=user, + activation_key=activation_key) + + def delete_expired_users(self): + """ + Remove expired instances of ``RegistrationProfile`` and their + associated ``User``s. + + Accounts to be deleted are identified by searching for + instances of ``RegistrationProfile`` with expired activation + keys, and then checking to see if their associated ``User`` + instances have the field ``is_active`` set to ``False``; any + ``User`` who is both inactive and has an expired activation + key will be deleted. + + It is recommended that this method be executed regularly as + part of your routine site maintenance; this application + provides a custom management command which will call this + method, accessible as ``manage.py cleanupregistration``. + + Regularly clearing out accounts which have never been + activated serves two useful purposes: + + 1. It alleviates the ocasional need to reset a + ``RegistrationProfile`` and/or re-send an activation email + when a user does not receive or does not act upon the + initial activation email; since the account will be + deleted, the user will be able to simply re-register and + receive a new activation key. + + 2. It prevents the possibility of a malicious user registering + one or more accounts and never activating them (thus + denying the use of those usernames to anyone else); since + those accounts will be deleted, the usernames will become + available for use again. + + If you have a troublesome ``User`` and wish to disable their + account while keeping it in the database, simply delete the + associated ``RegistrationProfile``; an inactive ``User`` which + does not have an associated ``RegistrationProfile`` will not + be deleted. + + """ + for profile in self.all(): + if profile.activation_key_expired(): + user = profile.user + if not user.is_active: + user.delete() + + +class RegistrationProfile(models.Model): + """ + A simple profile which stores an activation key for use during + user account registration. + + Generally, you will not want to interact directly with instances + of this model; the provided manager includes methods + for creating and activating new accounts, as well as for cleaning + out accounts which have never been activated. + + While it is possible to use this model as the value of the + ``AUTH_PROFILE_MODULE`` setting, it's not recommended that you do + so. This model's sole purpose is to store data temporarily during + account registration and activation. + + """ + ACTIVATED = u"ALREADY_ACTIVATED" + + user = models.ForeignKey(User, unique=True, verbose_name=_('user')) + activation_key = models.CharField(_('activation key'), max_length=40) + + objects = RegistrationManager() + + class Meta: + verbose_name = _('registration profile') + verbose_name_plural = _('registration profiles') + + def __unicode__(self): + return u"Registration information for %s" % self.user + + def activation_key_expired(self): + """ + Determine whether this ``RegistrationProfile``'s activation + key has expired, returning a boolean -- ``True`` if the key + has expired. + + Key expiration is determined by a two-step process: + + 1. If the user has already activated, the key will have been + reset to the string constant ``ACTIVATED``. Re-activating + is not permitted, and so this method returns ``True`` in + this case. + + 2. Otherwise, the date the user signed up is incremented by + the number of days specified in the setting + ``ACCOUNT_ACTIVATION_DAYS`` (which should be the number of + days after signup during which a user is allowed to + activate their account); if the result is less than or + equal to the current date, the key has expired and this + method returns ``True``. + + """ + expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS) + return self.activation_key == self.ACTIVATED or \ + (self.user.date_joined + expiration_date <= datetime.datetime.now()) + activation_key_expired.boolean = True + + def send_activation_email(self, site): + """ + Send an activation email to the user associated with this + ``RegistrationProfile``. + + The activation email will make use of two templates: + + ``registration/activation_email_subject.txt`` + This template will be used for the subject line of the + email. Because it is used as the subject line of an email, + this template's output **must** be only a single line of + text; output longer than one line will be forcibly joined + into only a single line. + + ``registration/activation_email.txt`` + This template will be used for the body of the email. + + These templates will each receive the following context + variables: + + ``activation_key`` + The activation key for the new account. + + ``expiration_days`` + The number of days remaining during which the account may + be activated. + + ``site`` + An object representing the site on which the user + registered; depending on whether ``django.contrib.sites`` + is installed, this may be an instance of either + ``django.contrib.sites.models.Site`` (if the sites + application is installed) or + ``django.contrib.sites.models.RequestSite`` (if + not). Consult the documentation for the Django sites + framework for details regarding these objects' interfaces. + + """ + ctx_dict = { 'activation_key': self.activation_key, + 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS, + 'site': site } + subject = render_to_string('registration/activation_email_subject.txt', + ctx_dict) + # Email subject *must not* contain newlines + subject = ''.join(subject.splitlines()) + + message = render_to_string('registration/activation_email.txt', + ctx_dict) + + self.user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL) # Create your models here. class GameMetadata(models.Model): title = models.CharField(max_length=255) # the URL namespace that this game will occupy namespace = models.CharField(max_length=255, unique=True, validators=[RegexValidator(regex=r'^\w+$'), ]) - description = models.TextField(null=True) + description = models.TextField(null=True, blank=True) date_created = models.DateField(auto_now_add=True) last_modified = models.DateField(auto_now=True) - about_url = models.URLField(null=True, verify_exists=True) - logo_url = models.URLField(null=True, verify_exists=True) - default_game_configuration = models.ForeignKey('GameConfiguration', null=True) + about_url = models.URLField(null=True, blank=True, verify_exists=True) + logo_url = models.URLField(null=True, blank=True, verify_exists=True) + default_game_configuration = models.ForeignKey('GameConfiguration', null=True, blank=True) def __unicode__(self): return self.title @@ -28,25 +275,23 @@ class Institution(models.Model): name = models.CharField(max_length=255) - description = models.TextField(null=True) - url = models.URLField(null=True, verify_exists=True) + description = models.TextField(null=True, blank=True) + url = models.URLField(null=True, blank=True, verify_exists=True) + + def __unicode__(self): + return "{0} ({2})".format(self.name, self.description, self.url) class CommonsUser(models.Model): # for docs on related_name see http://docs.djangoproject.com/en/dev/topics/db/models/#be-careful-with-related-name + # this related name makes user.experimenter and user.participant resolvable user = models.OneToOneField(User, related_name='%(class)s', verbose_name=u'Django User', unique=True) failed_password_attempts = models.PositiveIntegerField(default=0) + institution = models.ForeignKey(Institution, null=True, blank=True) + # opt in or opt out for ability to receive invitations def is_authenticated(self): return self.user.is_authenticated() - @property - def backend(self): - return self.user.backend - - @property - def get_and_delete_messages(self): - return self.user.get_and_delete_messages() - def __unicode__(self): return self.user.__unicode__() @@ -55,9 +300,7 @@ class Experimenter(CommonsUser): - institution = models.ForeignKey(Institution) approved = models.BooleanField(default=False) - class Meta: ordering = ['user'] @@ -71,6 +314,9 @@ last_modified = models.DateField(auto_now=True) is_public = models.BooleanField(default=True) + def __unicode__(self): + return "{name} (GameConfiguration) for {game} created by {creator} on {date_created}".format(name=self.name, game=self.game, creator=self.creator, date_created=self.date_created) + class Meta: ordering = ['game', 'creator', 'date_created'] @@ -88,9 +334,16 @@ game_metadata = models.ForeignKey(GameMetadata) game_configuration = models.ForeignKey(GameConfiguration) status = models.CharField(max_length=32, choices=GAME_STATUS_CHOICES) - time_started = models.TimeField(null=True) - start_time = models.TimeField(null=True) - end_time = models.TimeField(null=True) + date_created = models.DateTimeField(auto_now_add=True) + start_time = models.TimeField(null=True, blank=True) + # how long this experiment should run + duration = models.CharField(max_length=32) + # duration of each tick. + tick_duration = models.CharField(max_length=32) + end_time = models.DateTimeField(null=True, blank=True) + + def __unicode__(self): + return "instance of {game} created by {experimenter} on {date_created}: {status}".format(game=self.game_metadata, experimenter=self.experimenter, date_created=self.date_created, status=self.status) def ___eq___(self, other): return self.id == other.id @@ -103,7 +356,7 @@ class RoundConfiguration(models.Model): game_configuration = models.ForeignKey(GameConfiguration) - sequence_number = models.PositiveIntegerField(blank=False) + sequence_number = models.PositiveIntegerField() # class Meta: # db_table = 'vcweb_round_configuration' @@ -160,7 +413,7 @@ max_size = models.PositiveIntegerField() game_instance = models.ForeignKey(GameInstance) def __unicode__(self): - return 'Group ' + self.number + return "Group #{0} in {1}".format(self.number, self.game_instance) class Meta: ordering = ['game_instance', 'number'] @@ -194,9 +447,10 @@ class Participant(CommonsUser): number = models.PositiveIntegerField() + can_receive_invitations = models.BooleanField(default=False) group = models.ForeignKey(Group) class Meta: - ordering = ['number'] + ordering = ['number', 'user'] class ParticipantData(models.Model): participant = models.ForeignKey(Participant) @@ -208,14 +462,14 @@ class Meta: ordering = [ 'parameter' ] -class Session(models.Model): +class SessionTracker(models.Model): login_time = models.DateTimeField(auto_now_add=True) logout_time = models.DateTimeField() -class ExperimenterSession(Session): +class ExperimenterSession(SessionTracker): experimenter_id = models.ForeignKey(Experimenter) -class ParticipantSession(Session): +class ParticipantSession(SessionTracker): participant_id = models.ForeignKey(Participant) diff -r 06dcd9bae8a9 -r ed59cf11bf96 vcweb/core/templates/includes/nav-menu.inc --- a/vcweb/core/templates/includes/nav-menu.inc Thu Jul 29 22:51:41 2010 -0700 +++ b/vcweb/core/templates/includes/nav-menu.inc Sun Aug 01 20:44:05 2010 -0700 @@ -2,9 +2,9 @@ {% url home as home %} {% url about as about %} -{% url login as login %} -{% url logout as logout %} -{% url register as register %} +{% url core:login as login %} +{% url core:logout as logout %} +{% url core:register as register %} <div id='menu'> <ul> diff -r 06dcd9bae8a9 -r ed59cf11bf96 vcweb/core/templates/index.html --- a/vcweb/core/templates/index.html Thu Jul 29 22:51:41 2010 -0700 +++ b/vcweb/core/templates/index.html Sun Aug 01 20:44:05 2010 -0700 @@ -17,7 +17,7 @@ <div class='entry'> Development is currently focused on converting the <a class='external' href='http://commons.asu.edu/papers'>field experiments on water, forests, and fisheries</a> - into web-based experiments, starting with the <a href='{% url forestry-index %}'>forestry experiment</a>. + into web-based experiments, starting with the <a href='{% url forestry:index %}'>forestry experiment</a>. </div> </div> {% endblock content %} diff -r 06dcd9bae8a9 -r ed59cf11bf96 vcweb/core/templates/registration/login.html --- a/vcweb/core/templates/registration/login.html Thu Jul 29 22:51:41 2010 -0700 +++ b/vcweb/core/templates/registration/login.html Sun Aug 01 20:44:05 2010 -0700 @@ -21,7 +21,7 @@ <fieldset> <legend>Returning User</legend> <p> -Don't have an account or a first-time user? Please <a href='{% url register %}'>register first</a>. +Don't have an account or a first-time user? Please <a href='{% url core:register %}'>register first</a>. </p> {% include "includes/form-as-div.inc" %} diff -r 06dcd9bae8a9 -r ed59cf11bf96 vcweb/core/templates/registration/register.html --- a/vcweb/core/templates/registration/register.html Thu Jul 29 22:51:41 2010 -0700 +++ b/vcweb/core/templates/registration/register.html Sun Aug 01 20:44:05 2010 -0700 @@ -10,7 +10,27 @@ $('#id_experimenter').click(function() { $('#experimenterDiv').toggle(this.checked); }); - $('#registrationForm').validate(); + $('#registrationForm').validate({ + rules: { + id_confirm_password: { + equalTo: "#id_password", + minlength: 3 + }, + id_password: { + minlength: 3 + } + }, + + messages: { + id_password: { + minlength: jQuery.format("Your password must be at least {0} characters.") + }, + id_confirm_password: { + equalTo: "Your confirmation password doesn't match." + minlength: jQuery.format("Your password must be at least {0} characters.") + } + } + }); }); </script> @@ -24,7 +44,7 @@ <fieldset> <legend>New User</legend> <p> -Returning users can <a href='{% url login %}'>login here</a> or <a href='{% url password-reset %}'>retrieve your password</a>. +Returning users can <a href='{% url core:login %}'>login here</a> or <a href='{% url password-reset %}'>retrieve your password</a>. <div class='field'> <span class='label'><label for="id_email">Email</label>:</span> diff -r 06dcd9bae8a9 -r ed59cf11bf96 vcweb/core/templates/registration/registration_complete.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/registration/registration_complete.html Sun Aug 01 20:44:05 2010 -0700 @@ -0,0 +1,26 @@ +{% extends "base-vcweb-form.html" %} + +{% block title %}Virtual Commons Web Registration{% endblock %} + +{% block head %} +{{ block.super }} + +<script type='text/javascript'> +$(document).ready(function() { + $(':input').addClass('required'); + $('#registrationForm').validate(); + $('#id_email').focus(); +}); +</script> + +{% endblock head %} + +{% block content %} + +<p> +Thanks for registering. An email has been sent to you with further instructions on how to activate your account. +After activating your account, you will be able to login. +</p> + +{% endblock content %} + diff -r 06dcd9bae8a9 -r ed59cf11bf96 vcweb/core/urls.py --- a/vcweb/core/urls.py Thu Jul 29 22:51:41 2010 -0700 +++ b/vcweb/core/urls.py Sun Aug 01 20:44:05 2010 -0700 @@ -5,7 +5,10 @@ @author: alllee ''' urlpatterns = patterns('vcweb.core.views', + url(r'accounts/login/$', 'login', name='login'), + url(r'accounts/register/$', 'register', name='register'), + url(r'list/$', 'experimenter_index', name='experimenter-index'), url(r'participate/$', 'participant_index', name='participant-index'), url(r'experimenter/configure/(?P<game_instance_id>\d+)$', 'configure', name='configure-experiment'), -) \ No newline at end of file +) diff -r 06dcd9bae8a9 -r ed59cf11bf96 vcweb/core/views.py --- a/vcweb/core/views.py Thu Jul 29 22:51:41 2010 -0700 +++ b/vcweb/core/views.py Sun Aug 01 20:44:05 2010 -0700 @@ -29,7 +29,7 @@ else: auth.login(request, user) # check if user is an experimenter - return redirect('experimenter-index' if user.experimenter else 'participant-index') + return redirect('core:experimenter-index' if hasattr(user, 'experimenter') else 'core:participant-index') else: form = LoginForm() return render_to_response('registration/login.html', locals(), context_instance=RequestContext(request)) @@ -40,6 +40,7 @@ if form.is_valid(): cleaned_data = form.cleaned_data # do something with cleaned data + return redirect('core-index') else: form = RegistrationForm() diff -r 06dcd9bae8a9 -r ed59cf11bf96 vcweb/forestry/urls.py --- a/vcweb/forestry/urls.py Thu Jul 29 22:51:41 2010 -0700 +++ b/vcweb/forestry/urls.py Sun Aug 01 20:44:05 2010 -0700 @@ -5,7 +5,7 @@ @author: alllee ''' urlpatterns = patterns('vcweb.forestry.views', - url(r'$', 'index', name='forestry-index'), - url(r'experimenter/$', 'experimenter', name='forestry-experimenter'), + url(r'$', 'index', name='index'), + url(r'experimenter/$', 'experimenter', name='experimenter'), url(r'configure/(?P<game_instance_id>\d+)$', 'configure', name='configure-experiment'), -) \ No newline at end of file +) diff -r 06dcd9bae8a9 -r ed59cf11bf96 vcweb/settings.py --- a/vcweb/settings.py Thu Jul 29 22:51:41 2010 -0700 +++ b/vcweb/settings.py Sun Aug 01 20:44:05 2010 -0700 @@ -90,11 +90,15 @@ 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', - 'south', 'vcweb.core', 'vcweb.forestry', ) +# activation window +ACCOUNT_ACTIVATION_DAYS = 30 + +DEFAULT_FROM_EMAIL = 'co...@as...' + # use email as username for authentication AUTHENTICATION_BACKENDS = ( "vcweb.core.auth.AuthenticationBackend", diff -r 06dcd9bae8a9 -r ed59cf11bf96 vcweb/urls.py --- a/vcweb/urls.py Thu Jul 29 22:51:41 2010 -0700 +++ b/vcweb/urls.py Sun Aug 01 20:44:05 2010 -0700 @@ -11,12 +11,12 @@ urlpatterns = patterns('', url(r'^$', 'django.views.generic.simple.direct_to_template', {'template':'index.html'}, name='home'), url(r'^about/$', 'django.views.generic.simple.direct_to_template', {'template':'about.html'}, name='about'), - url(r'^accounts/login/$', 'vcweb.core.views.login', name='login'), - url(r'^accounts/register/$', 'vcweb.core.views.register', name='register'), url(r'^accounts/password/reset/$', 'django.contrib.auth.views.password_reset', name='password-reset'), - url(r'^vcweb/', include('vcweb.core.urls')), - url(r'^forestry/', include('vcweb.forestry.urls')), + url(r'^forestry/', include('vcweb.forestry.urls', namespace='forestry', app_name='forestry')), url(r'^admin/', include(admin.site.urls)), + url(r'', include('vcweb.core.urls', namespace='core', app_name='vcweb')), + # make sure this is last + # Example: # (r'^vcweb/', include('vcweb.foo.urls')), @@ -30,10 +30,10 @@ ) if settings.LOCAL_DEVELOPMENT: - urlpatterns += patterns('', - (r'^static/(?P<path>.*)/$', 'django.views.static.serve', + urlpatterns += patterns('', + (r'^static/(?P<path>.*)/$', 'django.views.static.serve', {'document_root': settings.STATIC_BASE_DIR, 'show_indexes': True} ), - + ) |
From: <vir...@li...> - 2010-07-30 05:51:32
|
Subject: hg.virtualcommons 28 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/06dcd9bae8a9 changeset: 28:06dcd9bae8a9 user: alllee date: Thu Jul 29 22:51:41 2010 -0700 description: major refactoring of django user integration. diffstat: vcweb/core/DataAccess.py | 18 --- vcweb/core/auth.py | 31 +++++ vcweb/core/emailauth.py | 30 ----- vcweb/core/fixtures/example_initial_data.yaml | 11 ++ vcweb/core/fixtures/initial_data.json | 58 +++++++++++ vcweb/core/fixtures/initial_data.yaml | 11 -- vcweb/core/forms.py | 1 + vcweb/core/models.py | 137 ++++++++++++++----------- vcweb/core/templates/registration/login.html | 2 + vcweb/core/views.py | 21 +-- vcweb/settings.py | 10 +- 11 files changed, 196 insertions(+), 134 deletions(-) diffs (564 lines): diff -r 38905abd2924 -r 06dcd9bae8a9 vcweb/core/DataAccess.py --- a/vcweb/core/DataAccess.py Tue Jul 27 16:34:12 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -''' -Created on Jul 11, 2010 - -Data access interface (if necessary) for interacting with GroupRoundDataValue and ParticipantDataValue -@author: alllee -''' - -class DataAccess(object): - ''' - classdocs - ''' - - - def __init__(self): - ''' - Constructor - ''' - \ No newline at end of file diff -r 38905abd2924 -r 06dcd9bae8a9 vcweb/core/auth.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/auth.py Thu Jul 29 22:51:41 2010 -0700 @@ -0,0 +1,31 @@ +''' + +General VCWEB Authentication backend. There are a few use cases needed: + +1. Users can login as Experimenters or Participants. + +code adapted from http://djangosnippets.org/snippets/74/ +and http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/ + +''' + + +from django.contrib.auth.backends import ModelBackend +from django.contrib.auth.models import User +from django.core.validators import email_re +import logging + +logger = logging.getLogger('CommonsAuthenticationBackend') + +class AuthenticationBackend(ModelBackend): + def authenticate(self, username=None, password=None): + if email_re.search(username): + try: + user = User.objects.get(email=username) + # FIXME: check for Participant game codes. + if user.check_password(password): + return user + except User.DoesNotExist: + return None + return None + diff -r 38905abd2924 -r 06dcd9bae8a9 vcweb/core/emailauth.py --- a/vcweb/core/emailauth.py Tue Jul 27 16:34:12 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -''' -code adapted from http://djangosnippets.org/snippets/74/ -''' - -from django.contrib.auth.backends import ModelBackend -from django.core.validators import email_re -from vcweb.core.models import Experimenter, Participant - -class EmailBackend(ModelBackend): - def authenticate(self, username=None, password=None): - if email_re.search(username): - person = self.get_user(user_id=username) - # FIXME: check for Participant game codes. - if person is not None and person.user.check_password(password): - return person - return None - - def get_user(self, user_id=None): - if email_re.search(user_id): - try: - return Experimenter.objects.get(user__email=user_id) - except Experimenter.DoesNotExist: - try: - return Participant.objects.get(user__email=user_id) - except Participant.DoesNotExist: - return None - - - - \ No newline at end of file diff -r 38905abd2924 -r 06dcd9bae8a9 vcweb/core/fixtures/example_initial_data.yaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/fixtures/example_initial_data.yaml Thu Jul 29 22:51:41 2010 -0700 @@ -0,0 +1,11 @@ +- model: core.Institution + pk: 1 + fields: + name: Arizona State University + url: http://www.asu.edu +- model: core.Experimenter + pk: 1 + fields: + user: 1 + institution: 1 + approved: True diff -r 38905abd2924 -r 06dcd9bae8a9 vcweb/core/fixtures/initial_data.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/fixtures/initial_data.json Thu Jul 29 22:51:41 2010 -0700 @@ -0,0 +1,58 @@ +[ + { + "pk": 1, + "model": "core.institution", + "fields": { + "url": "http://www.asu.edu", + "name": "Arizona State University", + "description": null + } + }, + { + "pk": 1, + "model": "core.experimenter", + "fields": { + "approved": true, + "user": 1, + "failed_password_attempts": 0, + "institution": 1 + } + }, + { + "pk": 1, + "model": "auth.group", + "fields": { + "name": "Experimenters", + "permissions": [] + } + }, + { + "pk": 2, + "model": "auth.group", + "fields": { + "name": "Participants", + "permissions": [] + } + }, + { + "pk": 1, + "model": "auth.user", + "fields": { + "username": "alee", + "first_name": "Allen", + "last_name": "Lee", + "is_active": true, + "is_superuser": true, + "is_staff": true, + "last_login": "2010-07-29 21:36:40", + "groups": [ + 1 + ], + "user_permissions": [], + "password": "sha1$90c58$91aa79bb8ab2b40c376c093d360fafd57accd10a", + "email": "all...@as...", + "date_joined": "2010-07-29 21:36:40" + } + } + +] diff -r 38905abd2924 -r 06dcd9bae8a9 vcweb/core/fixtures/initial_data.yaml --- a/vcweb/core/fixtures/initial_data.yaml Tue Jul 27 16:34:12 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -- model: core.Institution - pk: 1 - fields: - name: Arizona State University - url: http://www.asu.edu -- model: core.Experimenter - pk: 1 - fields: - user: 1 - institution: 1 - approved: True diff -r 38905abd2924 -r 06dcd9bae8a9 vcweb/core/forms.py --- a/vcweb/core/forms.py Tue Jul 27 16:34:12 2010 -0700 +++ b/vcweb/core/forms.py Thu Jul 29 22:51:41 2010 -0700 @@ -26,3 +26,4 @@ class LoginForm(forms.Form): email = forms.EmailField(required=True, widget=widgets.TextInput(attrs=EMAIL_ATTRIBUTES)) password = forms.CharField(required=True, widget=widgets.PasswordInput(attrs=REQUIRED_ATTRIBUTES)) + diff -r 38905abd2924 -r 06dcd9bae8a9 vcweb/core/models.py --- a/vcweb/core/models.py Tue Jul 27 16:34:12 2010 -0700 +++ b/vcweb/core/models.py Thu Jul 29 22:51:41 2010 -0700 @@ -1,43 +1,68 @@ -from django.contrib.auth.models import User +from django.contrib.auth.models import User, UserManager +from django.core.validators import RegexValidator from django.db import models +import logging +logger = logging.getLogger('vcweb.core.models') # FIXME: split this into multiple modules or have one monolithic models file? Seems # like the standard is to have a single models.py per app # Create your models here. class GameMetadata(models.Model): - name = models.CharField(max_length=255) + title = models.CharField(max_length=255) + # the URL namespace that this game will occupy + namespace = models.CharField(max_length=255, unique=True, validators=[RegexValidator(regex=r'^\w+$'), ]) description = models.TextField(null=True) date_created = models.DateField(auto_now_add=True) last_modified = models.DateField(auto_now=True) - url = models.URLField(null=True) - default_game_configuration = models.ForeignKey('GameConfiguration', null=True, blank=True) - + about_url = models.URLField(null=True, verify_exists=True) + logo_url = models.URLField(null=True, verify_exists=True) + default_game_configuration = models.ForeignKey('GameConfiguration', null=True) + def __unicode__(self): - return self.name - + return self.title + class Meta: - ordering = ['name', 'date_created'] + ordering = ['namespace', 'date_created'] class Institution(models.Model): name = models.CharField(max_length=255) description = models.TextField(null=True) - url = models.URLField(null=True) + url = models.URLField(null=True, verify_exists=True) -class Experimenter(models.Model): - user = models.OneToOneField(User) +class CommonsUser(models.Model): + # for docs on related_name see http://docs.djangoproject.com/en/dev/topics/db/models/#be-careful-with-related-name + user = models.OneToOneField(User, related_name='%(class)s', verbose_name=u'Django User', unique=True) + failed_password_attempts = models.PositiveIntegerField(default=0) + + def is_authenticated(self): + return self.user.is_authenticated() + + @property + def backend(self): + return self.user.backend + + @property + def get_and_delete_messages(self): + return self.user.get_and_delete_messages() + + def __unicode__(self): + return self.user.__unicode__() + + class Meta: + abstract = True + + +class Experimenter(CommonsUser): institution = models.ForeignKey(Institution) approved = models.BooleanField(default=False) - failed_password_attempts = models.PositiveIntegerField(null=True) - - def __unicode__(self): - return self.user.__unicode__() - + class Meta: ordering = ['user'] -class GameConfiguration(models.Model): + +class GameConfiguration(models.Model): game = models.ForeignKey(GameMetadata) creator = models.ForeignKey(Experimenter) name = models.CharField(max_length=255) @@ -45,7 +70,7 @@ date_created = models.DateField(auto_now_add=True) last_modified = models.DateField(auto_now=True) is_public = models.BooleanField(default=True) - + class Meta: ordering = ['game', 'creator', 'date_created'] @@ -62,24 +87,24 @@ experimenter = models.ForeignKey(Experimenter) game_metadata = models.ForeignKey(GameMetadata) game_configuration = models.ForeignKey(GameConfiguration) - status = models.CharField(max_length=32, choices = GAME_STATUS_CHOICES) + status = models.CharField(max_length=32, choices=GAME_STATUS_CHOICES) time_started = models.TimeField(null=True) start_time = models.TimeField(null=True) end_time = models.TimeField(null=True) - + def ___eq___(self, other): return self.id == other.id - + def ___cmp___(self, other): return self.id.___cmp___(other.id) - + def ___hash___(self): return self.id.___hash___() - + class RoundConfiguration(models.Model): game_configuration = models.ForeignKey(GameConfiguration) sequence_number = models.PositiveIntegerField(blank=False) - + # class Meta: # db_table = 'vcweb_round_configuration' @@ -93,110 +118,106 @@ ) name = models.CharField(max_length=255) type = models.CharField(max_length=32, choices=PARAMETER_TYPES) - + class Meta: abstract = True ordering = ['name'] - + class ConfigurationParameter(Parameter): def __unicode__(self): return 'Configuration Parameter: ' + self.name - + # class Meta: # db_table = 'vcweb_configuration_parameter' - - + + class DataParameter(Parameter): - + def ___eq___(self, other): return self.name == other.name - + def ___cmp___(self, other): return self.name.__cmp__(other.name) - + def ___hash___(self): return self.name.__hash__() - - + + def __unicode__(self): return 'Data Parameter - [name: ' + self.name + '] [type: ' + self.type + ']' - + # class Meta: # db_table = 'vcweb_data_parameter' - + # round parameters are class RoundParameter(models.Model): round_configuration = models.ForeignKey(RoundConfiguration) parameter = models.ForeignKey(ConfigurationParameter) parameter_value = models.CharField(max_length=255) - + class Group(models.Model): number = models.PositiveIntegerField() max_size = models.PositiveIntegerField() game_instance = models.ForeignKey(GameInstance) def __unicode__(self): return 'Group ' + self.number - + class Meta: ordering = ['game_instance', 'number'] - - + + class GroupRoundData (models.Model): group = models.ForeignKey(Group) round = models.ForeignKey(RoundConfiguration) - + # class Meta: # db_table = 'vcweb_group_round_data' class DataValue(models.Model): parameter = models.ForeignKey(DataParameter) parameter_value = models.CharField(max_length=255) - time_recorded = models.TimeField(auto_now_add = True) + time_recorded = models.TimeField(auto_now_add=True) game_instance = models.ForeignKey(GameInstance) - + @staticmethod def find(incoming_parameter, incoming_game_instance): DataValue.objects.filter(parameter=incoming_parameter, game_instance=incoming_game_instance) - - + + class Meta: abstract = True - + class GroupRoundDataValue(DataValue): group_round_data = models.ForeignKey(GroupRoundData) class Meta: ordering = [ 'parameter' ] -class Participant(models.Model): - user = models.OneToOneField(User) +class Participant(CommonsUser): number = models.PositiveIntegerField() group = models.ForeignKey(Group) - def __unicode__(self): - return self.user.__unicode__() - class Meta: ordering = ['number'] - + class ParticipantData(models.Model): participant = models.ForeignKey(Participant) round_configuration = models.ForeignKey(RoundConfiguration) - + class ParticipantDataValue(DataValue): participant_data = models.ForeignKey(ParticipantData) - + class Meta: ordering = [ 'parameter' ] class Session(models.Model): login_time = models.DateTimeField(auto_now_add=True) - logout_time = models.DateTimeField() + logout_time = models.DateTimeField() class ExperimenterSession(Session): experimenter_id = models.ForeignKey(Experimenter) - + class ParticipantSession(Session): participant_id = models.ForeignKey(Participant) - - + + diff -r 38905abd2924 -r 06dcd9bae8a9 vcweb/core/templates/registration/login.html --- a/vcweb/core/templates/registration/login.html Tue Jul 27 16:34:12 2010 -0700 +++ b/vcweb/core/templates/registration/login.html Thu Jul 29 22:51:41 2010 -0700 @@ -9,6 +9,7 @@ $(document).ready(function() { $(':input').addClass('required'); $('#loginForm').validate(); + $('#id_email').focus(); }); </script> @@ -22,6 +23,7 @@ <p> Don't have an account or a first-time user? Please <a href='{% url register %}'>register first</a>. </p> + {% include "includes/form-as-div.inc" %} <div class='submit'> <input type='submit' value='Login' /> diff -r 38905abd2924 -r 06dcd9bae8a9 vcweb/core/views.py --- a/vcweb/core/views.py Tue Jul 27 16:34:12 2010 -0700 +++ b/vcweb/core/views.py Thu Jul 29 22:51:41 2010 -0700 @@ -21,14 +21,15 @@ cleaned_data = form.cleaned_data email = cleaned_data['email'] password = cleaned_data['password'] - person = auth.authenticate(username=email, password=password) - if person is None: + user = auth.authenticate(username=email, password=password) + if user is None: logger.debug("user " + email + " failed to authenticate.") + form.errors['password'] = form.error_class(['Your password is incorrect.']) return render_to_response('registration/login.html', locals(), context_instance=RequestContext(request)) else: - # check if user is an experimenter - auth.login(request, person.user) - return redirect('experimenter-index' if hasattr(person, 'approved') else 'participant-index') + auth.login(request, user) + # check if user is an experimenter + return redirect('experimenter-index' if user.experimenter else 'participant-index') else: form = LoginForm() return render_to_response('registration/login.html', locals(), context_instance=RequestContext(request)) @@ -41,16 +42,12 @@ # do something with cleaned data return redirect('core-index') else: - form = RegistrationForm() + form = RegistrationForm() return render_to_response('registration/register.html', locals(), context_instance=RequestContext(request)) @login_required def experimenter_index(request): - t = loader.get_template('experimenter-index.html') - c = RequestContext(request, { - - }) - return HttpResponse(t.render(c)) + return render_to_response('experimenter-index.html', RequestContext(request)) def configure(request, game_instance_id): # lookup game instance id (or create a new one?) @@ -58,7 +55,7 @@ c = RequestContext(request, { 'main': "configuration of the experiment!", 'username':"foo", - + }) return HttpResponse(t.render(c)) diff -r 38905abd2924 -r 06dcd9bae8a9 vcweb/settings.py --- a/vcweb/settings.py Tue Jul 27 16:34:12 2010 -0700 +++ b/vcweb/settings.py Thu Jul 29 22:51:41 2010 -0700 @@ -79,9 +79,9 @@ # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. - - os.path.join(os.path.dirname(__file__), 'templates').replace('\\','/'), - + + os.path.join(os.path.dirname(__file__), 'templates').replace('\\', '/'), + ) INSTALLED_APPS = ( @@ -97,11 +97,11 @@ # use email as username for authentication AUTHENTICATION_BACKENDS = ( - "vcweb.core.emailauth.EmailBackend", + "vcweb.core.auth.AuthenticationBackend", "django.contrib.auth.backends.ModelBackend", ) # only needed for windows boxes. Put in settings_local instead? -STATIC_BASE_DIR = os.path.join(os.path.dirname(__file__), 'static').replace('\\','/') +STATIC_BASE_DIR = os.path.join(os.path.dirname(__file__), 'static').replace('\\', '/') from settings_local import * |
From: <vir...@li...> - 2010-07-27 23:34:11
|
Subject: hg.virtualcommons 27 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/38905abd2924 changeset: 27:38905abd2924 user: alllee date: Tue Jul 27 16:34:12 2010 -0700 description: adding initial_data fixtures. In order to use this fixture you need to install PyYAML (e.g., easy_install pyyaml) diffstat: vcweb/core/fixtures/initial_data.yaml | 11 +++++++++++ vcweb/core/models.py | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diffs (31 lines): diff -r b758d8b241ab -r 38905abd2924 vcweb/core/fixtures/initial_data.yaml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/fixtures/initial_data.yaml Tue Jul 27 16:34:12 2010 -0700 @@ -0,0 +1,11 @@ +- model: core.Institution + pk: 1 + fields: + name: Arizona State University + url: http://www.asu.edu +- model: core.Experimenter + pk: 1 + fields: + user: 1 + institution: 1 + approved: True diff -r b758d8b241ab -r 38905abd2924 vcweb/core/models.py --- a/vcweb/core/models.py Tue Jul 27 16:01:10 2010 -0700 +++ b/vcweb/core/models.py Tue Jul 27 16:34:12 2010 -0700 @@ -8,10 +8,10 @@ # Create your models here. class GameMetadata(models.Model): name = models.CharField(max_length=255) - description = models.TextField() + description = models.TextField(null=True) date_created = models.DateField(auto_now_add=True) last_modified = models.DateField(auto_now=True) - url = models.URLField() + url = models.URLField(null=True) default_game_configuration = models.ForeignKey('GameConfiguration', null=True, blank=True) def __unicode__(self): |
From: <vir...@li...> - 2010-07-27 23:08:03
|
Subject: hg.virtualcommons 26 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/b758d8b241ab changeset: 26:b758d8b241ab user: alllee date: Tue Jul 27 16:01:10 2010 -0700 description: updated authentication, almost working. Need to create Experimenter / Participants in fixtures instead. diffstat: vcweb/core/emailauth.py | 27 +++++++---- vcweb/core/forms.py | 20 +++++-- vcweb/core/models.py | 25 +++------- vcweb/core/templates/experimenter-index.html | 12 ----- vcweb/core/templates/includes/form-as-div.inc | 2 +- vcweb/core/templates/registration/register.html | 59 ++++++++++++++++++++++++- vcweb/core/views.py | 34 +++++++++++-- vcweb/forestry/views.py | 5 +- vcweb/settings.py | 10 ++- vcweb/urls.py | 2 +- 10 files changed, 133 insertions(+), 63 deletions(-) diffs (354 lines): diff -r c8bec22e9669 -r b758d8b241ab vcweb/core/emailauth.py --- a/vcweb/core/emailauth.py Tue Jul 27 12:26:16 2010 -0700 +++ b/vcweb/core/emailauth.py Tue Jul 27 16:01:10 2010 -0700 @@ -1,23 +1,30 @@ ''' code adapted from http://djangosnippets.org/snippets/74/ - - ''' from django.contrib.auth.backends import ModelBackend from django.core.validators import email_re -from django.contrib.auth.models import User - +from vcweb.core.models import Experimenter, Participant class EmailBackend(ModelBackend): def authenticate(self, username=None, password=None): if email_re.search(username): - try: - user = User.objects.get(email=username) - if user.check_password(password): - return user - except User.DoesNotExist: - return None + person = self.get_user(user_id=username) + # FIXME: check for Participant game codes. + if person is not None and person.user.check_password(password): + return person return None + def get_user(self, user_id=None): + if email_re.search(user_id): + try: + return Experimenter.objects.get(user__email=user_id) + except Experimenter.DoesNotExist: + try: + return Participant.objects.get(user__email=user_id) + except Participant.DoesNotExist: + return None + + + \ No newline at end of file diff -r c8bec22e9669 -r b758d8b241ab vcweb/core/forms.py --- a/vcweb/core/forms.py Tue Jul 27 12:26:16 2010 -0700 +++ b/vcweb/core/forms.py Tue Jul 27 16:01:10 2010 -0700 @@ -8,15 +8,21 @@ #from django.forms import ModelForm #from vcweb.core.models import Experimenter +EMAIL_ATTRIBUTES = { 'class' : 'required email' } +REQUIRED_ATTRIBUTES = { 'class' : 'required' } class RegistrationForm(forms.Form): - email = forms.EmailField(required=True, widget=widgets.TextInput(attrs={'class':'required email'})) - password = forms.CharField(required=True, widget=widgets.PasswordInput(attrs={'class':'required '})) - confirm_password = forms.CharField(required=True, widget=widgets.PasswordInput(attrs={'class':'required'})) + email = forms.EmailField(required=True, widget=widgets.TextInput(attrs=EMAIL_ATTRIBUTES)) + password = forms.CharField(required=True, widget=widgets.PasswordInput(attrs=REQUIRED_ATTRIBUTES)) + confirm_password = forms.CharField(required=True, widget=widgets.PasswordInput(attrs=REQUIRED_ATTRIBUTES)) # these are hidden unless they check "experimenter request" - is_experimenter_request = forms.CheckboxInput() - first_name = forms.CharField(required=True, widget=widgets.TextInput(attrs={'class' : 'required'})) - last_name = forms.CharField(required=True, widget=widgets.TextInput(attrs={'class':'required'})) - institution = forms.CharField(required=True, widget=widgets.TextInput(attrs={'class':'required'})) + experimenter = forms.BooleanField() + first_name = forms.CharField(required=True, widget=widgets.TextInput(attrs=REQUIRED_ATTRIBUTES)) + last_name = forms.CharField(required=True, widget=widgets.TextInput(attrs=REQUIRED_ATTRIBUTES)) + institution = forms.CharField(required=True, widget=widgets.TextInput(attrs=REQUIRED_ATTRIBUTES)) + +class LoginForm(forms.Form): + email = forms.EmailField(required=True, widget=widgets.TextInput(attrs=EMAIL_ATTRIBUTES)) + password = forms.CharField(required=True, widget=widgets.PasswordInput(attrs=REQUIRED_ATTRIBUTES)) diff -r c8bec22e9669 -r b758d8b241ab vcweb/core/models.py --- a/vcweb/core/models.py Tue Jul 27 12:26:16 2010 -0700 +++ b/vcweb/core/models.py Tue Jul 27 16:01:10 2010 -0700 @@ -28,9 +28,11 @@ class Experimenter(models.Model): user = models.OneToOneField(User) institution = models.ForeignKey(Institution) - approved = models.BooleanField() - last_login_date = models.DateTimeField() - failed_password_attempts = models.PositiveIntegerField() + approved = models.BooleanField(default=False) + failed_password_attempts = models.PositiveIntegerField(null=True) + + def __unicode__(self): + return self.user.__unicode__() class Meta: ordering = ['user'] @@ -43,7 +45,6 @@ date_created = models.DateField(auto_now_add=True) last_modified = models.DateField(auto_now=True) is_public = models.BooleanField(default=True) - class Meta: ordering = ['game', 'creator', 'date_created'] @@ -129,15 +130,6 @@ parameter = models.ForeignKey(ConfigurationParameter) parameter_value = models.CharField(max_length=255) -# class Meta: -# db_table = 'vcweb_round_parameter' - - - - -# class Meta: -# db_table = 'vcweb_game_instance' - class Group(models.Model): number = models.PositiveIntegerField() max_size = models.PositiveIntegerField() @@ -175,13 +167,12 @@ class Meta: ordering = [ 'parameter' ] - class Participant(models.Model): - name = models.CharField(max_length=255) - email = models.EmailField(unique=True) + user = models.OneToOneField(User) number = models.PositiveIntegerField() group = models.ForeignKey(Group) - date_created = models.DateField(auto_now_add=True) + def __unicode__(self): + return self.user.__unicode__() class Meta: ordering = ['number'] diff -r c8bec22e9669 -r b758d8b241ab vcweb/core/templates/experimenter-index.html --- a/vcweb/core/templates/experimenter-index.html Tue Jul 27 12:26:16 2010 -0700 +++ b/vcweb/core/templates/experimenter-index.html Tue Jul 27 16:01:10 2010 -0700 @@ -4,18 +4,6 @@ {% block header %} -<div id='menu'> - <ul> - <li class='current_page_item'><a href='/' class='first'>Home</a></li> - <!-- if not logged in, otherwise present logout url.. --> - <li>{% url login %}</li> - <li><a href='login'>Participate</a></li> - <li><a href='analyze'>analyze</a></li> - - <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> - </ul> -</div> - {% endblock header %} {% block content %} diff -r c8bec22e9669 -r b758d8b241ab vcweb/core/templates/includes/form-as-div.inc --- a/vcweb/core/templates/includes/form-as-div.inc Tue Jul 27 12:26:16 2010 -0700 +++ b/vcweb/core/templates/includes/form-as-div.inc Tue Jul 27 16:01:10 2010 -0700 @@ -7,4 +7,4 @@ {% endif %} </div> {% endfor %} - +{% csrf_token %} diff -r c8bec22e9669 -r b758d8b241ab vcweb/core/templates/registration/register.html --- a/vcweb/core/templates/registration/register.html Tue Jul 27 12:26:16 2010 -0700 +++ b/vcweb/core/templates/registration/register.html Tue Jul 27 16:01:10 2010 -0700 @@ -7,6 +7,9 @@ <script type='text/javascript'> $(document).ready(function() { + $('#id_experimenter').click(function() { + $('#experimenterDiv').toggle(this.checked); + }); $('#registrationForm').validate(); }); </script> @@ -22,7 +25,61 @@ <legend>New User</legend> <p> Returning users can <a href='{% url login %}'>login here</a> or <a href='{% url password-reset %}'>retrieve your password</a>. -{% include "includes/form-as-div.inc" %} + +<div class='field'> +<span class='label'><label for="id_email">Email</label>:</span> +<input id="id_email" type="text" class="required email" name="email" /> +{% if form.email.errors %} +<label class='error' for='id_email' generated='true'>{{ form.email.errors|join:". " }}</label> +{% endif %} +</div> + +<div class='field'> +<span class='label'><label for="id_password">Password</label>:</span> +<input id="id_password" type="password" class="required " name="password" /> +{% if form.password.errors %} +<label class='error' for='id_password' generated='true'>{{ form.password.errors|join:". " }}</label> +{% endif %} +</div> + +<div class='field'> +<span class='label'><label for="id_confirm_password">Confirm password</label>:</span> +<input id="id_confirm_password" type="password" class="required" name="confirm_password" /> +{% if form.confirm_password.errors %} +<label class='error' for='id_confirm_password' generated='true'>{{ form.confirm_password.errors|join:". " }}</label> +{% endif %} +</div> + +<div class='field'> +<span class='label'><label for="id_experimenter">Experimenter</label>:</span> +<input type="checkbox" name="experimenter" id="id_experimenter" /> +</div> + +<!-- experimenter fields --> +<div id='experimenterDiv' style='display:none;'> + + + +<div class='field'> +<span class='label'><label for="id_first_name">First name</label>:</span> + +<input id="id_first_name" type="text" class="required" name="first_name" /> + +</div> + +<div class='field'> +<span class='label'><label for="id_last_name">Last name</label>:</span> +<input id="id_last_name" type="text" class="required" name="last_name" /> +</div> + +<div class='field'> +<span class='label'><label for="id_institution">Institution</label>:</span> +<input id="id_institution" type="text" class="required" name="institution" /> +</div> + +</div> + + <div class='submit'> <input type='submit' value='Login' /> </div> diff -r c8bec22e9669 -r b758d8b241ab vcweb/core/views.py --- a/vcweb/core/views.py Tue Jul 27 12:26:16 2010 -0700 +++ b/vcweb/core/views.py Tue Jul 27 16:01:10 2010 -0700 @@ -1,16 +1,37 @@ # Create your views here. +from django.conf import settings +from django.contrib import auth +from django.contrib.auth.decorators import * +from django.contrib.auth.models import User from django.http import HttpResponse +from django.shortcuts import render_to_response, redirect from django.template import Context, loader from django.template.context import RequestContext +from vcweb.core.forms import RegistrationForm, LoginForm +from vcweb.core.models import Experimenter -from django.contrib.auth.decorators import * -from django.conf import settings +import logging -from django.shortcuts import render_to_response, redirect +logger = logging.getLogger("core-views") -from vcweb.core.emailauth import EmailBackend - -from vcweb.core.forms import RegistrationForm +def login(request): + if request.method == 'POST': + form = LoginForm(request.POST) + if form.is_valid(): + cleaned_data = form.cleaned_data + email = cleaned_data['email'] + password = cleaned_data['password'] + person = auth.authenticate(username=email, password=password) + if person is None: + logger.debug("user " + email + " failed to authenticate.") + return render_to_response('registration/login.html', locals(), context_instance=RequestContext(request)) + else: + # check if user is an experimenter + auth.login(request, person.user) + return redirect('experimenter-index' if hasattr(person, 'approved') else 'participant-index') + else: + form = LoginForm() + return render_to_response('registration/login.html', locals(), context_instance=RequestContext(request)) def register(request): if request.method == 'POST': @@ -19,7 +40,6 @@ cleaned_data = form.cleaned_data # do something with cleaned data return redirect('core-index') - else: form = RegistrationForm() return render_to_response('registration/register.html', locals(), context_instance=RequestContext(request)) diff -r c8bec22e9669 -r b758d8b241ab vcweb/forestry/views.py --- a/vcweb/forestry/views.py Tue Jul 27 12:26:16 2010 -0700 +++ b/vcweb/forestry/views.py Tue Jul 27 16:01:10 2010 -0700 @@ -1,12 +1,11 @@ # Create your views here. from django.http import HttpResponse, Http404 +from django.shortcuts import render_to_response from django.template import Context, loader from django.template.context import RequestContext def index(request): - template = loader.get_template('forestry-index.html') - context = RequestContext(request) - return HttpResponse(template.render(context)) + return render_to_response('forestry-index.html', RequestContext(request)) def configure(request): return Http404() diff -r c8bec22e9669 -r b758d8b241ab vcweb/settings.py --- a/vcweb/settings.py Tue Jul 27 12:26:16 2010 -0700 +++ b/vcweb/settings.py Tue Jul 27 16:01:10 2010 -0700 @@ -1,5 +1,11 @@ # Django settings for vcweb project. import os.path +import logging + +logging.basicConfig( + level=logging.DEBUG, + format='%(asctime)s %(levelname)s %(message)s', + ) DEBUG = True TEMPLATE_DEBUG = DEBUG @@ -89,10 +95,6 @@ 'vcweb.forestry', ) -LOGIN_URL="/login/" - -LOGIN_REDIRECT_URL="/vcweb/list/" - # use email as username for authentication AUTHENTICATION_BACKENDS = ( "vcweb.core.emailauth.EmailBackend", diff -r c8bec22e9669 -r b758d8b241ab vcweb/urls.py --- a/vcweb/urls.py Tue Jul 27 12:26:16 2010 -0700 +++ b/vcweb/urls.py Tue Jul 27 16:01:10 2010 -0700 @@ -11,7 +11,7 @@ urlpatterns = patterns('', url(r'^$', 'django.views.generic.simple.direct_to_template', {'template':'index.html'}, name='home'), url(r'^about/$', 'django.views.generic.simple.direct_to_template', {'template':'about.html'}, name='about'), - url(r'^accounts/login/$', 'django.contrib.auth.views.login', name='login'), + url(r'^accounts/login/$', 'vcweb.core.views.login', name='login'), url(r'^accounts/register/$', 'vcweb.core.views.register', name='register'), url(r'^accounts/password/reset/$', 'django.contrib.auth.views.password_reset', name='password-reset'), url(r'^vcweb/', include('vcweb.core.urls')), |
From: <vir...@li...> - 2010-07-27 19:26:27
|
Subject: hg.virtualcommons 25 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/c8bec22e9669 changeset: 25:c8bec22e9669 user: alllee date: Tue Jul 27 12:26:16 2010 -0700 description: updating to django 1.2.1 diffstat: vcweb/core/emailauth.py | 4 +--- vcweb/core/forms.py | 6 +++++- vcweb/core/templates/registration/login.html | 3 ++- vcweb/settings.py | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) diffs (56 lines): diff -r cface7504114 -r c8bec22e9669 vcweb/core/emailauth.py --- a/vcweb/core/emailauth.py Tue Jul 27 01:18:42 2010 -0700 +++ b/vcweb/core/emailauth.py Tue Jul 27 12:26:16 2010 -0700 @@ -5,9 +5,7 @@ ''' from django.contrib.auth.backends import ModelBackend -# 1.2 syntax, see http://skyl.org/log/post/skyl/2010/01/email-auth-in-django-email_re-moved-again/ -#from django.core.validators import email_re -from django.forms.fields import email_re +from django.core.validators import email_re from django.contrib.auth.models import User diff -r cface7504114 -r c8bec22e9669 vcweb/core/forms.py --- a/vcweb/core/forms.py Tue Jul 27 01:18:42 2010 -0700 +++ b/vcweb/core/forms.py Tue Jul 27 12:26:16 2010 -0700 @@ -13,6 +13,10 @@ email = forms.EmailField(required=True, widget=widgets.TextInput(attrs={'class':'required email'})) password = forms.CharField(required=True, widget=widgets.PasswordInput(attrs={'class':'required '})) confirm_password = forms.CharField(required=True, widget=widgets.PasswordInput(attrs={'class':'required'})) + # these are hidden unless they check "experimenter request" + is_experimenter_request = forms.CheckboxInput() + first_name = forms.CharField(required=True, widget=widgets.TextInput(attrs={'class' : 'required'})) + last_name = forms.CharField(required=True, widget=widgets.TextInput(attrs={'class':'required'})) + institution = forms.CharField(required=True, widget=widgets.TextInput(attrs={'class':'required'})) - \ No newline at end of file diff -r cface7504114 -r c8bec22e9669 vcweb/core/templates/registration/login.html --- a/vcweb/core/templates/registration/login.html Tue Jul 27 01:18:42 2010 -0700 +++ b/vcweb/core/templates/registration/login.html Tue Jul 27 12:26:16 2010 -0700 @@ -7,7 +7,8 @@ <script type='text/javascript'> $(document).ready(function() { - $('#loginForm').validate(); + $(':input').addClass('required'); + $('#loginForm').validate(); }); </script> diff -r cface7504114 -r c8bec22e9669 vcweb/settings.py --- a/vcweb/settings.py Tue Jul 27 01:18:42 2010 -0700 +++ b/vcweb/settings.py Tue Jul 27 12:26:16 2010 -0700 @@ -59,7 +59,8 @@ # 'django.template.loaders.eggs.load_template_source', ) -TEMPLATE_CONTEXT_PROCESSORS = ('django.core.context_processors.request',) +TEMPLATE_CONTEXT_PROCESSORS = ('django.core.context_processors.request', + 'django.contrib.auth.context_processors.auth') MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', |
From: <vir...@li...> - 2010-07-27 08:19:29
|
Subject: hg.virtualcommons 23 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/97f36e9d73ab changeset: 23:97f36e9d73ab user: alllee date: Mon Jul 26 18:24:58 2010 -0700 description: starting a registration pathway for experimenters and participants. diffstat: vcweb/core/templates/registration/login.html | 7 +++++++ vcweb/core/urls.py | 1 - vcweb/core/views.py | 8 -------- 3 files changed, 7 insertions(+), 9 deletions(-) diffs (50 lines): diff -r 57608f39348a -r 97f36e9d73ab vcweb/core/templates/registration/login.html --- a/vcweb/core/templates/registration/login.html Mon Jul 26 18:06:03 2010 -0700 +++ b/vcweb/core/templates/registration/login.html Mon Jul 26 18:24:58 2010 -0700 @@ -5,10 +5,17 @@ {% block content %} <form action='' method='post'> +<fieldset> +<legend>Login</legend> +<p> +Don"t have an account or a first-time user? Please <a href='{% url register %}'>register first</a>. +</p> {% include "includes/form-as-div.inc" %} <div class='submit'> <input type='submit' value='Login' /> </div> +</fieldset> + </form> {% endblock content %} diff -r 57608f39348a -r 97f36e9d73ab vcweb/core/urls.py --- a/vcweb/core/urls.py Mon Jul 26 18:06:03 2010 -0700 +++ b/vcweb/core/urls.py Mon Jul 26 18:24:58 2010 -0700 @@ -5,7 +5,6 @@ @author: alllee ''' urlpatterns = patterns('vcweb.core.views', -# url(r'^$', 'index', name='core-index'), url(r'list/$', 'experimenter_index', name='experimenter-index'), url(r'participate/$', 'participant_index', name='participant-index'), url(r'experimenter/configure/(?P<game_instance_id>\d+)$', 'configure', name='configure-experiment'), diff -r 57608f39348a -r 97f36e9d73ab vcweb/core/views.py --- a/vcweb/core/views.py Mon Jul 26 18:06:03 2010 -0700 +++ b/vcweb/core/views.py Mon Jul 26 18:24:58 2010 -0700 @@ -8,14 +8,6 @@ from vcweb.core.emailauth import EmailBackend -def index(request): - t = loader.get_template('index.html') - c = RequestContext(request, { - 'main': "Welcome!", - 'username':"foo", - }) - return HttpResponse(t.render(c)) - @login_required def experimenter_index(request): t = loader.get_template('experimenter-index.html') |
From: <vir...@li...> - 2010-07-27 08:19:28
|
Subject: hg.virtualcommons 24 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/cface7504114 changeset: 24:cface7504114 user: alllee date: Tue Jul 27 01:18:42 2010 -0700 description: starting to integrate jquery validation plugin + CSS + images for login / registration pages. still experimenting with django builtin auth management. diffstat: vcweb/core/forms.py | 18 ++++ vcweb/core/templates/includes/form-as-div.inc | 6 +- vcweb/core/templates/includes/nav-menu.inc | 5 +- vcweb/core/templates/registration/login.html | 21 ++++- vcweb/core/templates/registration/password_reset_form.html | 33 ++++++++ vcweb/core/templates/registration/register.html | 34 +++++++++ vcweb/core/views.py | 16 ++++ vcweb/settings.py | 4 + vcweb/static/css/guarantee/style.css | 49 +++++++++++- vcweb/static/images/checked.gif | 0 vcweb/static/images/loading.gif | 0 vcweb/static/images/unchecked.gif | 0 vcweb/urls.py | 2 + 13 files changed, 174 insertions(+), 14 deletions(-) diffs (312 lines): diff -r 97f36e9d73ab -r cface7504114 vcweb/core/forms.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/forms.py Tue Jul 27 01:18:42 2010 -0700 @@ -0,0 +1,18 @@ +''' +Core Forms + +@author: alllee +''' +from django import forms +from django.forms import widgets + +#from django.forms import ModelForm +#from vcweb.core.models import Experimenter + +class RegistrationForm(forms.Form): + email = forms.EmailField(required=True, widget=widgets.TextInput(attrs={'class':'required email'})) + password = forms.CharField(required=True, widget=widgets.PasswordInput(attrs={'class':'required '})) + confirm_password = forms.CharField(required=True, widget=widgets.PasswordInput(attrs={'class':'required'})) + + + \ No newline at end of file diff -r 97f36e9d73ab -r cface7504114 vcweb/core/templates/includes/form-as-div.inc --- a/vcweb/core/templates/includes/form-as-div.inc Mon Jul 26 18:24:58 2010 -0700 +++ b/vcweb/core/templates/includes/form-as-div.inc Tue Jul 27 01:18:42 2010 -0700 @@ -1,8 +1,10 @@ {% for field in form %} <div class='field'> -<span class='input-errors'>{{ field.errors }}</span> <span class='label'>{{ field.label_tag }}:</span> -<span class='input-field'> {{ field }} </span> +{{ field }} +{% if field.errors %} +<label class='error' for='id_{{ field.name }}' generated='true'>{{ field.errors|join:". " }}</label> +{% endif %} </div> {% endfor %} diff -r 97f36e9d73ab -r cface7504114 vcweb/core/templates/includes/nav-menu.inc --- a/vcweb/core/templates/includes/nav-menu.inc Mon Jul 26 18:24:58 2010 -0700 +++ b/vcweb/core/templates/includes/nav-menu.inc Tue Jul 27 01:18:42 2010 -0700 @@ -4,6 +4,7 @@ {% url about as about %} {% url login as login %} {% url logout as logout %} +{% url register as register %} <div id='menu'> <ul> @@ -11,9 +12,9 @@ <li class='{% active request about %}'><a href='{{ about }}'>About</a></li> <li><a class='external' href='http://commons.asu.edu/contact/'>Contact us</a></li> {% if request.is_authenticated %} - <li class='{% active request logout %}'><a href='{% url logout %}'>Logout</a></li> + <li class='{% active request logout %}'><a href='{{ logout }}'>Logout</a></li> {% else %} - <li class='{% active request login %}'><a href='{% url login %}'>Login</a></li> + <li class='{% active request login %} {% active request register %}'><a href='{{ login }}'>Login/Register</a></li> {% endif %} </ul> </div> \ No newline at end of file diff -r 97f36e9d73ab -r cface7504114 vcweb/core/templates/registration/login.html --- a/vcweb/core/templates/registration/login.html Mon Jul 26 18:24:58 2010 -0700 +++ b/vcweb/core/templates/registration/login.html Tue Jul 27 01:18:42 2010 -0700 @@ -1,15 +1,26 @@ {% extends "base-vcweb-form.html" %} -{% block title %}Virtual Commons Web Experiment{% endblock %} +{% block title %}Virtual Commons Web Login{% endblock %} + +{% block head %} +{{ block.super }} + +<script type='text/javascript'> +$(document).ready(function() { + $('#loginForm').validate(); +}); +</script> + +{% endblock head %} {% block content %} -<form action='' method='post'> +<form id='loginForm' name='loginForm' action='' method='post'> <fieldset> -<legend>Login</legend> +<legend>Returning User</legend> <p> -Don"t have an account or a first-time user? Please <a href='{% url register %}'>register first</a>. -</p> +Don't have an account or a first-time user? Please <a href='{% url register %}'>register first</a>. +</p> {% include "includes/form-as-div.inc" %} <div class='submit'> <input type='submit' value='Login' /> diff -r 97f36e9d73ab -r cface7504114 vcweb/core/templates/registration/password_reset_form.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/registration/password_reset_form.html Tue Jul 27 01:18:42 2010 -0700 @@ -0,0 +1,33 @@ +{% extends "base-vcweb-form.html" %} + + + +{% block head %} +{{ block.super }} + +<script type='text/javascript'> +$(document).ready(function() { + $('#registrationForm').validate(); +}); +</script> + +{% endblock head %} + +{% block title %}Virtual Commons Web Experiment Registration{% endblock %} + +{% block content %} + +<form id='registrationForm' action='' method='post'> +<fieldset> +<legend>Reset your password</legend> + +{% include "includes/form-as-div.inc" %} +<div class='submit'> +<input type='submit' value='Reset' /> +</div> +</fieldset> + +</form> + +{% endblock content %} + diff -r 97f36e9d73ab -r cface7504114 vcweb/core/templates/registration/register.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/registration/register.html Tue Jul 27 01:18:42 2010 -0700 @@ -0,0 +1,34 @@ +{% extends "base-vcweb-form.html" %} + + + +{% block head %} +{{ block.super }} + +<script type='text/javascript'> +$(document).ready(function() { + $('#registrationForm').validate(); +}); +</script> + +{% endblock head %} + +{% block title %}Virtual Commons Web Experiment Registration{% endblock %} + +{% block content %} + +<form id='registrationForm' action='' method='post'> +<fieldset> +<legend>New User</legend> +<p> +Returning users can <a href='{% url login %}'>login here</a> or <a href='{% url password-reset %}'>retrieve your password</a>. +{% include "includes/form-as-div.inc" %} +<div class='submit'> +<input type='submit' value='Login' /> +</div> +</fieldset> + +</form> + +{% endblock content %} + diff -r 97f36e9d73ab -r cface7504114 vcweb/core/views.py --- a/vcweb/core/views.py Mon Jul 26 18:24:58 2010 -0700 +++ b/vcweb/core/views.py Tue Jul 27 01:18:42 2010 -0700 @@ -6,8 +6,24 @@ from django.contrib.auth.decorators import * from django.conf import settings +from django.shortcuts import render_to_response, redirect + from vcweb.core.emailauth import EmailBackend +from vcweb.core.forms import RegistrationForm + +def register(request): + if request.method == 'POST': + form = RegistrationForm(request.POST) + if form.is_valid(): + cleaned_data = form.cleaned_data + # do something with cleaned data + return redirect('core-index') + + else: + form = RegistrationForm() + return render_to_response('registration/register.html', locals(), context_instance=RequestContext(request)) + @login_required def experimenter_index(request): t = loader.get_template('experimenter-index.html') diff -r 97f36e9d73ab -r cface7504114 vcweb/settings.py --- a/vcweb/settings.py Mon Jul 26 18:24:58 2010 -0700 +++ b/vcweb/settings.py Tue Jul 27 01:18:42 2010 -0700 @@ -88,6 +88,10 @@ 'vcweb.forestry', ) +LOGIN_URL="/login/" + +LOGIN_REDIRECT_URL="/vcweb/list/" + # use email as username for authentication AUTHENTICATION_BACKENDS = ( "vcweb.core.emailauth.EmailBackend", diff -r 97f36e9d73ab -r cface7504114 vcweb/static/css/guarantee/style.css --- a/vcweb/static/css/guarantee/style.css Mon Jul 26 18:24:58 2010 -0700 +++ b/vcweb/static/css/guarantee/style.css Tue Jul 27 01:18:42 2010 -0700 @@ -15,17 +15,22 @@ } .submit input { - margin-left: 8.5em; + margin-left: 12em; +} + +input[type=text], input[type=password] { + width: 23em; } span.label { float: left; text-align: right; - width: 6em; + width: 11em; font-weight: bolder; - margin-right: 0.5em; - margin-top: 0.2em; - display:block; + margin-top: 0.37em; + margin-right: 0.37em; + display:inline; + font-size: 0.8em; } h1, h2, h3 { @@ -168,6 +173,24 @@ padding: 4px 0px 0 0; } +fieldset.small { + font: 0.8em "Helvetica Neue", helvetica, arial, sans-serif; + color: #666; + background-color: #efefef; + padding: 2px; + border: solid 1px #d3d3d3; + width: 350px; +} + +legend { + color: #666; + font-weight: bold; + text-transform: lowercase; + background-color: #d3d3d3; + padding: 2px 6px; + margin-bottom: 8px; +} + #search fieldset { margin: 0; padding: 0; @@ -347,6 +370,22 @@ line-height: normal; } +input.error { + padding:0.1em; + border: 1px solid; +} + +label.error { + background: url('/static/images/unchecked.gif') no-repeat left center #FBE3E4; + line-height: normal; + font-size: .8em; + margin:0.3em; + padding:0.3em; + padding-left: 1.1em; + margin-left: 0.3em; +} + + #sidebar li { margin-bottom: 30px; padding: 0 0 10px 0px; diff -r 97f36e9d73ab -r cface7504114 vcweb/static/images/checked.gif Binary file vcweb/static/images/checked.gif has changed diff -r 97f36e9d73ab -r cface7504114 vcweb/static/images/loading.gif Binary file vcweb/static/images/loading.gif has changed diff -r 97f36e9d73ab -r cface7504114 vcweb/static/images/unchecked.gif Binary file vcweb/static/images/unchecked.gif has changed diff -r 97f36e9d73ab -r cface7504114 vcweb/urls.py --- a/vcweb/urls.py Mon Jul 26 18:24:58 2010 -0700 +++ b/vcweb/urls.py Tue Jul 27 01:18:42 2010 -0700 @@ -12,6 +12,8 @@ url(r'^$', 'django.views.generic.simple.direct_to_template', {'template':'index.html'}, name='home'), url(r'^about/$', 'django.views.generic.simple.direct_to_template', {'template':'about.html'}, name='about'), url(r'^accounts/login/$', 'django.contrib.auth.views.login', name='login'), + url(r'^accounts/register/$', 'vcweb.core.views.register', name='register'), + url(r'^accounts/password/reset/$', 'django.contrib.auth.views.password_reset', name='password-reset'), url(r'^vcweb/', include('vcweb.core.urls')), url(r'^forestry/', include('vcweb.forestry.urls')), url(r'^admin/', include(admin.site.urls)), |
From: <vir...@li...> - 2010-07-27 08:19:28
|
Subject: hg.virtualcommons 22 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/57608f39348a changeset: 22:57608f39348a user: alllee date: Mon Jul 26 18:06:03 2010 -0700 description: refactoring nav menu and created template tag for "active" tab in navmenu, ala http://gnuvince.wordpress.com/2007/09/14/a-django-template-tag-for-the-current-active-page/ diffstat: vcweb/core/models.py | 4 ++-- vcweb/core/templates/about.html | 14 -------------- vcweb/core/templates/base-vcweb-form.html | 6 ++++++ vcweb/core/templates/base-vcweb.html | 18 ++++++++++-------- vcweb/core/templates/form-as-div.html | 8 -------- vcweb/core/templates/includes/form-as-div.inc | 8 ++++++++ vcweb/core/templates/includes/nav-menu.inc | 19 +++++++++++++++++++ vcweb/core/templates/index.html | 15 --------------- vcweb/core/templates/registration/login.html | 18 ++---------------- vcweb/core/templatetags/tags.py | 13 +++++++++++++ vcweb/core/urls.py | 2 +- vcweb/settings.py | 2 ++ vcweb/static/css/guarantee/style.css | 6 +++--- vcweb/static/js/jquery.validate.min.js | 16 ++++++++++++++++ vcweb/urls.py | 9 +++------ 15 files changed, 85 insertions(+), 73 deletions(-) diffs (323 lines): diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/core/models.py --- a/vcweb/core/models.py Mon Jul 26 11:40:41 2010 -0700 +++ b/vcweb/core/models.py Mon Jul 26 18:06:03 2010 -0700 @@ -1,6 +1,6 @@ +from django.contrib.auth.models import User from django.db import models -from django.contrib.auth.models import User # FIXME: split this into multiple modules or have one monolithic models file? Seems # like the standard is to have a single models.py per app @@ -26,7 +26,7 @@ url = models.URLField(null=True) class Experimenter(models.Model): - user = models.ForeignKey(User) + user = models.OneToOneField(User) institution = models.ForeignKey(Institution) approved = models.BooleanField() last_login_date = models.DateTimeField() diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/core/templates/about.html --- a/vcweb/core/templates/about.html Mon Jul 26 11:40:41 2010 -0700 +++ b/vcweb/core/templates/about.html Mon Jul 26 18:06:03 2010 -0700 @@ -2,20 +2,6 @@ {% block title %}Virtual Commons Web Experiment{% endblock %} -{% block header %} -<div id='menu'> - <ul> - <li><a href='{% url home %}' class='first'>Home</a></li> - <li class='current_page_item'><a href='{% url about %}'>About</a></li> - <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> - <li><a href='{% url experimenter-index %}'>Experimenters</a></li> - <li><a href='{% url participant-index %}'>Participants</a></li> - </ul> -</div> - - -{% endblock header %} - {% block content %} <div id='post'> <h2 class='title'>About Us</h2> diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/core/templates/base-vcweb-form.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/base-vcweb-form.html Mon Jul 26 18:06:03 2010 -0700 @@ -0,0 +1,6 @@ +{% extends "base-vcweb.html" %} + +{% block head %} +{{ block.super }} +<script type='text/javascript' src='/static/js/jquery.validate.min.js'></script> +{% endblock head %} diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/core/templates/base-vcweb.html --- a/vcweb/core/templates/base-vcweb.html Mon Jul 26 11:40:41 2010 -0700 +++ b/vcweb/core/templates/base-vcweb.html Mon Jul 26 18:06:03 2010 -0700 @@ -1,15 +1,14 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> {% block head %} -<head> <title>{% block title %}Virtual Commons Web Experiment{% endblock %}</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="/static/css/blueprint/screen.css" type="text/css" media="screen, projection"> <link rel="stylesheet" href="/static/css/blueprint/print.css" type="text/css" media="print"> <!--[if lt IE 8]><link rel="stylesheet" href="/static/media/css/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <link href="/static/css/guarantee/style.css" rel="stylesheet" type="text/css" media="screen" /> - <script type='text/javascript' src='/static/js/jquery-1.4.2.min.js'></script> <script type='text/javascript'> <!-- sets all external links to open up in new windows --> @@ -17,8 +16,8 @@ $('a.external').attr({ target: "_blank" }); }); </script> +{% endblock %} </head> -{% endblock %} <body> <div id='logo'> @@ -26,11 +25,14 @@ </div> <hr/> - - <div id='header'> - {% block header %} - {% endblock %} - </div> + + + +<div id='header'> +{% block header %} +{% include "includes/nav-menu.inc" %} +{% endblock %} +</div> <div id='page'> <div id="content"> diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/core/templates/form-as-div.html --- a/vcweb/core/templates/form-as-div.html Mon Jul 26 11:40:41 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -{% for field in form %} -<div class='field'> -<span class='input-errors'>{{ field.errors }}</span> -<span class='label'>{{ field.label_tag }}:</span> -<span class='input-field'> {{ field }} </span> -</div> -{% endfor %} - diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/core/templates/includes/form-as-div.inc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/includes/form-as-div.inc Mon Jul 26 18:06:03 2010 -0700 @@ -0,0 +1,8 @@ +{% for field in form %} +<div class='field'> +<span class='input-errors'>{{ field.errors }}</span> +<span class='label'>{{ field.label_tag }}:</span> +<span class='input-field'> {{ field }} </span> +</div> +{% endfor %} + diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/core/templates/includes/nav-menu.inc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/includes/nav-menu.inc Mon Jul 26 18:06:03 2010 -0700 @@ -0,0 +1,19 @@ +{% load tags %} + +{% url home as home %} +{% url about as about %} +{% url login as login %} +{% url logout as logout %} + +<div id='menu'> +<ul> + <li class='{% active request "^/$" %}'' ><a href='/' class='first'>Home</a></li> + <li class='{% active request about %}'><a href='{{ about }}'>About</a></li> + <li><a class='external' href='http://commons.asu.edu/contact/'>Contact us</a></li> + {% if request.is_authenticated %} + <li class='{% active request logout %}'><a href='{% url logout %}'>Logout</a></li> + {% else %} + <li class='{% active request login %}'><a href='{% url login %}'>Login</a></li> + {% endif %} +</ul> +</div> \ No newline at end of file diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/core/templates/index.html --- a/vcweb/core/templates/index.html Mon Jul 26 11:40:41 2010 -0700 +++ b/vcweb/core/templates/index.html Mon Jul 26 18:06:03 2010 -0700 @@ -2,18 +2,6 @@ {% block title %}Virtual Commons Web Experiment{% endblock %} -{% block header %} -<!-- FIXME: add dynamic nav menu ala http://finiteline.homeip.net/blog/?p=42 --> -<div id='menu'> - <ul> - <li class='current_page_item'><a href='{% url home %}' class='first'>Home</a></li> - <li><a href='{% url about %}'>About</a></li> - <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> - <li><a href='{% url experimenter-index %}'>Experimenters</a></li> - <li><a href='{% url participant-index %}'>Participants</a></li> - </ul> -</div> -{% endblock header %} {% block content %} <div id='post'> @@ -31,9 +19,6 @@ <a class='external' href='http://commons.asu.edu/papers'>field experiments on water, forests, and fisheries</a> into web-based experiments, starting with the <a href='{% url forestry-index %}'>forestry experiment</a>. </div> - - - </div> {% endblock content %} diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/core/templates/registration/login.html --- a/vcweb/core/templates/registration/login.html Mon Jul 26 11:40:41 2010 -0700 +++ b/vcweb/core/templates/registration/login.html Mon Jul 26 18:06:03 2010 -0700 @@ -1,25 +1,11 @@ -{% extends "base-vcweb.html" %} +{% extends "base-vcweb-form.html" %} {% block title %}Virtual Commons Web Experiment{% endblock %} -{% block header %} -<div id='menu'> - <ul> - <li><a href='{% url home %}' class='first'>Home</a></li> - <li><a href='{% url about %}'>About</a></li> - <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> - <li class='current_page_item'><a href='{% url experimenter-index %}'>Experimenters</a></li> - <li><a href='{% url participant-index %}'>Participants</a></li> - </ul> -</div> - - -{% endblock header %} - {% block content %} <form action='' method='post'> -{% include "form-as-div.html" %} +{% include "includes/form-as-div.inc" %} <div class='submit'> <input type='submit' value='Login' /> </div> diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/core/templatetags/tags.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templatetags/tags.py Mon Jul 26 18:06:03 2010 -0700 @@ -0,0 +1,13 @@ +### tags.py +### custom template tags +### active tag taken from http://gnuvince.wordpress.com/2007/09/14/a-django-template-tag-for-the-current-active-page/ + +from django import template +register = template.Library() + +...@re...mple_tag +def active(request, pattern): + import re + if re.search(pattern, request.path): + return 'active' + return '' diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/core/urls.py --- a/vcweb/core/urls.py Mon Jul 26 11:40:41 2010 -0700 +++ b/vcweb/core/urls.py Mon Jul 26 18:06:03 2010 -0700 @@ -5,7 +5,7 @@ @author: alllee ''' urlpatterns = patterns('vcweb.core.views', - url(r'^$', 'index', name='core-index'), +# url(r'^$', 'index', name='core-index'), url(r'list/$', 'experimenter_index', name='experimenter-index'), url(r'participate/$', 'participant_index', name='participant-index'), url(r'experimenter/configure/(?P<game_instance_id>\d+)$', 'configure', name='configure-experiment'), diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/settings.py --- a/vcweb/settings.py Mon Jul 26 11:40:41 2010 -0700 +++ b/vcweb/settings.py Mon Jul 26 18:06:03 2010 -0700 @@ -59,6 +59,8 @@ # 'django.template.loaders.eggs.load_template_source', ) +TEMPLATE_CONTEXT_PROCESSORS = ('django.core.context_processors.request',) + MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/static/css/guarantee/style.css --- a/vcweb/static/css/guarantee/style.css Mon Jul 26 11:40:41 2010 -0700 +++ b/vcweb/static/css/guarantee/style.css Mon Jul 26 18:06:03 2010 -0700 @@ -138,18 +138,18 @@ text-align: center; text-transform: capitalize; font-family: Arial, Helvetica, sans-serif; - font-size: 0.75em; + font-size: 0.8em; font-weight: bold; color: #FFFFFF; } #menu a:hover { - font-size: 0.8em; + font-size: 0.88em; text-decoration: underline; } -#menu .current_page_item a { +#menu .active a { background: url(/static/images/guarantee/img03.gif) no-repeat left top; } diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/static/js/jquery.validate.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/static/js/jquery.validate.min.js Mon Jul 26 18:06:03 2010 -0700 @@ -0,0 +1,16 @@ +/* + * jQuery validation plug-in 1.7 + * + * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ + * http://docs.jquery.com/Plugins/Validation + * + * Copyright (c) 2006 - 2008 Jörn Zaefferer + * + * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ +(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(""+a.value);},filled:function(a){return!!$.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&¶ms.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);else if(element.parentNode.name in this.submitted)this.element(element.parentNode);},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,"");validator.settings[eventType]&&validator.settings[eventType].call(validator,this[0]);}$(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",delegate).validateDelegate(":radio, :checkbox, select, option","click",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id ++", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)return arguments[i];}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=jQuery.format(message.replace(theregex,'{$1}'),rule.parameters);}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr('for')==name;});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages;}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var val=$(element).val();return val&&val.length>0;case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){if(!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){this.addEventListener(original,handler,true);},teardown:function(){this.removeEventListener(original,handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};function handler(e){e=$.event.fix(e);e.type=fix;return $.event.handle.call(this,e);}});};$.extend($.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});}});})(jQuery); \ No newline at end of file diff -r fbb2a7d8f0bc -r 57608f39348a vcweb/urls.py --- a/vcweb/urls.py Mon Jul 26 11:40:41 2010 -0700 +++ b/vcweb/urls.py Mon Jul 26 18:06:03 2010 -0700 @@ -11,14 +11,11 @@ urlpatterns = patterns('', url(r'^$', 'django.views.generic.simple.direct_to_template', {'template':'index.html'}, name='home'), url(r'^about/$', 'django.views.generic.simple.direct_to_template', {'template':'about.html'}, name='about'), - url(r'^accounts/login/$', 'django.contrib.auth.views.login'), + url(r'^accounts/login/$', 'django.contrib.auth.views.login', name='login'), + url(r'^vcweb/', include('vcweb.core.urls')), + url(r'^forestry/', include('vcweb.forestry.urls')), url(r'^admin/', include(admin.site.urls)), - url(r'^vcweb/', include('vcweb.core.urls')), - url(r'^forestry/', include('vcweb.forestry.urls')), - - - # Example: # (r'^vcweb/', include('vcweb.foo.urls')), |
From: <vir...@li...> - 2010-07-26 18:41:16
|
Subject: hg.virtualcommons 21 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/fbb2a7d8f0bc changeset: 21:fbb2a7d8f0bc user: alllee date: Mon Jul 26 11:40:41 2010 -0700 description: updating form template CSS to make sure buttons, etc., are aligned. May need to tweak if field names get too big. diffstat: vcweb/core/templates/form-as-div.html | 5 +++-- vcweb/core/templates/index.html | 2 +- vcweb/core/templates/registration/login.html | 2 +- vcweb/core/urls.py | 2 +- vcweb/core/views.py | 4 +--- vcweb/static/css/guarantee/style.css | 14 ++++++++++++++ vcweb/urls.py | 2 +- 7 files changed, 22 insertions(+), 9 deletions(-) diffs (107 lines): diff -r 70fa95b60d7d -r fbb2a7d8f0bc vcweb/core/templates/form-as-div.html --- a/vcweb/core/templates/form-as-div.html Sun Jul 25 23:25:05 2010 -0700 +++ b/vcweb/core/templates/form-as-div.html Mon Jul 26 11:40:41 2010 -0700 @@ -1,7 +1,8 @@ {% for field in form %} <div class='field'> -{{ field.errors }} -{{ field.label_tag }} : {{ field }} +<span class='input-errors'>{{ field.errors }}</span> +<span class='label'>{{ field.label_tag }}:</span> +<span class='input-field'> {{ field }} </span> </div> {% endfor %} diff -r 70fa95b60d7d -r fbb2a7d8f0bc vcweb/core/templates/index.html --- a/vcweb/core/templates/index.html Sun Jul 25 23:25:05 2010 -0700 +++ b/vcweb/core/templates/index.html Mon Jul 26 11:40:41 2010 -0700 @@ -7,7 +7,7 @@ <div id='menu'> <ul> <li class='current_page_item'><a href='{% url home %}' class='first'>Home</a></li> - <li><a href='about/'>About</a></li> + <li><a href='{% url about %}'>About</a></li> <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> <li><a href='{% url experimenter-index %}'>Experimenters</a></li> <li><a href='{% url participant-index %}'>Participants</a></li> diff -r 70fa95b60d7d -r fbb2a7d8f0bc vcweb/core/templates/registration/login.html --- a/vcweb/core/templates/registration/login.html Sun Jul 25 23:25:05 2010 -0700 +++ b/vcweb/core/templates/registration/login.html Mon Jul 26 11:40:41 2010 -0700 @@ -20,7 +20,7 @@ <form action='' method='post'> {% include "form-as-div.html" %} -<div class='field'> +<div class='submit'> <input type='submit' value='Login' /> </div> </form> diff -r 70fa95b60d7d -r fbb2a7d8f0bc vcweb/core/urls.py --- a/vcweb/core/urls.py Sun Jul 25 23:25:05 2010 -0700 +++ b/vcweb/core/urls.py Mon Jul 26 11:40:41 2010 -0700 @@ -5,7 +5,7 @@ @author: alllee ''' urlpatterns = patterns('vcweb.core.views', - url(r'$', 'index', name='core-index'), + url(r'^$', 'index', name='core-index'), url(r'list/$', 'experimenter_index', name='experimenter-index'), url(r'participate/$', 'participant_index', name='participant-index'), url(r'experimenter/configure/(?P<game_instance_id>\d+)$', 'configure', name='configure-experiment'), diff -r 70fa95b60d7d -r fbb2a7d8f0bc vcweb/core/views.py --- a/vcweb/core/views.py Sun Jul 25 23:25:05 2010 -0700 +++ b/vcweb/core/views.py Mon Jul 26 11:40:41 2010 -0700 @@ -13,7 +13,6 @@ c = RequestContext(request, { 'main': "Welcome!", 'username':"foo", - 'template_dirs' : settings.TEMPLATE_DIRS, }) return HttpResponse(t.render(c)) @@ -21,8 +20,7 @@ def experimenter_index(request): t = loader.get_template('experimenter-index.html') c = RequestContext(request, { - 'main': "List of experiments!", - 'username':"foo", + }) return HttpResponse(t.render(c)) diff -r 70fa95b60d7d -r fbb2a7d8f0bc vcweb/static/css/guarantee/style.css --- a/vcweb/static/css/guarantee/style.css Sun Jul 25 23:25:05 2010 -0700 +++ b/vcweb/static/css/guarantee/style.css Mon Jul 26 11:40:41 2010 -0700 @@ -14,6 +14,20 @@ color: #8A8A8A; } +.submit input { + margin-left: 8.5em; +} + +span.label { + float: left; + text-align: right; + width: 6em; + font-weight: bolder; + margin-right: 0.5em; + margin-top: 0.2em; + display:block; +} + h1, h2, h3 { margin: 0; text-transform: uppercase; diff -r 70fa95b60d7d -r fbb2a7d8f0bc vcweb/urls.py --- a/vcweb/urls.py Sun Jul 25 23:25:05 2010 -0700 +++ b/vcweb/urls.py Mon Jul 26 11:40:41 2010 -0700 @@ -11,7 +11,7 @@ urlpatterns = patterns('', url(r'^$', 'django.views.generic.simple.direct_to_template', {'template':'index.html'}, name='home'), url(r'^about/$', 'django.views.generic.simple.direct_to_template', {'template':'about.html'}, name='about'), - url(r'^account/login/$', 'django.contrib.auth.views.login'), + url(r'^accounts/login/$', 'django.contrib.auth.views.login'), url(r'^admin/', include(admin.site.urls)), url(r'^vcweb/', include('vcweb.core.urls')), url(r'^forestry/', include('vcweb.forestry.urls')), |
From: <vir...@li...> - 2010-07-26 06:25:29
|
Subject: hg.virtualcommons 20 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/70fa95b60d7d changeset: 20:70fa95b60d7d user: alllee date: Sun Jul 25 23:25:05 2010 -0700 description: setting up login form (for experimenters). Will need separate form / decorator for participants. diffstat: vcweb/core/templates/form-as-div.html | 7 ++++++ vcweb/core/templates/registration/login.html | 29 ++++++++++++++++++++++++++++ vcweb/core/views.py | 5 ++++ vcweb/urls.py | 3 +- 4 files changed, 43 insertions(+), 1 deletions(-) diffs (85 lines): diff -r 4d52d9f06d66 -r 70fa95b60d7d vcweb/core/templates/form-as-div.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/form-as-div.html Sun Jul 25 23:25:05 2010 -0700 @@ -0,0 +1,7 @@ +{% for field in form %} +<div class='field'> +{{ field.errors }} +{{ field.label_tag }} : {{ field }} +</div> +{% endfor %} + diff -r 4d52d9f06d66 -r 70fa95b60d7d vcweb/core/templates/registration/login.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/registration/login.html Sun Jul 25 23:25:05 2010 -0700 @@ -0,0 +1,29 @@ +{% extends "base-vcweb.html" %} + +{% block title %}Virtual Commons Web Experiment{% endblock %} + +{% block header %} +<div id='menu'> + <ul> + <li><a href='{% url home %}' class='first'>Home</a></li> + <li><a href='{% url about %}'>About</a></li> + <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> + <li class='current_page_item'><a href='{% url experimenter-index %}'>Experimenters</a></li> + <li><a href='{% url participant-index %}'>Participants</a></li> + </ul> +</div> + + +{% endblock header %} + +{% block content %} + +<form action='' method='post'> +{% include "form-as-div.html" %} +<div class='field'> +<input type='submit' value='Login' /> +</div> +</form> + +{% endblock content %} + diff -r 4d52d9f06d66 -r 70fa95b60d7d vcweb/core/views.py --- a/vcweb/core/views.py Wed Jul 21 17:58:48 2010 -0700 +++ b/vcweb/core/views.py Sun Jul 25 23:25:05 2010 -0700 @@ -3,8 +3,11 @@ from django.template import Context, loader from django.template.context import RequestContext +from django.contrib.auth.decorators import * from django.conf import settings +from vcweb.core.emailauth import EmailBackend + def index(request): t = loader.get_template('index.html') c = RequestContext(request, { @@ -14,6 +17,7 @@ }) return HttpResponse(t.render(c)) +@login_required def experimenter_index(request): t = loader.get_template('experimenter-index.html') c = RequestContext(request, { @@ -37,3 +41,4 @@ t = loader.get_template('participant-index.html') c = RequestContext(request) return HttpResponse(t.render(c)) + diff -r 4d52d9f06d66 -r 70fa95b60d7d vcweb/urls.py --- a/vcweb/urls.py Wed Jul 21 17:58:48 2010 -0700 +++ b/vcweb/urls.py Sun Jul 25 23:25:05 2010 -0700 @@ -10,7 +10,8 @@ urlpatterns = patterns('', url(r'^$', 'django.views.generic.simple.direct_to_template', {'template':'index.html'}, name='home'), - url(r'^about/$', 'django.views.generic.simple.direct_to_template', {'template':'about.html'}, name='about'), + url(r'^about/$', 'django.views.generic.simple.direct_to_template', {'template':'about.html'}, name='about'), + url(r'^account/login/$', 'django.contrib.auth.views.login'), url(r'^admin/', include(admin.site.urls)), url(r'^vcweb/', include('vcweb.core.urls')), url(r'^forestry/', include('vcweb.forestry.urls')), |
From: <vir...@li...> - 2010-07-22 06:33:31
|
Subject: hg.virtualcommons 19 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/4d52d9f06d66 changeset: 19:4d52d9f06d66 user: alllee date: Wed Jul 21 17:58:48 2010 -0700 description: minor template / view changes, about to start looking into django forms api diffstat: vcweb/core/templates/about.html | 10 ++++---- vcweb/core/templates/base-vcweb.html | 8 +++++++ vcweb/core/templates/experimenter-index.html | 29 ++++++++++++++++++++++++++++ vcweb/core/templates/index.html | 15 ++++++++----- vcweb/core/templates/participant-index.html | 26 +++++++++++++++++++++++++ vcweb/core/urls.py | 4 +- vcweb/core/views.py | 8 +++--- vcweb/static/css/guarantee/style.css | 9 ++++--- 8 files changed, 88 insertions(+), 21 deletions(-) diffs (206 lines): diff -r 9137b857aa18 -r 4d52d9f06d66 vcweb/core/templates/about.html --- a/vcweb/core/templates/about.html Wed Jul 21 14:30:03 2010 -0700 +++ b/vcweb/core/templates/about.html Wed Jul 21 17:58:48 2010 -0700 @@ -8,8 +8,8 @@ <li><a href='{% url home %}' class='first'>Home</a></li> <li class='current_page_item'><a href='{% url about %}'>About</a></li> <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> - <li><a href='{% url experimenter %}'>Experimenters</a></li> - <li><a href='{% url participatant %}'>Participate</a></li> + <li><a href='{% url experimenter-index %}'>Experimenters</a></li> + <li><a href='{% url participant-index %}'>Participants</a></li> </ul> </div> @@ -29,9 +29,9 @@ </div> <br/> <div class='entry'> - The project is funded by the <a href='http://nsf.gov'>National Science Foundation</a> - (BCS 0625354 and SES 0748632) and <a href='http://www.asu.edu'>Arizona State University</a> - and is affiliated with the <a href='http://csid.asu.edu'>Center for the Study of Institutional Diversity</a>. + The project is funded by the <a class='external' href='http://nsf.gov'>National Science Foundation</a> + (BCS 0625354 and SES 0748632) and <a class='external' href='http://www.asu.edu'>Arizona State University</a> + and is affiliated with the <a class='external' href='http://csid.asu.edu'>Center for the Study of Institutional Diversity</a>. </div> </div> {% endblock content %} diff -r 9137b857aa18 -r 4d52d9f06d66 vcweb/core/templates/base-vcweb.html --- a/vcweb/core/templates/base-vcweb.html Wed Jul 21 14:30:03 2010 -0700 +++ b/vcweb/core/templates/base-vcweb.html Wed Jul 21 17:58:48 2010 -0700 @@ -9,6 +9,14 @@ <link rel="stylesheet" href="/static/css/blueprint/print.css" type="text/css" media="print"> <!--[if lt IE 8]><link rel="stylesheet" href="/static/media/css/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> <link href="/static/css/guarantee/style.css" rel="stylesheet" type="text/css" media="screen" /> + +<script type='text/javascript' src='/static/js/jquery-1.4.2.min.js'></script> +<script type='text/javascript'> +<!-- sets all external links to open up in new windows --> +$(document).ready(function() { + $('a.external').attr({ target: "_blank" }); +}); +</script> </head> {% endblock %} diff -r 9137b857aa18 -r 4d52d9f06d66 vcweb/core/templates/experimenter-index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/experimenter-index.html Wed Jul 21 17:58:48 2010 -0700 @@ -0,0 +1,29 @@ +{% extends "base-vcweb.html" %} + +{% block title %} Virtual Commons Web Experimenter Interface {% endblock %} + +{% block header %} + +<div id='menu'> + <ul> + <li class='current_page_item'><a href='/' class='first'>Home</a></li> + <!-- if not logged in, otherwise present logout url.. --> + <li>{% url login %}</li> + <li><a href='login'>Participate</a></li> + <li><a href='analyze'>analyze</a></li> + + <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> + </ul> +</div> + +{% endblock header %} + +{% block content %} +<div id="page_content"> +<p> +This is the base for the experimenter interface. +</p> +</div> + +{% endblock content %} + diff -r 9137b857aa18 -r 4d52d9f06d66 vcweb/core/templates/index.html --- a/vcweb/core/templates/index.html Wed Jul 21 14:30:03 2010 -0700 +++ b/vcweb/core/templates/index.html Wed Jul 21 17:58:48 2010 -0700 @@ -9,8 +9,8 @@ <li class='current_page_item'><a href='{% url home %}' class='first'>Home</a></li> <li><a href='about/'>About</a></li> <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> - <li><a href='experimenter/'>Experimenters</a></li> - <li><a href='{% url participate %}'>Participate</a></li> + <li><a href='{% url experimenter-index %}'>Experimenters</a></li> + <li><a href='{% url participant-index %}'>Participants</a></li> </ul> </div> {% endblock header %} @@ -19,14 +19,17 @@ <div id='post'> <h2 class='title'>Welcome</h2> <div class='entry'> - Welcome to the Virtual Commons Web Environment, an open software initiative hosted at <a class='external' href='http://www.asu.edu'>Arizona State University</a>. - We develop and support a variety of web-based collective action experiments. For more information, please visit - <a class='external' href='http://commons.asu.edu'>commons.asu.edu</a>. + Welcome to the Virtual Commons Web Environment, an open software initiative hosted at + <a class='external' href='http://www.asu.edu'>Arizona State University</a>. + We develop and support a variety of web-based collective action experiments. + For more information, please visit <a class='external' href='http://commons.asu.edu'>http://commons.asu.edu</a>. </div> <br/> <h2 class='title'>Current development</h2> <div class='entry'> - Development is currently focused on the <a href='{% url forestry-index %}'>Forestry web-based experiment</a>. + Development is currently focused on converting the + <a class='external' href='http://commons.asu.edu/papers'>field experiments on water, forests, and fisheries</a> + into web-based experiments, starting with the <a href='{% url forestry-index %}'>forestry experiment</a>. </div> diff -r 9137b857aa18 -r 4d52d9f06d66 vcweb/core/templates/participant-index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/participant-index.html Wed Jul 21 17:58:48 2010 -0700 @@ -0,0 +1,26 @@ +{% extends "base-vcweb.html" %} + +{% block title %}Virtual Commons Web Participant Interface{% endblock %} + +{% block header %} +<div id="masthead"> +<table width="100%" + style="background-color: #9ACD32; background-repeat: no-repeat;" + border="0"> + <tr> + <th align="left" valign="top" style="background-color: #9ACD32;"> + <img height="35" alt="imageTree" src="/static/images/Logo3.png/" /></th> + <th align="right" valign="bottom"><b style="color:purple; margin-right:10px;">{{username}}</b></th> + </tr> +</table> +</div> + +{% endblock header %} + +{% block content %} +<div id="page_content"> +<p> +The base participant interface, will be customized for each experiment. +</p> +</div> +{% endblock content %} diff -r 9137b857aa18 -r 4d52d9f06d66 vcweb/core/urls.py --- a/vcweb/core/urls.py Wed Jul 21 14:30:03 2010 -0700 +++ b/vcweb/core/urls.py Wed Jul 21 17:58:48 2010 -0700 @@ -6,7 +6,7 @@ ''' urlpatterns = patterns('vcweb.core.views', url(r'$', 'index', name='core-index'), - url(r'list/$', 'experimenter_list', name='list-experiments'), - url(r'participate/$', 'participate', name='participate'), + url(r'list/$', 'experimenter_index', name='experimenter-index'), + url(r'participate/$', 'participant_index', name='participant-index'), url(r'experimenter/configure/(?P<game_instance_id>\d+)$', 'configure', name='configure-experiment'), ) \ No newline at end of file diff -r 9137b857aa18 -r 4d52d9f06d66 vcweb/core/views.py --- a/vcweb/core/views.py Wed Jul 21 14:30:03 2010 -0700 +++ b/vcweb/core/views.py Wed Jul 21 17:58:48 2010 -0700 @@ -14,8 +14,8 @@ }) return HttpResponse(t.render(c)) -def experimenter_list(request): - t = loader.get_template('base_experimenter.html') +def experimenter_index(request): + t = loader.get_template('experimenter-index.html') c = RequestContext(request, { 'main': "List of experiments!", 'username':"foo", @@ -32,8 +32,8 @@ }) return HttpResponse(t.render(c)) -def participate(request): +def participant_index(request): # FIXME: check if logged in - t = loader.get_template('participant_login.html') + t = loader.get_template('participant-index.html') c = RequestContext(request) return HttpResponse(t.render(c)) diff -r 9137b857aa18 -r 4d52d9f06d66 vcweb/static/css/guarantee/style.css --- a/vcweb/static/css/guarantee/style.css Wed Jul 21 14:30:03 2010 -0700 +++ b/vcweb/static/css/guarantee/style.css Wed Jul 21 17:58:48 2010 -0700 @@ -124,14 +124,15 @@ text-align: center; text-transform: capitalize; font-family: Arial, Helvetica, sans-serif; - font-size: 12px; + font-size: 0.75em; font-weight: bold; color: #FFFFFF; } -#menu a:hover { - background: url(/static/images/guarantee/img03.gif) no-repeat left top; - text-decoration: none; +#menu a:hover { + font-size: 0.8em; + text-decoration: underline; + } #menu .current_page_item a { |
From: <vir...@li...> - 2010-07-21 21:29:32
|
Subject: hg.virtualcommons 15 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/1477e1e6e63b changeset: 15:1477e1e6e63b user: alllee date: Wed Jul 21 14:24:29 2010 -0700 description: refactoring templates and starting to implement forestry experiment. diffstat: vcweb/core/emailauth.py | 25 +++++++++ vcweb/core/models.py | 3 + vcweb/core/templates/about.html | 38 ++++++++++++++ vcweb/core/templates/base-experimenter.html | 29 +++++++++++ vcweb/core/templates/base-participant.html | 26 +++++++++ vcweb/core/templates/base-vcweb.html | 55 +++++++++++++++++++++ vcweb/core/templates/base_experimenter.html | 42 ---------------- vcweb/core/templates/base_participant.html | 26 --------- vcweb/core/templates/base_vcweb.html | 55 --------------------- vcweb/core/templates/index.html | 16 ++++- vcweb/core/urls.py | 9 +- vcweb/core/views.py | 23 ++++++-- vcweb/forestry/templates/forestry-experimenter.html | 4 + vcweb/forestry/templates/forestry-index.html | 31 +++++++++++ vcweb/forestry/urls.py | 11 ++++ vcweb/forestry/views.py | 16 ++++++ vcweb/settings.py | 9 +++- vcweb/urls.py | 13 +++- 18 files changed, 287 insertions(+), 144 deletions(-) diffs (586 lines): diff -r e60687705f9e -r 1477e1e6e63b vcweb/core/emailauth.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/emailauth.py Wed Jul 21 14:24:29 2010 -0700 @@ -0,0 +1,25 @@ +''' +code adapted from http://djangosnippets.org/snippets/74/ + + +''' + +from django.contrib.auth.backends import ModelBackend +# 1.2 syntax, see http://skyl.org/log/post/skyl/2010/01/email-auth-in-django-email_re-moved-again/ +#from django.core.validators import email_re +from django.forms.fields import email_re +from django.contrib.auth.models import User + + +class EmailBackend(ModelBackend): + def authenticate(self, username=None, password=None): + if email_re.search(username): + try: + user = User.objects.get(email=username) + if user.check_password(password): + return user + except User.DoesNotExist: + return None + return None + + \ No newline at end of file diff -r e60687705f9e -r 1477e1e6e63b vcweb/core/models.py --- a/vcweb/core/models.py Thu Jul 15 22:43:39 2010 -0700 +++ b/vcweb/core/models.py Wed Jul 21 14:24:29 2010 -0700 @@ -1,5 +1,7 @@ from django.db import models +from django.contrib.auth.models import User + # FIXME: split this into multiple modules or have one monolithic models file? Seems # like the standard is to have a single models.py per app @@ -24,6 +26,7 @@ url = models.URLField(null=True) class Experimenter(models.Model): + user = models.ForeignKey(User) email = models.EmailField() last_name = models.CharField(max_length=64) first_name = models.CharField(max_length=64) diff -r e60687705f9e -r 1477e1e6e63b vcweb/core/templates/about.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/about.html Wed Jul 21 14:24:29 2010 -0700 @@ -0,0 +1,38 @@ +{% extends "base-vcweb.html" %} + +{% block title %}Virtual Commons Web Experiment{% endblock %} + +{% block header %} +<div id='menu'> + <ul> + <li><a href='{% url home %}' class='first'>Home</a></li> + <li class='current_page_item'><a href='{% url about %}'>About</a></li> + <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> + <li><a href='{% url experimenter %}'>Experimenters</a></li> + <li><a href='{% url participatant %}'>Participate</a></li> + </ul> +</div> + + +{% endblock header %} + +{% block content %} +<div id='post'> + <h2 class='title'>About Us</h2> + <div class='entry'> + We develop real-time dynamic experiments to help us analyze and understand issues related + to the governance of common resources. Sharing common resources has been a challenge for + human societies for millennia. In many circumstances, the ability to create effective institutional + arrangements has helped avoid the tragedy of the commons. Controlled experiments have been instrumental + in increasing our understanding of how humans organize themselves in cooperative arrangements to govern + common resources. On this website you will find software to perform a diverse set of group experiments. + </div> + <br/> + <div class='entry'> + The project is funded by the <a href='http://nsf.gov'>National Science Foundation</a> + (BCS 0625354 and SES 0748632) and <a href='http://www.asu.edu'>Arizona State University</a> + and is affiliated with the <a href='http://csid.asu.edu'>Center for the Study of Institutional Diversity</a>. + </div> +</div> +{% endblock content %} + diff -r e60687705f9e -r 1477e1e6e63b vcweb/core/templates/base-experimenter.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/base-experimenter.html Wed Jul 21 14:24:29 2010 -0700 @@ -0,0 +1,29 @@ +{% extends "base-vcweb.html" %} + +{% block title %} Virtual Commons Web Experimenter Interface {% endblock %} + +{% block header %} + +<div id='menu'> + <ul> + <li class='current_page_item'><a href='/' class='first'>Home</a></li> + <!-- if not logged in, otherwise present logout url.. --> + <li>{% url login %}</li> + <li><a href='login'>Participate</a></li> + <li><a href='analyze'>analyze</a></li> + + <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> + </ul> +</div> + +{% endblock header %} + +{% block content %} +<div id="page_content"> +<p> +This is the base for the experimenter interface. +</p> +</div> + +{% endblock content %} + diff -r e60687705f9e -r 1477e1e6e63b vcweb/core/templates/base-participant.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/base-participant.html Wed Jul 21 14:24:29 2010 -0700 @@ -0,0 +1,26 @@ +{% extends "base-vcweb.html" %} + +{% block title %}Virtual Commons Web Participant Interface{% endblock %} + +{% block header %} +<div id="masthead"> +<table width="100%" + style="background-color: #9ACD32; background-repeat: no-repeat;" + border="0"> + <tr> + <th align="left" valign="top" style="background-color: #9ACD32;"> + <img height="35" alt="imageTree" src="/static/images/Logo3.png/" /></th> + <th align="right" valign="bottom"><b style="color:purple; margin-right:10px;">{{username}}</b></th> + </tr> +</table> +</div> + +{% endblock header %} + +{% block content %} +<div id="page_content"> +<p> +The base participant interface, will be customized for each experiment. +</p> +</div> +{% endblock content %} diff -r e60687705f9e -r 1477e1e6e63b vcweb/core/templates/base-vcweb.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/base-vcweb.html Wed Jul 21 14:24:29 2010 -0700 @@ -0,0 +1,55 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + +{% block head %} +<head> +<title>{% block title %}Virtual Commons Web Experiment{% endblock %}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link rel="stylesheet" href="/static/css/blueprint/screen.css" type="text/css" media="screen, projection"> +<link rel="stylesheet" href="/static/css/blueprint/print.css" type="text/css" media="print"> +<!--[if lt IE 8]><link rel="stylesheet" href="/static/media/css/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> +<link href="/static/css/guarantee/style.css" rel="stylesheet" type="text/css" media="screen" /> +</head> +{% endblock %} + +<body> + <div id='logo'> + <h1>{% block logo %}The Virtual Commons Web Environment{% endblock %}</h1> + </div> + + <hr/> + + <div id='header'> + {% block header %} + {% endblock %} + </div> + +<div id='page'> + <div id="content"> + {% block content %} + + {% endblock %} + </div> + + + <div style='clear: both;'> </div> + <!-- end #page --> +</div> + +<div id="footer"> + {% block footer %} + <p> + <a href='http://shesc.asu.edu'>School of Human Evolution and Social Change</a> <br /> + <a href='http://csid.asu.edu'>Center for the Study of Institutional Diversity</a> + </p> + <p class='legal'> + Copyright (c) 2010 Arizona Board of Regents. Design adapted from <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.<br/> + This project is funded by the <a href='http://nsf.gov'>National Science Foundation</a> and <a href='http://www.asu.edu'>Arizona State University</a>. + <br /> + </p> + {% endblock footer %} +</div> + +</body> + +</html> diff -r e60687705f9e -r 1477e1e6e63b vcweb/core/templates/base_experimenter.html --- a/vcweb/core/templates/base_experimenter.html Thu Jul 15 22:43:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -{% extends "base_vcweb.html" %} - -{% block title %} Virtual Commons Web Experimenter Interface {% endblock %} - -{% block header %} -<div id="masthead"> -<table width="100%" - style="background-color: #9ACD32; background-repeat: no-repeat;" - border="0"> - <tr> - <th align="left" valign="top" style="background-color: #9ACD32;"> - <img height="35" alt="imageTree" src="/static/images/Logo3.png/" /></th> - <th align="right" valign="top"><b style="color:purple; margin-right:10px;">{{username}}</b></th> - </tr> -</table> -</div> - - -<div id="top_nav"> -<table> - <tr> - <td align="left"></td> - <td align="center"><a href="/games/" style="color: yellow"> <b>Home</b></a> - </td> - <td align="center"><a href="/games/config" style="color: yellow"><b>Create</b></a> - </td> - <td align="center"><a href="/games/list" style="color: yellow"><b>List</b></a> - </td> - </tr> -</table> -</div> -{% endblock header %} - -{% block content %} -<div id="page_content"> -<p> -This is the base for the experimenter interface. -</p> -</div> - -{% endblock content %} - diff -r e60687705f9e -r 1477e1e6e63b vcweb/core/templates/base_participant.html --- a/vcweb/core/templates/base_participant.html Thu Jul 15 22:43:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -{% extends "base_vcweb.html" %} - -{% block title %}Virtual Commons Web Participant Interface{% endblock %} - -{% block header %} -<div id="masthead"> -<table width="100%" - style="background-color: #9ACD32; background-repeat: no-repeat;" - border="0"> - <tr> - <th align="left" valign="top" style="background-color: #9ACD32;"> - <img height="35" alt="imageTree" src="/static/images/Logo3.png/" /></th> - <th align="right" valign="bottom"><b style="color:purple; margin-right:10px;">{{username}}</b></th> - </tr> -</table> -</div> - -{% endblock header %} - -{% block content %} -<div id="page_content"> -<p> -The base participant interface, will be customized for each experiment. -</p> -</div> -{% endblock content %} diff -r e60687705f9e -r 1477e1e6e63b vcweb/core/templates/base_vcweb.html --- a/vcweb/core/templates/base_vcweb.html Thu Jul 15 22:43:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - -{% block head %} -<head> -<title>{% block title %}Virtual Commons Web Experiment{% endblock %}</title> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<link rel="stylesheet" href="/static/css/blueprint/screen.css" type="text/css" media="screen, projection"> -<link rel="stylesheet" href="/static/css/blueprint/print.css" type="text/css" media="print"> -<!--[if lt IE 8]><link rel="stylesheet" href="/static/media/css/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> -<link href="/static/css/guarantee/style.css" rel="stylesheet" type="text/css" media="screen" /> -</head> -{% endblock %} - -<body> - <div id='logo'> - <h1>{% block logo %}The Virtual Commons Web Environment{% endblock %}</h1> - </div> - - <hr/> - - <div id='header'> - {% block header %} - {% endblock %} - </div> - -<div id='page'> - <div id="content"> - {% block content %} - - {% endblock %} - </div> - - - <div style='clear: both;'> </div> - <!-- end #page --> -</div> - -<div id="footer"> - {% block footer %} - <p> - <a href='http://shesc.asu.edu'>School of Human Evolution and Social Change</a> <br /> - <a href='http://csid.asu.edu'>Center for the Study of Institutional Diversity</a> - </p> - <p class='legal'> - Copyright (c) 2010 Arizona Board of Regents. Design adapted from <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.<br/> - This project is funded by the <a href='http://nsf.gov'>National Science Foundation</a> and <a href='http://www.asu.edu'>Arizona State University</a>. - <br /> - </p> - {% endblock footer %} -</div> - -</body> - -</html> diff -r e60687705f9e -r 1477e1e6e63b vcweb/core/templates/index.html --- a/vcweb/core/templates/index.html Thu Jul 15 22:43:39 2010 -0700 +++ b/vcweb/core/templates/index.html Wed Jul 21 14:24:29 2010 -0700 @@ -1,19 +1,18 @@ -{% extends "base_vcweb.html" %} +{% extends "base-vcweb.html" %} {% block title %}Virtual Commons Web Experiment{% endblock %} {% block header %} +<!-- FIXME: add dynamic nav menu ala http://finiteline.homeip.net/blog/?p=42 --> <div id='menu'> <ul> - <li class='current_page_item'><a href='/' class='first'>Home</a></li> + <li class='current_page_item'><a href='{% url home %}' class='first'>Home</a></li> <li><a href='about/'>About</a></li> <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> <li><a href='experimenter/'>Experimenters</a></li> - <li><a href='participate/'>Participate</a></li> + <li><a href='{% url participate %}'>Participate</a></li> </ul> </div> - - {% endblock header %} {% block content %} @@ -24,6 +23,13 @@ We develop and support a variety of web-based collective action experiments. For more information, please visit <a class='external' href='http://commons.asu.edu'>commons.asu.edu</a>. </div> + <br/> + <h2 class='title'>Current development</h2> + <div class='entry'> + Development is currently focused on the <a href='{% url forestry-index %}'>Forestry web-based experiment</a>. + </div> + + </div> {% endblock content %} diff -r e60687705f9e -r 1477e1e6e63b vcweb/core/urls.py --- a/vcweb/core/urls.py Thu Jul 15 22:43:39 2010 -0700 +++ b/vcweb/core/urls.py Wed Jul 21 14:24:29 2010 -0700 @@ -5,9 +5,8 @@ @author: alllee ''' urlpatterns = patterns('vcweb.core.views', - ('^$', 'index'), - (r'list/$', 'list'), - (r'configure/$', 'configure'), - (r'') - + url(r'$', 'index', name='core-index'), + url(r'list/$', 'experimenter_list', name='list-experiments'), + url(r'participate/$', 'participate', name='participate'), + url(r'experimenter/configure/(?P<game_instance_id>\d+)$', 'configure', name='configure-experiment'), ) \ No newline at end of file diff -r e60687705f9e -r 1477e1e6e63b vcweb/core/views.py --- a/vcweb/core/views.py Thu Jul 15 22:43:39 2010 -0700 +++ b/vcweb/core/views.py Wed Jul 21 14:24:29 2010 -0700 @@ -1,28 +1,39 @@ # Create your views here. from django.http import HttpResponse from django.template import Context, loader +from django.template.context import RequestContext +from django.conf import settings def index(request): t = loader.get_template('index.html') - c = Context({ + c = RequestContext(request, { 'main': "Welcome!", 'username':"foo", + 'template_dirs' : settings.TEMPLATE_DIRS, }) return HttpResponse(t.render(c)) -def list(request): +def experimenter_list(request): t = loader.get_template('base_experimenter.html') - c = Context({ + c = RequestContext(request, { 'main': "List of experiments!", 'username':"foo", }) return HttpResponse(t.render(c)) -def configure(request): +def configure(request, game_instance_id): +# lookup game instance id (or create a new one?) t = loader.get_template('base_participant.html') - c = Context({ + c = RequestContext(request, { 'main': "configuration of the experiment!", 'username':"foo", + }) - return HttpResponse(t.render(c)) \ No newline at end of file + return HttpResponse(t.render(c)) + +def participate(request): + # FIXME: check if logged in + t = loader.get_template('participant_login.html') + c = RequestContext(request) + return HttpResponse(t.render(c)) diff -r e60687705f9e -r 1477e1e6e63b vcweb/forestry/templates/forestry-experimenter.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/forestry/templates/forestry-experimenter.html Wed Jul 21 14:24:29 2010 -0700 @@ -0,0 +1,4 @@ +{% extends "base-experimenter.html" %} + +{% block title %} Forestry Experimenter Interface {% endblock %} + \ No newline at end of file diff -r e60687705f9e -r 1477e1e6e63b vcweb/forestry/templates/forestry-index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/forestry/templates/forestry-index.html Wed Jul 21 14:24:29 2010 -0700 @@ -0,0 +1,31 @@ +{% extends "base-vcweb.html" %} + +{% block title %}Forestry{% endblock %} + +{% block header %} +<div id='menu'> + <ul> + <li class='current_page_item'><a href='{% url home %}' class='first'>Home</a></li> + <li><a href='about/'>About</a></li> + <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> + <li><a href='experimenter/'>Experimenters</a></li> + <li><a href='{% url participate %}'>Participate</a></li> + </ul> +</div> + + +{% endblock header %} + +{% block content %} +<div id='post'> + <h2 class='title'>Forestry</h2> + <div class='entry'> + The forestry experiment. + + </div> + + + +</div> +{% endblock content %} + diff -r e60687705f9e -r 1477e1e6e63b vcweb/forestry/urls.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/forestry/urls.py Wed Jul 21 14:24:29 2010 -0700 @@ -0,0 +1,11 @@ +from django.conf.urls.defaults import url, patterns +''' +Created on Jul 14, 2010 + +@author: alllee +''' +urlpatterns = patterns('vcweb.forestry.views', + url(r'$', 'index', name='forestry-index'), + url(r'experimenter/$', 'experimenter', name='forestry-experimenter'), + url(r'configure/(?P<game_instance_id>\d+)$', 'configure', name='configure-experiment'), +) \ No newline at end of file diff -r e60687705f9e -r 1477e1e6e63b vcweb/forestry/views.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/forestry/views.py Wed Jul 21 14:24:29 2010 -0700 @@ -0,0 +1,16 @@ +# Create your views here. +from django.http import HttpResponse, Http404 +from django.template import Context, loader +from django.template.context import RequestContext + +def index(request): + template = loader.get_template('forestry-index.html') + context = RequestContext(request) + return HttpResponse(template.render(context)) + +def configure(request): + return Http404() + + +def experimenter(request): + return Http404() \ No newline at end of file diff -r e60687705f9e -r 1477e1e6e63b vcweb/settings.py --- a/vcweb/settings.py Thu Jul 15 22:43:39 2010 -0700 +++ b/vcweb/settings.py Wed Jul 21 14:24:29 2010 -0700 @@ -82,7 +82,14 @@ 'django.contrib.sites', 'django.contrib.admin', 'south', - 'vcweb.core' + 'vcweb.core', + 'vcweb.forestry', +) + +# use email as username for authentication +AUTHENTICATION_BACKENDS = ( + "vcweb.core.emailauth.EmailBackend", + "django.contrib.auth.backends.ModelBackend", ) # only needed for windows boxes. Put in settings_local instead? diff -r e60687705f9e -r 1477e1e6e63b vcweb/urls.py --- a/vcweb/urls.py Thu Jul 15 22:43:39 2010 -0700 +++ b/vcweb/urls.py Wed Jul 21 14:24:29 2010 -0700 @@ -9,9 +9,12 @@ admin.autodiscover() urlpatterns = patterns('', - (r'^$', 'django.views.generic.simple.direct_to_template', {'template':'index.html'}), - (r'^admin/', include(admin.site.urls)), - (r'^vcweb/', include('vcweb.core.urls')), + url(r'^$', 'django.views.generic.simple.direct_to_template', {'template':'index.html'}, name='home'), + url(r'^about/$', 'django.views.generic.simple.direct_to_template', {'template':'about.html'}, name='about'), + url(r'^admin/', include(admin.site.urls)), + url(r'^vcweb/', include('vcweb.core.urls')), + url(r'^forestry/', include('vcweb.forestry.urls')), + @@ -29,6 +32,8 @@ if settings.LOCAL_DEVELOPMENT: urlpatterns += patterns('', (r'^static/(?P<path>.*)/$', 'django.views.static.serve', - {'document_root': settings.STATIC_BASE_DIR, 'show_indexes': True}) + {'document_root': settings.STATIC_BASE_DIR, 'show_indexes': True} + ), + ) |
From: <vir...@li...> - 2010-07-21 21:29:32
|
Subject: hg.virtualcommons 18 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/9137b857aa18 changeset: 18:9137b857aa18 user: alllee date: Wed Jul 21 14:30:03 2010 -0700 description: updated experimenter fields since it now extends the default django user model diffstat: vcweb/core/models.py | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diffs (22 lines): diff -r ce742d1a5222 -r 9137b857aa18 vcweb/core/models.py --- a/vcweb/core/models.py Wed Jul 21 14:26:43 2010 -0700 +++ b/vcweb/core/models.py Wed Jul 21 14:30:03 2010 -0700 @@ -27,17 +27,13 @@ class Experimenter(models.Model): user = models.ForeignKey(User) - email = models.EmailField() - last_name = models.CharField(max_length=64) - first_name = models.CharField(max_length=64) institution = models.ForeignKey(Institution) - password = models.CharField(max_length=255) approved = models.BooleanField() last_login_date = models.DateTimeField() failed_password_attempts = models.PositiveIntegerField() class Meta: - ordering = ['last_name', 'first_name', 'email'] + ordering = ['user'] class GameConfiguration(models.Model): game = models.ForeignKey(GameMetadata) |
From: <vir...@li...> - 2010-07-21 21:29:32
|
Subject: hg.virtualcommons 17 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/ce742d1a5222 changeset: 17:ce742d1a5222 user: alllee date: Wed Jul 21 14:26:43 2010 -0700 description: test stub for forestry app diffstat: vcweb/forestry/tests.py | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diffs (27 lines): diff -r 35fa31ff8df0 -r ce742d1a5222 vcweb/forestry/tests.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/forestry/tests.py Wed Jul 21 14:26:43 2010 -0700 @@ -0,0 +1,23 @@ +""" +This file demonstrates two different styles of tests (one doctest and one +unittest). These will both pass when you run "manage.py test". + +Replace these with more appropriate tests for your application. +""" + +from django.test import TestCase + +class SimpleTest(TestCase): + def test_basic_addition(self): + """ + Tests that 1 + 1 always equals 2. + """ + self.failUnlessEqual(1 + 1, 2) + +__test__ = {"doctest": """ +Another way to test that 1 + 1 is equal to 2. + +>>> 1 + 1 == 2 +True +"""} + |
From: <vir...@li...> - 2010-07-21 21:29:32
|
Subject: hg.virtualcommons 16 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/35fa31ff8df0 changeset: 16:35fa31ff8df0 user: alllee date: Wed Jul 21 14:26:03 2010 -0700 description: django / python module init |
From: <vir...@li...> - 2010-07-16 05:43:17
|
Subject: hg.virtualcommons 14 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/e60687705f9e changeset: 14:e60687705f9e user: alllee date: Thu Jul 15 22:43:39 2010 -0700 description: forgot to include these files in the last commit diffstat: vcweb/core/templates/index.html | 30 ++++++++++++++++++++++++++++++ vcweb/core/urls.py | 13 +++++++++++++ 2 files changed, 43 insertions(+), 0 deletions(-) diffs (52 lines): diff -r 4b37101f5dd4 -r e60687705f9e vcweb/core/templates/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/index.html Thu Jul 15 22:43:39 2010 -0700 @@ -0,0 +1,30 @@ +{% extends "base_vcweb.html" %} + +{% block title %}Virtual Commons Web Experiment{% endblock %} + +{% block header %} +<div id='menu'> + <ul> + <li class='current_page_item'><a href='/' class='first'>Home</a></li> + <li><a href='about/'>About</a></li> + <li><a class='external' href='http://commons.asu.edu/contact'>Contact us</a></li> + <li><a href='experimenter/'>Experimenters</a></li> + <li><a href='participate/'>Participate</a></li> + </ul> +</div> + + +{% endblock header %} + +{% block content %} +<div id='post'> + <h2 class='title'>Welcome</h2> + <div class='entry'> + Welcome to the Virtual Commons Web Environment, an open software initiative hosted at <a class='external' href='http://www.asu.edu'>Arizona State University</a>. + We develop and support a variety of web-based collective action experiments. For more information, please visit + <a class='external' href='http://commons.asu.edu'>commons.asu.edu</a>. + </div> + +</div> +{% endblock content %} + diff -r 4b37101f5dd4 -r e60687705f9e vcweb/core/urls.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/urls.py Thu Jul 15 22:43:39 2010 -0700 @@ -0,0 +1,13 @@ +from django.conf.urls.defaults import * +''' +Created on Jul 14, 2010 + +@author: alllee +''' +urlpatterns = patterns('vcweb.core.views', + ('^$', 'index'), + (r'list/$', 'list'), + (r'configure/$', 'configure'), + (r'') + +) \ No newline at end of file |
From: <vir...@li...> - 2010-07-16 05:30:36
|
Subject: hg.virtualcommons 13 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/4b37101f5dd4 changeset: 13:4b37101f5dd4 user: alllee date: Thu Jul 15 22:30:51 2010 -0700 description: first cut at utilizing blueprint + the guarantee CSS template from freecsstemplates.org moved media to static and also adding LOCAL_DEVELOPMENT to settings.py diffstat: .hgignore | 1 + vcweb/core/templates/base_vcweb.html | 60 +- vcweb/core/views.py | 6 +- vcweb/media/css/style.css | 422 -------- vcweb/media/images/Logo3.png | 0 vcweb/media/images/Picture10.jpg | 0 vcweb/media/images/TreeLess.jpg | 0 vcweb/media/images/ViewResult.png | 0 vcweb/media/images/bg-header.png | 0 vcweb/media/images/bg-main-corner-sprite.png | 0 vcweb/media/images/bg-main.png | 0 vcweb/media/images/bg-maintrial.png | 0 vcweb/media/images/body.jpg | 0 vcweb/media/images/livesearchbghilight.jpg | 0 vcweb/media/images/loading.gif | 0 vcweb/media/images/tree4.JPG | 0 vcweb/media/images/trees.jpg | 0 vcweb/media/js/jquery-1.4.2.min.js | 154 --- vcweb/settings.py | 7 +- vcweb/static/css/blueprint/ie.css | 35 + vcweb/static/css/blueprint/plugins/buttons/icons/cross.png | 0 vcweb/static/css/blueprint/plugins/buttons/icons/key.png | 0 vcweb/static/css/blueprint/plugins/buttons/icons/tick.png | 0 vcweb/static/css/blueprint/plugins/buttons/readme.txt | 32 + vcweb/static/css/blueprint/plugins/buttons/screen.css | 97 ++ vcweb/static/css/blueprint/plugins/fancy-type/readme.txt | 14 + vcweb/static/css/blueprint/plugins/fancy-type/screen.css | 71 + vcweb/static/css/blueprint/plugins/link-icons/icons/doc.png | 0 vcweb/static/css/blueprint/plugins/link-icons/icons/email.png | 0 vcweb/static/css/blueprint/plugins/link-icons/icons/external.png | 0 vcweb/static/css/blueprint/plugins/link-icons/icons/feed.png | 0 vcweb/static/css/blueprint/plugins/link-icons/icons/im.png | 0 vcweb/static/css/blueprint/plugins/link-icons/icons/pdf.png | 0 vcweb/static/css/blueprint/plugins/link-icons/icons/visited.png | 0 vcweb/static/css/blueprint/plugins/link-icons/icons/xls.png | 0 vcweb/static/css/blueprint/plugins/link-icons/readme.txt | 18 + vcweb/static/css/blueprint/plugins/link-icons/screen.css | 40 + vcweb/static/css/blueprint/plugins/rtl/readme.txt | 10 + vcweb/static/css/blueprint/plugins/rtl/screen.css | 110 ++ vcweb/static/css/blueprint/print.css | 29 + vcweb/static/css/blueprint/screen.css | 258 +++++ vcweb/static/css/blueprint/src/forms.css | 65 + vcweb/static/css/blueprint/src/grid.css | 280 +++++ vcweb/static/css/blueprint/src/grid.png | 0 vcweb/static/css/blueprint/src/ie.css | 76 + vcweb/static/css/blueprint/src/print.css | 85 + vcweb/static/css/blueprint/src/reset.css | 45 + vcweb/static/css/blueprint/src/typography.css | 106 ++ vcweb/static/css/guarantee/images/img01.gif | 0 vcweb/static/css/guarantee/images/img02.gif | 0 vcweb/static/css/guarantee/images/img03.gif | 0 vcweb/static/css/guarantee/images/img04.gif | 0 vcweb/static/css/guarantee/images/img05.gif | 0 vcweb/static/css/guarantee/images/img06.gif | 0 vcweb/static/css/guarantee/images/img07.gif | 0 vcweb/static/css/guarantee/images/img08.gif | 0 vcweb/static/css/guarantee/license.txt | 63 + vcweb/static/css/guarantee/style.css | 470 ++++++++++ vcweb/static/images/external.png | 0 vcweb/static/images/guarantee/img01.gif | 0 vcweb/static/images/guarantee/img02.gif | 0 vcweb/static/images/guarantee/img03.gif | 0 vcweb/static/images/guarantee/img04.gif | 0 vcweb/static/images/guarantee/img05.gif | 0 vcweb/static/images/guarantee/img06.gif | 0 vcweb/static/images/guarantee/img07.gif | 0 vcweb/static/images/guarantee/img08.gif | 0 vcweb/static/js/jquery-1.4.2.min.js | 154 +++ vcweb/urls.py | 18 +- 69 files changed, 2114 insertions(+), 612 deletions(-) diffs (2991 lines): diff -r 3a4032b7c076 -r 4b37101f5dd4 .hgignore --- a/.hgignore Tue Jul 13 22:50:26 2010 -0700 +++ b/.hgignore Thu Jul 15 22:30:51 2010 -0700 @@ -3,3 +3,4 @@ *.pyc *~ settings_local.py +vcweb.db diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/core/templates/base_vcweb.html --- a/vcweb/core/templates/base_vcweb.html Tue Jul 13 22:50:26 2010 -0700 +++ b/vcweb/core/templates/base_vcweb.html Thu Jul 15 22:30:51 2010 -0700 @@ -1,41 +1,53 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +{% block head %} <head> <title>{% block title %}Virtual Commons Web Experiment{% endblock %}</title> -<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> -<link href="/static/media/css/style.css" rel="stylesheet" type="text/css" /> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link rel="stylesheet" href="/static/css/blueprint/screen.css" type="text/css" media="screen, projection"> +<link rel="stylesheet" href="/static/css/blueprint/print.css" type="text/css" media="print"> +<!--[if lt IE 8]><link rel="stylesheet" href="/static/media/css/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> +<link href="/static/css/guarantee/style.css" rel="stylesheet" type="text/css" media="screen" /> </head> +{% endblock %} <body> + <div id='logo'> + <h1>{% block logo %}The Virtual Commons Web Environment{% endblock %}</h1> + </div> + + <hr/> + + <div id='header'> + {% block header %} + {% endblock %} + </div> -<div id='header'> -{% block header %} +<div id='page'> + <div id="content"> + {% block content %} -{% endblock %} -</div> + {% endblock %} + </div> -<div id="content"> - {% block content %} - {% endblock %} + <div style='clear: both;'> </div> + <!-- end #page --> </div> <div id="footer"> -{% block footer %} -<small> -<p align="right"><a href='http://shesc.asu.edu'>School of Human Evolution and Social Change</a> <br /> -<a href='http://csid.asu.edu'>Center for the Study of Institutional Diversity</a> <br /> - -The project is funded by the <a href='http://nsf.gov'>National Science Foundation</a><sup>*</sup> and <a href='http://www.asu.edu'>Arizona -State University</a>.<br /> -<br /> - -<sup>*</sup>Any opinions, findings, conclusions or recommendations -expressed in this material are those of the authors and do not -necessarily reflect the views of the National Science Foundation.</p> -</small> -{% endblock %} + {% block footer %} + <p> + <a href='http://shesc.asu.edu'>School of Human Evolution and Social Change</a> <br /> + <a href='http://csid.asu.edu'>Center for the Study of Institutional Diversity</a> + </p> + <p class='legal'> + Copyright (c) 2010 Arizona Board of Regents. Design adapted from <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.<br/> + This project is funded by the <a href='http://nsf.gov'>National Science Foundation</a> and <a href='http://www.asu.edu'>Arizona State University</a>. + <br /> + </p> + {% endblock footer %} </div> </body> diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/core/views.py --- a/vcweb/core/views.py Tue Jul 13 22:50:26 2010 -0700 +++ b/vcweb/core/views.py Thu Jul 15 22:30:51 2010 -0700 @@ -3,8 +3,8 @@ from django.template import Context, loader -def home(request): - t = loader.get_template('base_participant.html') +def index(request): + t = loader.get_template('index.html') c = Context({ 'main': "Welcome!", 'username':"foo", @@ -19,7 +19,7 @@ }) return HttpResponse(t.render(c)) -def config(request): +def configure(request): t = loader.get_template('base_participant.html') c = Context({ 'main': "configuration of the experiment!", diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/css/style.css --- a/vcweb/media/css/style.css Tue Jul 13 22:50:26 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,429 +0,0 @@ -/*---------------------------------------------------------- -The base color for this template is #5c87b2. If you'd like -to use a different color start by replacing all instances of -#5c87b2 with your new color. -----------------------------------------------------------*/ -body -{ - background-color: #82d2f5; - font-size: .75em; - font-family: Verdana, Helvetica, Sans-Serif; - margin: 0; - padding: 0; - /*color:#696969; - background-image:url(images/body.jpg); - background-repeat:repeat;*/ -} - -a:link -{ - color: #034af3; - text-decoration:none; -} -a:visited -{ - color: #505abc; -} -a:hover -{ - color: #1d60ff; - text-decoration: none; -} -a:active -{ - color: #12eb87; -} - -p, ul -{ - margin-bottom: 20px; - line-height: 1.6em; -} - -/* HEADINGS -----------------------------------------------------------*/ -h1, h2, h3, h4, h5, h6 -{ - font-size: 1.5em; - color: #000; - font-family: Arial, Helvetica, sans-serif; -} - -h1 -{ - font-size: 2em; - padding-bottom: 0; - margin-bottom: 0; -} -h2 -{ - padding: 0 0 10px 0; -} -h3 -{ - font-size: 1.2em; -} -h4 -{ - font-size: 1.1em; -} -h5, h6 -{ - font-size: 1em; -} - -/* this rule styles <h2> tags that are the -first child of the left and right table columns */ -.rightColumn > h1, .rightColumn > h2, .leftColumn > h1, .leftColumn > h2 -{ - margin-top: 0; -} - -/* PRIMARY LAYOUT ELEMENTS -----------------------------------------------------------*/ - -/* you can specify a greater or lesser percentage for the -page width. Or, you can specify an exact pixel width. */ -.page -{ - width: 90%; - margin-left: auto; - margin-right: auto; -} - -#header -{ - position: relative; - margin-bottom: 0px; - /*background-image:url('images/bg-header.png');*/ - background-color:Green; - padding: 0; - height:131px; - /*position:relative; - margin:0; - - color:#000; - padding:0 0 0 0; - width:950px; - background:url('images/bg-header.png') no-repeat right top; - height:131px;*/ - -} - -#header h1 -{ - font-weight: bold; - /*padding: 5px 0;*/ - margin: 0; - color: #fff; - border: none; - /*line-height: 2em;*/ - font-family: Arial, Helvetica, sans-serif; - font-size: 32px !important; -} - -/*#main -{ - padding: 30px 30px 15px 30px; - background-attachment:fixed; - background-color:#82d2f5; - background-image:url('images/bg-main.png'); - background-position:top; - background-repeat:no-repeat; - margin-bottom: 10px; - margin-top: 0px; - margin-left: 0px; - margin-right: 0px; - text-align:center; - _height: 1px; /* only IE6 applies CSS properties starting with an underscrore -}*/ - -#main -{ - padding:30px 30px 15px 30px; - background:#fff url('images/bg-main-corner-sprite.png') no-repeat; - margin-bottom:30px; - _height:1px; - clear:both; - position:relative; - width:890px; - } - -#footer -{ - color: #999; - padding: 10px 0; - text-align: center; - line-height: normal; - margin: 0; - font-size: .9em; - -} - -/* TAB MENU -----------------------------------------------------------*/ -ul#menu -{ - border-bottom: 1px #5C87B2 solid; - padding: 0 0 2px; - position: relative; - margin: 0; - text-align: right; -} - -ul#menu li -{ - display: inline; - list-style: none; -} - -ul#menu li#greeting -{ - padding: 10px 20px; - font-weight: bold; - text-decoration: none; - line-height: 2.8em; - color: #fff; -} - -ul#menu li a -{ - padding: 10px 20px; - font-weight: bold; - text-decoration: none; - line-height: 2.8em; - background-color: #e8eef4; - color: #034af3; -} - -ul#menu li a:hover -{ - background-color: #fff; - text-decoration: none; -} - -ul#menu li a:active -{ - background-color: #a6e2a6; - text-decoration: none; -} - -ul#menu li.selected a -{ - background-color: #fff; - color: #000; -} - -/* FORM LAYOUT ELEMENTS -----------------------------------------------------------*/ - -fieldset -{ - margin: 1em 0; - padding: 1em; - border: 1px solid #CCC; -} - -fieldset p -{ - margin: 2px 12px 10px 10px; -} - -fieldset label -{ - display: block; -} - -fieldset label.inline -{ - display: inline; -} - -legend -{ - font-size: 1.1em; - font-weight: 600; - padding: 2px 4px 8px 4px; -} - -input[type="text"] -{ - width: 200px; - border: 1px solid #CCC; -} - -input[type="password"] -{ - width: 200px; - border: 0px solid #CCC; -} - -/* TABLE -----------------------------------------------------------*/ - -table -{ - border: 1; - border-collapse: collapse; -} - -table.header -{ - - -} - -table td -{ - padding: 5px; - -} - -table th -{ - padding: 6px 5px; - text-align: left; - background-color: #e8eef4; - -} - -/* MISC -----------------------------------------------------------*/ -.clear -{ - clear: both; -} - -.error -{ - color:Red; -} - -#menucontainer -{ - margin-top:40px; -} - -div#title -{ - display:block; - float:left; - text-align:left; - margin-bottom:20px; -} - -#logindisplay -{ - font-size: 1.1em; - display: block; - text-align: right; - color:White; -} - -#logindisplay a:link -{ - color: #000000; - text-decoration: underline; -} - -#logindisplay a:visited -{ - color: white; - text-decoration: underline; -} - -#logindisplay a:hover -{ - color: white; - text-decoration: none; -} - -.field-validation-error -{ - color: #ff0000; -} - -.input-validation-error -{ - border: 1px solid #ff0000; - background-color: #ffeeee; -} - -.validation-summary-errors -{ - font-weight: bold; - color: #ff0000; -} - -.editor-label -{ - font-weight: bold; - color: #ff0000; - -} - -.editor-field -{ - font-weight: bold; - color: #ff0000; -} - -/* Start WIZARD */ -.stepNotCompleted -{ - background-color: rgb(153,153,153); - width: 15px; - border: 1px solid rgb(153,153,153); - margin-right: 5px; - color: White; - font-family: Arial; - font-size: 12px; - text-align: center; -} - -.stepCompleted -{ - background-color: #4d4d4d; - width: 15px; - border: 1px solid #4d4d4d; - color: White; - font-family: Arial; - font-size: 12px; - text-align: center; -} - -.stepCurrent -{ - background-color: #e01122; - width: 15px; - border: 1px solid #e01122; - color: White; - font-family: Arial; - font-size: 12px; - font-weight: bold; - text-align: center; -} - -.stepBreak -{ - width: 3px; - background-color: Transparent; -} - -.wizardProgress -{ - padding-right: 10px; - font-family: Arial; - color: #333333; - font-size: 12px; - -} - -.wizardTitle -{ - font-family: Arial; - font-size: 120%; - font-weight: bold; - color: #333333; - vertical-align: middle; -} diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/images/Logo3.png Binary file vcweb/media/images/Logo3.png has changed diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/images/Picture10.jpg Binary file vcweb/media/images/Picture10.jpg has changed diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/images/TreeLess.jpg Binary file vcweb/media/images/TreeLess.jpg has changed diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/images/ViewResult.png Binary file vcweb/media/images/ViewResult.png has changed diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/images/bg-header.png Binary file vcweb/media/images/bg-header.png has changed diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/images/bg-main-corner-sprite.png Binary file vcweb/media/images/bg-main-corner-sprite.png has changed diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/images/bg-main.png Binary file vcweb/media/images/bg-main.png has changed diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/images/bg-maintrial.png Binary file vcweb/media/images/bg-maintrial.png has changed diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/images/body.jpg Binary file vcweb/media/images/body.jpg has changed diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/images/livesearchbghilight.jpg Binary file vcweb/media/images/livesearchbghilight.jpg has changed diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/images/loading.gif Binary file vcweb/media/images/loading.gif has changed diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/images/tree4.JPG Binary file vcweb/media/images/tree4.JPG has changed diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/images/trees.jpg Binary file vcweb/media/images/trees.jpg has changed diff -r 3a4032b7c076 -r 4b37101f5dd4 vcweb/media/js/jquery-1.4.2.min.js --- a/vcweb/media/js/jquery-1.4.2.min.js Tue Jul 13 22:50:26 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ -/*! - * jQuery JavaScript Library v1.4.2 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Sat Feb 13 22:33:48 2010 -0500 - */ -(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i? -e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r= -j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g, -"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e= -true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, -Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& -(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, -a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== -"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, -function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)|| -c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded", -L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype, -"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+ -a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f], -d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]=== -a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&& -!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari= -true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; -var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, -parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= -false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= -s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, -applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; -else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, -a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== -w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, -cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ", -i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ", -" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className= -this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i= -e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= -c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); -a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, -function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); -k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), -C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!= -null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type= -e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& -f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; -if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), -fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop|| -d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this, -"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent= -a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y, -isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit= -{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}}; -if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", -e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, -"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, -d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&& -!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}}, -toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector, -u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "), -function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q]; -if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, -e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); -t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| -g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[]; -for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length- -1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, -CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}}, -relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]= -l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[]; -h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, -CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, -g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, -text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, -setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= -h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m= -m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== -"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, -h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition|| -!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m= -h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& -q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>"; -if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); -(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: -function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/, -gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length; -c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= -{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e... [truncated message content] |
From: <vir...@li...> - 2010-07-14 05:50:18
|
Subject: hg.virtualcommons 12 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/3a4032b7c076 changeset: 12:3a4032b7c076 user: alllee date: Tue Jul 13 22:50:26 2010 -0700 description: adding static css / images from Seema's Master's thesis and starting base templates for custom experiments. Many modifications to come. Look into using blueprintcss or something similar to handle CSS. diffstat: vcweb/core/models.py | 11 + vcweb/core/templates/base_experimenter.html | 42 ++ vcweb/core/templates/base_participant.html | 26 + vcweb/core/templates/base_vcweb.html | 43 ++ vcweb/core/views.py | 27 + vcweb/media/css/style.css | 429 +++++++++++++++++++++++++++ vcweb/media/images/Logo3.png | 0 vcweb/media/images/Picture10.jpg | 0 vcweb/media/images/TreeLess.jpg | 0 vcweb/media/images/ViewResult.png | 0 vcweb/media/images/bg-header.png | 0 vcweb/media/images/bg-main-corner-sprite.png | 0 vcweb/media/images/bg-main.png | 0 vcweb/media/images/bg-maintrial.png | 0 vcweb/media/images/body.jpg | 0 vcweb/media/images/livesearchbghilight.jpg | 0 vcweb/media/images/loading.gif | 0 vcweb/media/images/tree4.JPG | 0 vcweb/media/images/trees.jpg | 0 vcweb/media/js/jquery-1.4.2.min.js | 154 +++++++++ vcweb/settings.py | 7 + vcweb/urls.py | 12 +- 22 files changed, 749 insertions(+), 2 deletions(-) diffs (848 lines): diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/core/models.py --- a/vcweb/core/models.py Tue Jul 13 14:52:29 2010 -0700 +++ b/vcweb/core/models.py Tue Jul 13 22:50:26 2010 -0700 @@ -196,6 +196,17 @@ class Meta: ordering = [ 'parameter' ] + +class Session(models.Model): + login_time = models.DateTimeField(auto_now_add=True) + logout_time = models.DateTimeField() + +class ExperimenterSession(Session): + experimenter_id = models.ForeignKey(Experimenter) + +class ParticipantSession(Session): + participant_id = models.ForeignKey(Participant) + diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/core/templates/base_experimenter.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/base_experimenter.html Tue Jul 13 22:50:26 2010 -0700 @@ -0,0 +1,42 @@ +{% extends "base_vcweb.html" %} + +{% block title %} Virtual Commons Web Experimenter Interface {% endblock %} + +{% block header %} +<div id="masthead"> +<table width="100%" + style="background-color: #9ACD32; background-repeat: no-repeat;" + border="0"> + <tr> + <th align="left" valign="top" style="background-color: #9ACD32;"> + <img height="35" alt="imageTree" src="/static/images/Logo3.png/" /></th> + <th align="right" valign="top"><b style="color:purple; margin-right:10px;">{{username}}</b></th> + </tr> +</table> +</div> + + +<div id="top_nav"> +<table> + <tr> + <td align="left"></td> + <td align="center"><a href="/games/" style="color: yellow"> <b>Home</b></a> + </td> + <td align="center"><a href="/games/config" style="color: yellow"><b>Create</b></a> + </td> + <td align="center"><a href="/games/list" style="color: yellow"><b>List</b></a> + </td> + </tr> +</table> +</div> +{% endblock header %} + +{% block content %} +<div id="page_content"> +<p> +This is the base for the experimenter interface. +</p> +</div> + +{% endblock content %} + diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/core/templates/base_participant.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/base_participant.html Tue Jul 13 22:50:26 2010 -0700 @@ -0,0 +1,26 @@ +{% extends "base_vcweb.html" %} + +{% block title %}Virtual Commons Web Participant Interface{% endblock %} + +{% block header %} +<div id="masthead"> +<table width="100%" + style="background-color: #9ACD32; background-repeat: no-repeat;" + border="0"> + <tr> + <th align="left" valign="top" style="background-color: #9ACD32;"> + <img height="35" alt="imageTree" src="/static/images/Logo3.png/" /></th> + <th align="right" valign="bottom"><b style="color:purple; margin-right:10px;">{{username}}</b></th> + </tr> +</table> +</div> + +{% endblock header %} + +{% block content %} +<div id="page_content"> +<p> +The base participant interface, will be customized for each experiment. +</p> +</div> +{% endblock content %} diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/core/templates/base_vcweb.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/core/templates/base_vcweb.html Tue Jul 13 22:50:26 2010 -0700 @@ -0,0 +1,43 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + +<head> +<title>{% block title %}Virtual Commons Web Experiment{% endblock %}</title> +<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> +<link href="/static/media/css/style.css" rel="stylesheet" type="text/css" /> +</head> + +<body> + +<div id='header'> +{% block header %} + +{% endblock %} +</div> + +<div id="content"> + {% block content %} + + {% endblock %} +</div> + +<div id="footer"> +{% block footer %} +<small> +<p align="right"><a href='http://shesc.asu.edu'>School of Human Evolution and Social Change</a> <br /> +<a href='http://csid.asu.edu'>Center for the Study of Institutional Diversity</a> <br /> + +The project is funded by the <a href='http://nsf.gov'>National Science Foundation</a><sup>*</sup> and <a href='http://www.asu.edu'>Arizona +State University</a>.<br /> +<br /> + +<sup>*</sup>Any opinions, findings, conclusions or recommendations +expressed in this material are those of the authors and do not +necessarily reflect the views of the National Science Foundation.</p> +</small> +{% endblock %} +</div> + +</body> + +</html> diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/core/views.py --- a/vcweb/core/views.py Tue Jul 13 14:52:29 2010 -0700 +++ b/vcweb/core/views.py Tue Jul 13 22:50:26 2010 -0700 @@ -1,1 +1,28 @@ # Create your views here. +from django.http import HttpResponse +from django.template import Context, loader + + +def home(request): + t = loader.get_template('base_participant.html') + c = Context({ + 'main': "Welcome!", + 'username':"foo", + }) + return HttpResponse(t.render(c)) + +def list(request): + t = loader.get_template('base_experimenter.html') + c = Context({ + 'main': "List of experiments!", + 'username':"foo", + }) + return HttpResponse(t.render(c)) + +def config(request): + t = loader.get_template('base_participant.html') + c = Context({ + 'main': "configuration of the experiment!", + 'username':"foo", + }) + return HttpResponse(t.render(c)) \ No newline at end of file diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/css/style.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/media/css/style.css Tue Jul 13 22:50:26 2010 -0700 @@ -0,0 +1,429 @@ +/*---------------------------------------------------------- +The base color for this template is #5c87b2. If you'd like +to use a different color start by replacing all instances of +#5c87b2 with your new color. +----------------------------------------------------------*/ +body +{ + background-color: #82d2f5; + font-size: .75em; + font-family: Verdana, Helvetica, Sans-Serif; + margin: 0; + padding: 0; + /*color:#696969; + background-image:url(images/body.jpg); + background-repeat:repeat;*/ +} + +a:link +{ + color: #034af3; + text-decoration:none; +} +a:visited +{ + color: #505abc; +} +a:hover +{ + color: #1d60ff; + text-decoration: none; +} +a:active +{ + color: #12eb87; +} + +p, ul +{ + margin-bottom: 20px; + line-height: 1.6em; +} + +/* HEADINGS +----------------------------------------------------------*/ +h1, h2, h3, h4, h5, h6 +{ + font-size: 1.5em; + color: #000; + font-family: Arial, Helvetica, sans-serif; +} + +h1 +{ + font-size: 2em; + padding-bottom: 0; + margin-bottom: 0; +} +h2 +{ + padding: 0 0 10px 0; +} +h3 +{ + font-size: 1.2em; +} +h4 +{ + font-size: 1.1em; +} +h5, h6 +{ + font-size: 1em; +} + +/* this rule styles <h2> tags that are the +first child of the left and right table columns */ +.rightColumn > h1, .rightColumn > h2, .leftColumn > h1, .leftColumn > h2 +{ + margin-top: 0; +} + +/* PRIMARY LAYOUT ELEMENTS +----------------------------------------------------------*/ + +/* you can specify a greater or lesser percentage for the +page width. Or, you can specify an exact pixel width. */ +.page +{ + width: 90%; + margin-left: auto; + margin-right: auto; +} + +#header +{ + position: relative; + margin-bottom: 0px; + /*background-image:url('images/bg-header.png');*/ + background-color:Green; + padding: 0; + height:131px; + /*position:relative; + margin:0; + + color:#000; + padding:0 0 0 0; + width:950px; + background:url('images/bg-header.png') no-repeat right top; + height:131px;*/ + +} + +#header h1 +{ + font-weight: bold; + /*padding: 5px 0;*/ + margin: 0; + color: #fff; + border: none; + /*line-height: 2em;*/ + font-family: Arial, Helvetica, sans-serif; + font-size: 32px !important; +} + +/*#main +{ + padding: 30px 30px 15px 30px; + background-attachment:fixed; + background-color:#82d2f5; + background-image:url('images/bg-main.png'); + background-position:top; + background-repeat:no-repeat; + margin-bottom: 10px; + margin-top: 0px; + margin-left: 0px; + margin-right: 0px; + text-align:center; + _height: 1px; /* only IE6 applies CSS properties starting with an underscrore +}*/ + +#main +{ + padding:30px 30px 15px 30px; + background:#fff url('images/bg-main-corner-sprite.png') no-repeat; + margin-bottom:30px; + _height:1px; + clear:both; + position:relative; + width:890px; + } + +#footer +{ + color: #999; + padding: 10px 0; + text-align: center; + line-height: normal; + margin: 0; + font-size: .9em; + +} + +/* TAB MENU +----------------------------------------------------------*/ +ul#menu +{ + border-bottom: 1px #5C87B2 solid; + padding: 0 0 2px; + position: relative; + margin: 0; + text-align: right; +} + +ul#menu li +{ + display: inline; + list-style: none; +} + +ul#menu li#greeting +{ + padding: 10px 20px; + font-weight: bold; + text-decoration: none; + line-height: 2.8em; + color: #fff; +} + +ul#menu li a +{ + padding: 10px 20px; + font-weight: bold; + text-decoration: none; + line-height: 2.8em; + background-color: #e8eef4; + color: #034af3; +} + +ul#menu li a:hover +{ + background-color: #fff; + text-decoration: none; +} + +ul#menu li a:active +{ + background-color: #a6e2a6; + text-decoration: none; +} + +ul#menu li.selected a +{ + background-color: #fff; + color: #000; +} + +/* FORM LAYOUT ELEMENTS +----------------------------------------------------------*/ + +fieldset +{ + margin: 1em 0; + padding: 1em; + border: 1px solid #CCC; +} + +fieldset p +{ + margin: 2px 12px 10px 10px; +} + +fieldset label +{ + display: block; +} + +fieldset label.inline +{ + display: inline; +} + +legend +{ + font-size: 1.1em; + font-weight: 600; + padding: 2px 4px 8px 4px; +} + +input[type="text"] +{ + width: 200px; + border: 1px solid #CCC; +} + +input[type="password"] +{ + width: 200px; + border: 0px solid #CCC; +} + +/* TABLE +----------------------------------------------------------*/ + +table +{ + border: 1; + border-collapse: collapse; +} + +table.header +{ + + +} + +table td +{ + padding: 5px; + +} + +table th +{ + padding: 6px 5px; + text-align: left; + background-color: #e8eef4; + +} + +/* MISC +----------------------------------------------------------*/ +.clear +{ + clear: both; +} + +.error +{ + color:Red; +} + +#menucontainer +{ + margin-top:40px; +} + +div#title +{ + display:block; + float:left; + text-align:left; + margin-bottom:20px; +} + +#logindisplay +{ + font-size: 1.1em; + display: block; + text-align: right; + color:White; +} + +#logindisplay a:link +{ + color: #000000; + text-decoration: underline; +} + +#logindisplay a:visited +{ + color: white; + text-decoration: underline; +} + +#logindisplay a:hover +{ + color: white; + text-decoration: none; +} + +.field-validation-error +{ + color: #ff0000; +} + +.input-validation-error +{ + border: 1px solid #ff0000; + background-color: #ffeeee; +} + +.validation-summary-errors +{ + font-weight: bold; + color: #ff0000; +} + +.editor-label +{ + font-weight: bold; + color: #ff0000; + +} + +.editor-field +{ + font-weight: bold; + color: #ff0000; +} + +/* Start WIZARD */ +.stepNotCompleted +{ + background-color: rgb(153,153,153); + width: 15px; + border: 1px solid rgb(153,153,153); + margin-right: 5px; + color: White; + font-family: Arial; + font-size: 12px; + text-align: center; +} + +.stepCompleted +{ + background-color: #4d4d4d; + width: 15px; + border: 1px solid #4d4d4d; + color: White; + font-family: Arial; + font-size: 12px; + text-align: center; +} + +.stepCurrent +{ + background-color: #e01122; + width: 15px; + border: 1px solid #e01122; + color: White; + font-family: Arial; + font-size: 12px; + font-weight: bold; + text-align: center; +} + +.stepBreak +{ + width: 3px; + background-color: Transparent; +} + +.wizardProgress +{ + padding-right: 10px; + font-family: Arial; + color: #333333; + font-size: 12px; + +} + +.wizardTitle +{ + font-family: Arial; + font-size: 120%; + font-weight: bold; + color: #333333; + vertical-align: middle; +} diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/images/Logo3.png Binary file vcweb/media/images/Logo3.png has changed diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/images/Picture10.jpg Binary file vcweb/media/images/Picture10.jpg has changed diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/images/TreeLess.jpg Binary file vcweb/media/images/TreeLess.jpg has changed diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/images/ViewResult.png Binary file vcweb/media/images/ViewResult.png has changed diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/images/bg-header.png Binary file vcweb/media/images/bg-header.png has changed diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/images/bg-main-corner-sprite.png Binary file vcweb/media/images/bg-main-corner-sprite.png has changed diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/images/bg-main.png Binary file vcweb/media/images/bg-main.png has changed diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/images/bg-maintrial.png Binary file vcweb/media/images/bg-maintrial.png has changed diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/images/body.jpg Binary file vcweb/media/images/body.jpg has changed diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/images/livesearchbghilight.jpg Binary file vcweb/media/images/livesearchbghilight.jpg has changed diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/images/loading.gif Binary file vcweb/media/images/loading.gif has changed diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/images/tree4.JPG Binary file vcweb/media/images/tree4.JPG has changed diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/images/trees.jpg Binary file vcweb/media/images/trees.jpg has changed diff -r 1f4cffa8649f -r 3a4032b7c076 vcweb/media/js/jquery-1.4.2.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vcweb/media/js/jquery-1.4.2.min.js Tue Jul 13 22:50:26 2010 -0700 @@ -0,0 +1,154 @@ +/*! + * jQuery JavaScript Library v1.4.2 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Sat Feb 13 22:33:48 2010 -0500 + */ +(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i? +e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r= +j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g, +"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e= +true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, +Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& +(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, +a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== +"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, +function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)|| +c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded", +L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype, +"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+ +a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f], +d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]=== +a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&& +!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari= +true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; +var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, +parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= +false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= +s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, +applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; +else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, +a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== +w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, +cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ", +i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ", +" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className= +this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i= +e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, +function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); +k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), +C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!= +null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type= +e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& +f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; +if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), +fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop|| +d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this, +"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent= +a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y, +isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit= +{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}}; +if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", +e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, +"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, +d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&& +!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}}, +toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector, +u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "), +function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q]; +if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); +t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| +g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[]; +for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length- +1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, +CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}}, +relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]= +l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[]; +h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= +h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m= +m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition|| +!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m= +h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& +q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>"; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: +function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/, +gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length; +c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= +{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)? +a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>"... [truncated message content] |
From: <vir...@li...> - 2010-07-13 21:52:15
|
Subject: hg.virtualcommons 11 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/1f4cffa8649f changeset: 11:1f4cffa8649f user: alllee date: Tue Jul 13 14:52:29 2010 -0700 description: removing platform-specific pydevproject paths (should maybe remove eclipse metadata from source control entirely) diffstat: .pydevproject | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diffs (12 lines): diff -r b241d176bef2 -r 1f4cffa8649f .pydevproject --- a/.pydevproject Sun Jul 11 23:24:47 2010 -0700 +++ b/.pydevproject Tue Jul 13 14:52:29 2010 -0700 @@ -11,7 +11,5 @@ <pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> <path>/vcweb</path> </pydev_pathproperty> -<pydev_pathproperty name="org.python.pydev.PROJECT_EXTERNAL_SOURCE_PATH"> -<path>/usr/local/lib/python2.6</path> -</pydev_pathproperty> + </pydev_project> |
From: <al...@us...> - 2010-07-13 06:06:44
|
Revision: 523 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=523&view=rev Author: alllee Date: 2010-07-13 06:06:37 +0000 (Tue, 13 Jul 2010) Log Message: ----------- adding assigned number to client summary data Modified Paths: -------------- foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java 2010-06-30 19:17:48 UTC (rev 522) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java 2010-07-13 06:06:37 UTC (rev 523) @@ -7,6 +7,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; @@ -216,6 +218,7 @@ public void validate() { int sum = 0; for (int i = 0; i < movementDistribution.length; i++) { + // i+1 to offset zero-based array index sum += ((i+1) * movementDistribution[i]); } if (allMoves != sum) { @@ -407,8 +410,15 @@ for (GroupDataModel group: groups) { int totalConsumedGroupTokens = 0; ArrayList<String> clientTokens = new ArrayList<String>(); - for (ClientData data : group.getClientDataMap().values()) { - clientTokens.add(String.format("%s, %s", data.getId(), data.getTotalTokens())); + ArrayList<ClientData> clientDataList = new ArrayList<ClientData>(group.getClientDataMap().values()); + Collections.sort(clientDataList, new Comparator<ClientData>() { + @Override + public int compare(ClientData a, ClientData b) { + return Integer.valueOf(a.getAssignedNumber()).compareTo(b.getAssignedNumber()); + } + }); + for (ClientData data : clientDataList) { + clientTokens.add(String.format("%s, %s, %s", data.getId(), data.getAssignedNumber(), data.getTotalTokens())); totalConsumedGroupTokens += data.getTotalTokens(); } writer.println( @@ -420,18 +430,11 @@ Utils.join(',', group.getResourceDistribution().keySet()) )); } - // FIXME: should update later once we fix rolling chat logs. Map<GroupDataModel, SortedSet<ChatRequest>> chatRequestMap = new HashMap<GroupDataModel, SortedSet<ChatRequest>>(); SortedSet<ChatRequest> allChatRequests = savedRoundData.getChatRequests(); if (! allChatRequests.isEmpty()) { ChatRequest first = allChatRequests.first(); for (ChatRequest request: savedRoundData.getChatRequests()) { - // FIXME: hack to deal with rolling chat logs, eventually should only have per-round chat requests - // in savedRoundData. - // if (request.getCreationTime() < lastCreationTime) { - // continue; - // } - GroupDataModel group = serverDataModel.getGroup(request.getSource()); if (chatRequestMap.containsKey(group)) { chatRequestMap.get(group).add(request); @@ -442,12 +445,6 @@ chatRequestMap.put(group, chatRequests); } } - // FIXME: hack to deal with rolling chat logs - // set last creation time to the last chat request that occurred so in the next chat round - // we'll know if we repeated a chat request. - // ChatRequest last = allChatRequests.last(); - // lastCreationTime = last.getCreationTime(); - // System.err.println("last creation time: " + lastCreationTime + " - " + last); for (GroupDataModel group: groups) { SortedSet<ChatRequest> chatRequests = chatRequestMap.get(group); if (chatRequests != null) { @@ -462,7 +459,6 @@ } @Override public String getOutputFileExtension() { - // TODO Auto-generated method stub return "-summary.txt"; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: seema t. <see...@gm...> - 2010-07-12 18:41:02
|
Hello, Started Work at 11:15am. Seema |