virtualcommons-svn Mailing List for Virtual Commons Experiment Software (Page 34)
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...> - 2011-04-18 22:32:16
|
Subject: hg.virtualcommons 345 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/12fa43dbafb1 changeset: 345:12fa43dbafb1 user: Allen Lee <all...@as...> date: Mon Apr 18 15:32:59 2011 -0700 description: sending chat messages to experiment monitor and JS hygiene, moving common methods to common.js diffstat: vcweb/core/templates/base.html | 3 +- vcweb/core/templates/experimenter/monitor.html | 17 ++++---- vcweb/core/templates/experimenter/register-participants.html | 1 - vcweb/core/templates/registration/login.html | 1 - vcweb/core/templates/registration/register.html | 1 - vcweb/forestry/models.py | 35 ++++++++--------- vcweb/forestry/templates/forestry/chat.html | 14 ++++-- vcweb/forestry/templates/forestry/participate.html | 1 - vcweb/settings.py | 13 ++++++- vcweb/static/css/style.css | 3 +- vcweb/static/js/common.js | 13 ++++++ vcweb/vcweb-tornadio.py | 5 ++- 12 files changed, 67 insertions(+), 40 deletions(-) diffs (316 lines): diff -r 531274702cd9 -r 12fa43dbafb1 vcweb/core/templates/base.html --- a/vcweb/core/templates/base.html Mon Apr 18 11:51:33 2011 -0700 +++ b/vcweb/core/templates/base.html Mon Apr 18 15:32:59 2011 -0700 @@ -18,9 +18,10 @@ {% dajaxice_js_import %} <!-- <script type='/text/javascript' src='{{STATIC_URL}}js/dajaxice.core.js'></script> --> <script type='text/javascript'> - <!-- sets all external links to open up in new windows --> + <!-- sets all external links to open up in new windows and jquery-ui buttonifies all buttons--> $(function() { $('a.external').attr({ target: "_blank" }); + $('button').button(); }); </script> {% endblock %} diff -r 531274702cd9 -r 12fa43dbafb1 vcweb/core/templates/experimenter/monitor.html --- a/vcweb/core/templates/experimenter/monitor.html Mon Apr 18 11:51:33 2011 -0700 +++ b/vcweb/core/templates/experimenter/monitor.html Mon Apr 18 15:32:59 2011 -0700 @@ -69,7 +69,7 @@ addExperimentMessage(json.message); break; case 'chat': - addExperimentMessage(json.message); + addChatMessage('chat-div-' + json.round_data_pk, json, json.date_created + " " + json.participant); break; case 'submit': $('#participant_data_value_' + json.participant_data_value_pk).html(json.message).effect("highlight", {}, 5000); @@ -200,7 +200,7 @@ {% for group_data_value in round_data.group_data_values.all %} <tr> <td> - <a class='tooltip' title='{{ group_data_value.group.all_participants_str }}'> + <a class='dark-yellow-highlight' title='{{ group_data_value.group.all_participants_str }}'> {{ group_data_value.group }} </a> </td> @@ -226,7 +226,7 @@ {% for participant_data_value in round_data.participant_data_values.all %} <tr> <td> - <a class='tooltip' title='{{participant_data_value.participant}}'> + <a class='dark-yellow-highlight' title='{{participant_data_value.participant}}'> {{ participant_data_value.participant_number }} ({{ participant_data_value.group }}) </a> </td> @@ -242,13 +242,12 @@ {% endif %} {% comment %} participant chats {% endcomment %} {% if round_data.chat_messages.count > 0 %} - <h4 class='collapsible'>Chat data (click to hide)</h4> - <div id='chat_{{round_data.pk}}' class='chat notice ui-corner-all'> + <h4 class='collapsible'>Chat data</h4> + <div id='chat-div-{{round_data.pk}}' class='chat notice ui-corner-all'> {% for chat_message in round_data.chat_messages.all %} - <div class='ui-state-highlight'> - <span class='icon-left ui-icon ui-icon-comment'></span> - <a class='tooltip' name='{{chat_message.pk}}' title='{{chat_message.date_created}} {{chat_message.participant}}'> - {{chat_message.date_created|date:"H:s"}}</a> | {{chat_message}} + <div class='ui-state-highlight' style='line-height: 1.5em;'> + <a class='dark-yellow-highlight' name='{{chat_message.pk}}' title='{{chat_message.date_created}} {{chat_message.participant}}'> + {{chat_message.date_created|date:"G:i:s"}}</a> | {{chat_message}} </div> {% endfor %} </div> diff -r 531274702cd9 -r 12fa43dbafb1 vcweb/core/templates/experimenter/register-participants.html --- a/vcweb/core/templates/experimenter/register-participants.html Mon Apr 18 11:51:33 2011 -0700 +++ b/vcweb/core/templates/experimenter/register-participants.html Mon Apr 18 15:32:59 2011 -0700 @@ -17,7 +17,6 @@ ); }); $('#id_experiment_pk').val({{experiment.pk}}); - $('button').button(); }); </script> {% endblock %} diff -r 531274702cd9 -r 12fa43dbafb1 vcweb/core/templates/registration/login.html --- a/vcweb/core/templates/registration/login.html Mon Apr 18 11:51:33 2011 -0700 +++ b/vcweb/core/templates/registration/login.html Mon Apr 18 15:32:59 2011 -0700 @@ -10,7 +10,6 @@ $(':input').addClass('required'); $('#loginForm').validate(); $('#id_email').focus(); - $('button').button(); }); </script> {% endblock head %} diff -r 531274702cd9 -r 12fa43dbafb1 vcweb/core/templates/registration/register.html --- a/vcweb/core/templates/registration/register.html Mon Apr 18 11:51:33 2011 -0700 +++ b/vcweb/core/templates/registration/register.html Mon Apr 18 15:32:59 2011 -0700 @@ -33,7 +33,6 @@ hide: { when: { event: 'mouseout blur' } } }); }); - $('button').button(); }); </script> diff -r 531274702cd9 -r 12fa43dbafb1 vcweb/forestry/models.py --- a/vcweb/forestry/models.py Mon Apr 18 11:51:33 2011 -0700 +++ b/vcweb/forestry/models.py Mon Apr 18 15:32:59 2011 -0700 @@ -1,5 +1,5 @@ -from django.contrib.auth.models import User -from vcweb.core.models import ExperimentMetadata, Parameter, ParticipantExperimentRelationship, ParticipantGroupRelationship, ParticipantRoundDataValue, Participant, Institution +from django.dispatch import receiver +from vcweb.core.models import (ExperimentMetadata, Parameter, ParticipantGroupRelationship, ParticipantRoundDataValue,) from vcweb.core import signals from celery.decorators import task import logging @@ -125,14 +125,13 @@ pass def round_teardown(experiment, **kwargs): + ''' round teardown calculates new resource levels for practice or regular rounds based on the group harvest and resultant regrowth and transferring''' logger.debug("forestry: round_teardown for %s" % experiment) - ''' only calculate new resource levels for practice or regular rounds ''' resource_level_parameter = get_resource_level_parameter() current_round_configuration = experiment.current_round -# FIXME: make a round parameter for this. max_resource_level = 100 for group in experiment.groups.all(): -# implements regrowth function inline + # FIXME: simplify logic if has_resource_level(group): current_resource_level = get_resource_level(group) if current_round_configuration.is_playable_round: @@ -141,6 +140,8 @@ group.log("Harvest: removing %s from current resource level %s" % (total_harvest, current_resource_level.value)) set_group_harvest(group, total_harvest) current_resource_level.value = max(current_resource_level.value - total_harvest, 0) + # implements regrowth function inline + # FIXME: parameterize regrowth rate. regrowth = current_resource_level.value / 10 group.log("Regrowth: adding %s to current resource level %s" % (regrowth, current_resource_level.value)) set_regrowth(group, regrowth) @@ -152,17 +153,6 @@ group.log("Transferring resource level %s to next round" % get_resource_level(group)) group.transfer_to_next_round(resource_level_parameter) -#@receiver(signals.round_started, sender='forestry') -def round_started_handler(sender, experiment=None, **kwargs): - logger.debug("forestry handling round started signal") - round_setup(experiment, **kwargs) - -#@receiver(signals.round_ended, sender='forestry') -def round_ended_handler(sender, experiment=None, **kwargs): - logger.debug("forestry handling round ended signal") - round_teardown(experiment, **kwargs) - - ''' FIXME: figure out a better way to tie these signal handlers to a specific ExperimentMetadata instance. Using ExperimentMetadata.namespace is problematic @@ -176,6 +166,15 @@ even using django.util.encodings smart_unicode and smart_str functions don't help. ''' forestry_sender = 1 +@receiver(signals.round_started, sender=forestry_sender) +def round_started_handler(sender, experiment=None, **kwargs): + logger.debug("forestry handling round started signal") + round_setup(experiment, **kwargs) -signals.round_started.connect(round_started_handler, sender=forestry_sender) -signals.round_ended.connect(round_ended_handler, sender=forestry_sender) +@receiver(signals.round_ended, sender=forestry_sender) +def round_ended_handler(sender, experiment=None, **kwargs): + logger.debug("forestry handling round ended signal") + round_teardown(experiment, **kwargs) + + + diff -r 531274702cd9 -r 12fa43dbafb1 vcweb/forestry/templates/forestry/chat.html --- a/vcweb/forestry/templates/forestry/chat.html Mon Apr 18 11:51:33 2011 -0700 +++ b/vcweb/forestry/templates/forestry/chat.html Mon Apr 18 15:32:59 2011 -0700 @@ -10,15 +10,17 @@ var json = jQuery.parseJSON(json_string); switch (json.message_type) { case 'chat': - console.log("Received " + json.pk + " " + json.date_created + " " + json.message); + addChatMessage('chat-div', json); + /* $("#chat-div").append( $("<div class='ui-state-highlight' />") .append($("<a />").attr("name", "" + json.pk) .text("" + json.date_created)) .append(" | ") .append(json.message)); - // scroll to bottom - chatDiv.scrollTop = chatDiv.scrollHeight; + // scroll to bottom + scrollToBottom(chatDiv); + */ break; case 'refresh': location.reload(true); @@ -58,13 +60,15 @@ <div id='chat-div' class='chat notice ui-corner-all'> {% for chat_message in chat_messages %} <div class='ui-state-highlight'> - <a name='{{chat_message.pk}}'>{{chat_message.date_created|date:"G:i:s"}}</a> | {{chat_message}} + <a class='dark-yellow-highlight' name='{{chat_message.pk}}'>{{chat_message.date_created|date:"G:i:s"}}</a> | {{chat_message}} </div> {% endfor %} </div> <form id="chatform"> <input id='chatText' type="text" /> - <input type="submit" value='Send' /> + <div> + <button type='submit'>Send</button> + </div> </form> {% endblock %} diff -r 531274702cd9 -r 12fa43dbafb1 vcweb/forestry/templates/forestry/participate.html --- a/vcweb/forestry/templates/forestry/participate.html Mon Apr 18 11:51:33 2011 -0700 +++ b/vcweb/forestry/templates/forestry/participate.html Mon Apr 18 15:32:59 2011 -0700 @@ -37,7 +37,6 @@ s.send(createSubmitEvent(harvestDecisionValue)); return true; }); - $('button').button(); }); </script> {% endblock %} diff -r 531274702cd9 -r 12fa43dbafb1 vcweb/settings.py --- a/vcweb/settings.py Mon Apr 18 11:51:33 2011 -0700 +++ b/vcweb/settings.py Mon Apr 18 15:32:59 2011 -0700 @@ -3,6 +3,7 @@ import logging LOG_FILENAME = 'vcweb.log' +TORNADIO_LOG_FILENAME = 'tornadio.log' LOGGING = { 'version': 1, 'disable_existing_loggers': True, @@ -33,6 +34,12 @@ 'formatter': 'medium', 'filename': LOG_FILENAME, }, + 'tornadio-file': { + 'level': 'DEBUG', + 'class':'logging.handlers.RotatingFileHandler', + 'formatter': 'medium', + 'filename': TORNADIO_LOG_FILENAME, + }, }, 'loggers': { 'django': { @@ -48,7 +55,11 @@ 'vcweb': { 'handlers': ['console', 'file'], 'level': 'DEBUG', - } + }, + 'vcweb.tornadio': { + 'handlers': ['console', 'tornadio-file'], + 'level': 'DEBUG', + }, } } diff -r 531274702cd9 -r 12fa43dbafb1 vcweb/static/css/style.css --- a/vcweb/static/css/style.css Mon Apr 18 11:51:33 2011 -0700 +++ b/vcweb/static/css/style.css Mon Apr 18 15:32:59 2011 -0700 @@ -145,8 +145,9 @@ #experimentData a { text-decoration: none; } -a.tooltip { +.dark-yellow-highlight { background-color: #F9E275; + text-decoration: none; } #experiments a { text-decoration: none; diff -r 531274702cd9 -r 12fa43dbafb1 vcweb/static/js/common.js --- a/vcweb/static/js/common.js Mon Apr 18 11:51:33 2011 -0700 +++ b/vcweb/static/js/common.js Mon Apr 18 15:32:59 2011 -0700 @@ -8,3 +8,16 @@ function scrollToBottom(element) { element.scrollTop = element.scrollHeight; } +function addChatMessage(elementId, json, title) { + if (! title) { + title = json.date_created; + } + $('#' + elementId).append( + $("<div class='ui-state-highlight' style='line-height: 1.5em;'/>") + .append($("<a class='dark-yellow-highlight' />").attr("name", json.pk).attr("title", title) + .text(json.date_created)) + .append(" | ") + .append(json.message)); + scrollToBottom(document.getElementById(elementId)); +} + diff -r 531274702cd9 -r 12fa43dbafb1 vcweb/vcweb-tornadio.py --- a/vcweb/vcweb-tornadio.py Mon Apr 18 11:51:33 2011 -0700 +++ b/vcweb/vcweb-tornadio.py Mon Apr 18 15:32:59 2011 -0700 @@ -12,7 +12,8 @@ from vcweb.core.models import ParticipantExperimentRelationship, ParticipantGroupRelationship, ChatMessage, Experimenter, Experiment -logger = logging.getLogger(__name__) +logger = logging.getLogger('vcweb.tornadio') + def info_json(message): return simplejson.dumps({'message_type': 'info', 'message': message}) @@ -277,6 +278,8 @@ ) chat_json = simplejson.dumps({ "pk": chat_message.pk, + 'round_data_pk': current_round_data.pk, + 'participant': unicode(participant_group_relationship.participant), "date_created": chat_message.date_created.strftime("%H:%M:%S"), "message" : unicode(chat_message), "message_type": 'chat', |
From: <vir...@li...> - 2011-04-18 18:51:49
|
Subject: hg.virtualcommons 344 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/531274702cd9 changeset: 344:531274702cd9 user: Allen Lee <all...@as...> date: Mon Apr 18 11:51:33 2011 -0700 description: changing static urls to use {{STATIC_URL}}, and css url references to refer to relative path to css file (as per the standard) diffstat: vcweb/core/templates/base.html | 18 ++++---- vcweb/core/templates/experimenter/dashboard.html | 14 +++--- vcweb/core/templates/experimenter/monitor.html | 23 ++++++----- vcweb/core/templates/participant/base.html | 2 +- vcweb/forestry/models.py | 11 ++--- vcweb/forestry/templates/forestry/participate.html | 6 +- vcweb/static/css/style.css | 30 +++++++------- vcweb/vcweb-tornadio.py | 35 +++++++++-------- 8 files changed, 70 insertions(+), 69 deletions(-) diffs (381 lines): diff -r df4a526461d3 -r 531274702cd9 vcweb/core/templates/base.html --- a/vcweb/core/templates/base.html Mon Apr 18 10:38:59 2011 -0700 +++ b/vcweb/core/templates/base.html Mon Apr 18 11:51:33 2011 -0700 @@ -5,18 +5,18 @@ {% block 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" /> - <link href="/static/css/style.css" rel="stylesheet" type="text/css" media="screen" /> + <link rel="stylesheet" href="{{STATIC_URL}}css/blueprint/screen.css" type="text/css" media="screen, projection" /> + <link rel="stylesheet" href="{{STATIC_URL}}css/blueprint/print.css" type="text/css" media="print" /> + <!--[if lt IE 8]><link rel="stylesheet" href="{{STATIC_URL}}media/css/blueprint/ie.css" type="text/css" media="screen, projection" /><![endif]--> + <link href="{{STATIC_URL}}css/guarantee/style.css" rel="stylesheet" type="text/css" media="screen" /> + <link href="{{STATIC_URL}}css/style.css" rel="stylesheet" type="text/css" media="screen" /> <!-- vcweb common js --> <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script> - <script type='text/javascript' src='/static/js/common.js'></script> - <script type='text/javascript' src='/static/js/jquery.qtip-1.0.0-rc3.min.js'></script> + <script type='text/javascript' src='{{STATIC_URL}}js/common.js'></script> + <script type='text/javascript' src='{{STATIC_URL}}js/jquery.qtip-1.0.0-rc3.min.js'></script> {% include "includes/jquery.ui.html" %} {% dajaxice_js_import %} - <!-- <script type='/text/javascript' src='/static/js/dajaxice.core.js'></script> --> + <!-- <script type='/text/javascript' src='{{STATIC_URL}}js/dajaxice.core.js'></script> --> <script type='text/javascript'> <!-- sets all external links to open up in new windows --> $(function() { @@ -28,7 +28,7 @@ <body> <div id='logo'> <div style='clear: none; position:relative;float:right; left:-930px; padding: 5px;'> - <img src='/static/images/vcweb-logo.png' alt='vcweb logo'/> + <img src='{{STATIC_URL}}images/vcweb-logo.png' alt='vcweb logo'/> </div> <h1> {% block logo %} diff -r df4a526461d3 -r 531274702cd9 vcweb/core/templates/experimenter/dashboard.html --- a/vcweb/core/templates/experimenter/dashboard.html Mon Apr 18 10:38:59 2011 -0700 +++ b/vcweb/core/templates/experimenter/dashboard.html Mon Apr 18 11:51:33 2011 -0700 @@ -46,21 +46,21 @@ <div class='notice ui-corner-all'> {{e.status_line}} <span style='padding: 3px;' class='ui-state-highlight'><b>{{e.participants.count}} registered participants</b></span> <ul class='horizontal experiment-menu'> - <li><a title='Monitor and control this experiment' href='{{e.monitor_url}}'><img src='/static/images/famfamfam/zoom.png' alt='General experiment monitoring interface'/> monitor</a></li> - <li><a class='confirm-experiment-action' title='Creates a new copy of this experiment with the exact same configuration but no registered participants.' href='{{e.clone_url}}'><img src='/static/images/famfamfam/page_copy.png' alt='Clone experiment'/> clone</a></li> + <li><a title='Monitor and control this experiment' href='{{e.monitor_url}}'><img src='{{STATIC_URL}}images/famfamfam/zoom.png' alt='General experiment monitoring interface'/> monitor</a></li> + <li><a class='confirm-experiment-action' title='Creates a new copy of this experiment with the exact same configuration but no registered participants.' href='{{e.clone_url}}'><img src='{{STATIC_URL}}images/famfamfam/page_copy.png' alt='Clone experiment'/> clone</a></li> {% if e.participants.count == 0 %} <li> - <a title='Register participants for this experiment with actual email addresses' href='{{e.controller_url}}/register-email-list'><img src='/static/images/famfamfam/group_add.png' alt='register'/> register participants by email</a> + <a title='Register participants for this experiment with actual email addresses' href='{{e.controller_url}}/register-email-list'><img src='{{STATIC_URL}}images/famfamfam/group_add.png' alt='register'/> register participants by email</a> </li> <li> - <a title='Register participants for this experiment with fake email addresses by providing an email suffix and the number of participants.' href='{{e.controller_url}}/register-simple'><img src='/static/images/famfamfam/group_add.png' alt='register'/> register example participants</a> + <a title='Register participants for this experiment with fake email addresses by providing an email suffix and the number of participants.' href='{{e.controller_url}}/register-simple'><img src='{{STATIC_URL}}images/famfamfam/group_add.png' alt='register'/> register example participants</a> </li> {% else %} - <li><a title='clear all participants' href='{{e.controller_url}}/clear-participants' class='confirm-experiment-action'><img src='/static/images/famfamfam/group_delete.png' alt=''/> clear all participants</a></li> + <li><a title='clear all participants' href='{{e.controller_url}}/clear-participants' class='confirm-experiment-action'><img src='{{STATIC_URL}}images/famfamfam/group_delete.png' alt=''/> clear all participants</a></li> {% endif %} - <!-- <li><a href='{{e.management_url}}'><img src='/static/images/famfamfam/application_go.png' alt='Custom management interface'/> manage (unfinished)</a></li> --> + <!-- <li><a href='{{e.management_url}}'><img src='{{STATIC_URL}}images/famfamfam/application_go.png' alt='Custom management interface'/> manage (unfinished)</a></li> --> {% if e.is_active %} - <li><a title='stop this experiment' href='{{e.stop_url}}' class='confirm-experiment-action'><img src='/static/images/famfamfam/stop.png' alt=''/> stop</a></li> + <li><a title='stop this experiment' href='{{e.stop_url}}' class='confirm-experiment-action'><img src='{{STATIC_URL}}images/famfamfam/stop.png' alt=''/> stop</a></li> {% endif %} </ul> </div> diff -r df4a526461d3 -r 531274702cd9 vcweb/core/templates/experimenter/monitor.html --- a/vcweb/core/templates/experimenter/monitor.html Mon Apr 18 10:38:59 2011 -0700 +++ b/vcweb/core/templates/experimenter/monitor.html Mon Apr 18 11:51:33 2011 -0700 @@ -69,6 +69,7 @@ addExperimentMessage(json.message); break; case 'chat': + addExperimentMessage(json.message); break; case 'submit': $('#participant_data_value_' + json.participant_data_value_pk).html(json.message).effect("highlight", {}, 5000); @@ -116,21 +117,21 @@ <legend>Experiment management</legend> <ul class='actions'> <li><span id='refreshAllParticipants' title='Sends a page refresh to all connected participants.' class='clickable' > - <span class='vcweb-icon ui-icon icon-left' style='background:url(/static/images/famfamfam/arrow_refresh.png);'></span> + <span class='vcweb-icon ui-icon icon-left' style='background:url({{STATIC_URL}}images/famfamfam/arrow_refresh.png);'></span> refresh all participants</span> </li> {% comment %} <li><span id='gotoUrl' title='Moves all connected participants from waiting page to active page.' class='clickable' > - <span class='vcweb-icon ui-icon icon-left' style='background:url(/static/images/famfamfam/arrow_right.png);'></span> + <span class='vcweb-icon ui-icon icon-left' style='background:url({{STATIC_URL}}images/famfamfam/arrow_right.png);'></span> transition all participants to next round</span> </li> {% endcomment %} <li> <a href='download/csv'> - <span class='vcweb-icon ui-icon icon-left' style='margin: 8px 0.15em 0px 0px; background:url(/static/images/download-icon.png);'></span> - download data as <img src='/static/images/famfamfam/page_white_text.png' style='margin: 5px 0 0 0;' alt='' /> csv + <span class='vcweb-icon ui-icon icon-left' style='margin: 8px 0.15em 0px 0px; background:url({{STATIC_URL}}images/download-icon.png);'></span> + download data as <img src='{{STATIC_URL}}images/famfamfam/page_white_text.png' style='margin: 5px 0 0 0;' alt='' /> csv </a> | - <a href='download/xls'><img src='/static/images/famfamfam/page_white_excel.png' style='margin: 5px 0 0 0;' alt=''/> xls</a> + <a href='download/xls'><img src='{{STATIC_URL}}images/famfamfam/page_white_excel.png' style='margin: 5px 0 0 0;' alt=''/> xls</a> </li> </ul> </fieldset> @@ -140,7 +141,7 @@ JSON object in and everything auto-updates. {% endcomment %} <div id='statusSpinner' style='display:none;'> - <img src='/static/images/squares-circle-ajax-loader.gif' alt='... working ...' /> + <img src='{{STATIC_URL}}images/squares-circle-ajax-loader.gif' alt='... working ...' /> </div> <div id='statusDiv'> {% block status %} @@ -151,13 +152,13 @@ {% if experiment.is_active %} {% if experiment.is_round_in_progress %} <li><a class='confirm-experiment-action' name='end_round' href='end-round' title='Stops the current round.'> - <span class='vcweb-icon icon-left ui-icon' style='background: url(/static/images/famfamfam/control_stop_blue.png);' ></span>end round</a></li> + <span class='vcweb-icon icon-left ui-icon' style='background: url({{STATIC_URL}}images/famfamfam/control_stop_blue.png);' ></span>end round</a></li> {% else %} <li><a class='confirm-experiment-action' name='start_round' href='start-round' title='Starts the round.'> - <span class='ui-icon vcweb-icon icon-left' style='background:url(/static/images/famfamfam/control_play_blue.png);' ></span>start round</a></li> + <span class='ui-icon vcweb-icon icon-left' style='background:url({{STATIC_URL}}images/famfamfam/control_play_blue.png);' ></span>start round</a></li> {% endif %} <li><a class='confirm-experiment-action' name='advance_to_next_round' href='advance-to-next-round' title='Stops the current round if necessary and advances to the next round.'> - <span class='vcweb-icon ui-icon icon-left' style='background:url(/static/images/famfamfam/control_fastforward_blue.png);' ></span>advance to next round</a></li> + <span class='vcweb-icon ui-icon icon-left' style='background:url({{STATIC_URL}}images/famfamfam/control_fastforward_blue.png);' ></span>advance to next round</a></li> {% else %} {% if participant_count == 0 %} <div class='alert alertIcon ui-corner-all'> @@ -165,7 +166,7 @@ </div> {% else %} <li><a title='You must first activate an experiment before you can run it.' class='confirm-experiment-action' name='activate' - href='activate'><span class='vcweb-icon ui-icon icon-left' style='background:url(/static/images/famfamfam/cog_go.png);' ></span>activate</a> + href='activate'><span class='vcweb-icon ui-icon icon-left' style='background:url({{STATIC_URL}}images/famfamfam/cog_go.png);' ></span>activate</a> </li> {%endif%} {% endif %} @@ -245,9 +246,9 @@ <div id='chat_{{round_data.pk}}' class='chat notice ui-corner-all'> {% for chat_message in round_data.chat_messages.all %} <div class='ui-state-highlight'> + <span class='icon-left ui-icon ui-icon-comment'></span> <a class='tooltip' name='{{chat_message.pk}}' title='{{chat_message.date_created}} {{chat_message.participant}}'> {{chat_message.date_created|date:"H:s"}}</a> | {{chat_message}} - <span class='ui-icon ui-icon-comment icon-right'></span> </div> {% endfor %} </div> diff -r df4a526461d3 -r 531274702cd9 vcweb/core/templates/participant/base.html --- a/vcweb/core/templates/participant/base.html Mon Apr 18 10:38:59 2011 -0700 +++ b/vcweb/core/templates/participant/base.html Mon Apr 18 11:51:33 2011 -0700 @@ -2,7 +2,7 @@ {% block head %} {{block.super}} - <script type='text/javascript' src='/static/js/jquery.validate.min.js'></script> + <script type='text/javascript' src='{{STATIC_URL}}js/jquery.validate.min.js'></script> {% block participant_socket_io %} {% include "includes/participant.events.html" %} {% include "includes/socket.io.html" %} diff -r df4a526461d3 -r 531274702cd9 vcweb/forestry/models.py --- a/vcweb/forestry/models.py Mon Apr 18 10:38:59 2011 -0700 +++ b/vcweb/forestry/models.py Mon Apr 18 11:51:33 2011 -0700 @@ -141,15 +141,14 @@ group.log("Harvest: removing %s from current resource level %s" % (total_harvest, current_resource_level.value)) set_group_harvest(group, total_harvest) current_resource_level.value = max(current_resource_level.value - total_harvest, 0) - #group.subtract(resource_level_parameter, total_harvest) + regrowth = current_resource_level.value / 10 + group.log("Regrowth: adding %s to current resource level %s" % (regrowth, current_resource_level.value)) + set_regrowth(group, regrowth) + current_resource_level.value = min(current_resource_level.value + regrowth, max_resource_level) + current_resource_level.save() ''' transfer resource levels across chat and quiz rounds if they exist ''' if experiment.has_next_round: ''' set group round data resource_level for each group + regrowth ''' - regrowth = current_resource_level.value / 10 - group.log("Regrowth: adding %s to current resource level %s" % (regrowth, current_resource_level.value)) - set_regrowth(group, regrowth) - current_resource_level.value = min(current_resource_level.value + regrowth, max_resource_level) - current_resource_level.save() group.log("Transferring resource level %s to next round" % get_resource_level(group)) group.transfer_to_next_round(resource_level_parameter) diff -r df4a526461d3 -r 531274702cd9 vcweb/forestry/templates/forestry/participate.html --- a/vcweb/forestry/templates/forestry/participate.html Mon Apr 18 10:38:59 2011 -0700 +++ b/vcweb/forestry/templates/forestry/participate.html Mon Apr 18 11:51:33 2011 -0700 @@ -46,17 +46,17 @@ {% endblock %} {% block content %} <h3>Forestry round number {{ experiment.current_round.round_number }}</h3> -<div style="background: url('/static/images/forestry/{{tree.name}}.png'); width:{{max_width}}px; height: {{max_height}}px;"> +<div style="background: url('{{STATIC_URL}}images/forestry/{{tree.name}}.png'); width:{{max_width}}px; height: {{max_height}}px;"> </div> {% if resource_width > 0 %} -<div style="background: url('/static/images/forestry/pine-tree.png') repeat-x; width:{{resource_width}}px; height: {{tree.height}}px;"> +<div style="background: url('{{STATIC_URL}}images/forestry/pine-tree.png') repeat-x; width:{{resource_width}}px; height: {{tree.height}}px;"> </div> {% endif %} {% if resource_level.value == 0 %} -<div style='padding: 8px; margin: auto; border: solid 1px; background: #E8E8E8 url(/static/images/forestry/deforestation.jpg) no-repeat center; height: 282px; width:425px;'> +<div style='padding: 8px; margin: auto; border: solid 1px; background: #E8E8E8 url({{STATIC_URL}}images/forestry/deforestation.jpg) no-repeat center; height: 282px; width:425px;'> </div> {% endif %} diff -r df4a526461d3 -r 531274702cd9 vcweb/static/css/style.css --- a/vcweb/static/css/style.css Mon Apr 18 10:38:59 2011 -0700 +++ b/vcweb/static/css/style.css Mon Apr 18 11:51:33 2011 -0700 @@ -3,7 +3,7 @@ font-size: 1.1em; } a.external { - background: url(/static/images/external.png) center right no-repeat; + background: url(../images/external.png) center right no-repeat; padding-right: 13px; } h1, h2, h3, h4, h5 { @@ -30,7 +30,7 @@ border: solid red; } label.error { - background: url('/static/images/unchecked.gif') no-repeat left center #FBE3E4; + background: url('../images/unchecked.gif') no-repeat left center #FBE3E4; line-height: normal; font-size: .8em; margin:0.3em; @@ -103,19 +103,19 @@ background-position: 3px; } .errorIcon, .warningIcon, .alertIcon { - background-image: url('/static/images/warning.png') + background-image: url('../images/warning.png') } .crossIcon { - background-image: url('/static/images/famfamfam/cross.png'); + background-image: url('../images/famfamfam/cross.png'); } .contactIcon { - background-image: url('/static/images/famfamfam/comment_add.png'); + background-image: url('../images/famfamfam/comment_add.png'); } .smallInfoIcon { - background-image: url('/static/images/famfamfam/information.png'); + background-image: url('../images/famfamfam/information.png'); } .infoIcon { - background-image: url('/static/images/info.png') + background-image: url('../images/info.png') } .small-font { font-size: 0.8em; @@ -167,17 +167,17 @@ padding-left: 25px; } #experiments span.inactive { - background: url('/static/images/famfamfam/clock_stop.png') center left no-repeat; + background: url('../images/famfamfam/clock_stop.png') center left no-repeat; } #experiments span.active { - background: url('/static/images/famfamfam/accept.png') center left no-repeat; + background: url('../images/famfamfam/accept.png') center left no-repeat; } #experiments span.round_in_progress { - background: url('/static/images/famfamfam/bullet_go.png') center left no-repeat; + background: url('../images/famfamfam/bullet_go.png') center left no-repeat; } #experiments .rightArrow { margin: 0; - background: url('/static/images/famfamfam/bullet_go.png') center left no-repeat; + background: url('../images/famfamfam/bullet_go.png') center left no-repeat; padding-left: 16px; padding-right: 8px; } @@ -188,7 +188,7 @@ font-size: 0.9em; } ul.horizontal>li>a { - background: url("/static/images/separator.gif") bottom right no-repeat; + background: url("../images/separator.gif") bottom right no-repeat; padding-left: 8px; padding-right: 8px; text-decoration: none; @@ -216,7 +216,7 @@ padding: 0; } #navmenu a { - background: #4A3226 url("/static/images/separator.gif") bottom right no-repeat; + background: #4A3226 url("../images/separator.gif") bottom right no-repeat; color: #ccc; display: block; float: left; @@ -226,12 +226,12 @@ font-weight:normal; } #navmenu a:hover { - background: #2580a2 url("/static/images/hover.gif") bottom center no-repeat; + background: #2580a2 url("../images/hover.gif") bottom center no-repeat; color: #fff; padding-bottom: 8px; } #timeRemaining span { - background: url('/static/images/clock.png') bottom center no-repeat; + background: url('../images/famfamfam/clock.png') bottom center no-repeat; margin-left: 8px; margin-right: 8px; } diff -r df4a526461d3 -r 531274702cd9 vcweb/vcweb-tornadio.py --- a/vcweb/vcweb-tornadio.py Mon Apr 18 10:38:59 2011 -0700 +++ b/vcweb/vcweb-tornadio.py Mon Apr 18 11:51:33 2011 -0700 @@ -6,13 +6,6 @@ import logging import simplejson -# FIXME: hack, configuring before django settings configures it so we can get things spit to the console.. vcweb.log -# seems to be missing these logging statements. -logging.basicConfig( - level=logging.DEBUG, - format='%(asctime)s %(levelname)s %(message)s', - ) - sys.path.append(os.path.abspath('..')) os.environ['DJANGO_SETTINGS_MODULE'] = 'vcweb.settings' @@ -27,15 +20,23 @@ def goto_json(url): return simplejson.dumps({'message_type': 'goto', 'url': url}) +def chat_json(chat_message): + return simplejson.dumps({ + "pk": chat_message.pk, + "date_created": chat_message.date_created.strftime("%H:%M:%S"), + "message" : unicode(chat_message), + "message_type": 'chat', + }) + class Message(object): def __init__(self, message_type='info', **kwargs): self.message_type = message_type self.__dict__.update(**kwargs) -''' -Manages socket.io connections to tornadio. -''' class ConnectionManager: + ''' + Manages socket.io connections to tornadio. + ''' # bidi maps for (participant.pk, experiment.pk) -> connection connection_to_participant = {} participant_to_connection = {} @@ -274,13 +275,13 @@ message=event.message, round_data=current_round_data ) - for participant_group_pk, connection in connection_manager.connections(participant_group_relationship.group): - connection.send(simplejson.dumps({ - "pk": chat_message.pk, - "date_created": chat_message.date_created.strftime("%H:%M:%S"), - "message" : chat_message.__unicode__(), - "message_type": 'chat', - })) + chat_json = simplejson.dumps({ + "pk": chat_message.pk, + "date_created": chat_message.date_created.strftime("%H:%M:%S"), + "message" : unicode(chat_message), + "message_type": 'chat', + }) + connection_manager.send_to_group(participant_group_relationship.group, chat_json) def on_close(self): logger.debug("closing %s" % self) |
From: <vir...@li...> - 2011-04-18 17:38:21
|
Subject: hg.virtualcommons 343 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/df4a526461d3 changeset: 343:df4a526461d3 user: Allen Lee <all...@as...> date: Mon Apr 18 10:38:59 2011 -0700 description: fixed duplicate connection socket.io bug in instructions page diffstat: vcweb/core/models.py | 7 ++++--- vcweb/core/templates/experimenter/monitor.html | 4 ++-- vcweb/core/templates/participant/base.html | 2 +- vcweb/core/views.py | 20 +++++++++++--------- vcweb/forestry/templates/forestry/instructions.html | 10 ++++++---- vcweb/vcweb-tornadio.py | 5 +++-- 6 files changed, 27 insertions(+), 21 deletions(-) diffs (178 lines): diff -r cf69da643df8 -r df4a526461d3 vcweb/core/models.py --- a/vcweb/core/models.py Fri Apr 15 14:59:38 2011 -0700 +++ b/vcweb/core/models.py Mon Apr 18 10:38:59 2011 -0700 @@ -951,15 +951,16 @@ def get_data_value(self, parameter=None, parameter_name=None, round_data=None): criteria = self._data_parameter_criteria(parameter=parameter, parameter_name=parameter_name, round_data=round_data) - logger.debug("criteria: %s" % criteria) data_value, created = self.data_values.get_or_create(**criteria) if created: logger.debug("Created new data value in get_data_value: %s" % data_value) return data_value def _data_parameter_criteria(self, parameter=None, parameter_name=None, round_data=None): - return dict([('parameter', parameter) if parameter else ('parameter__name', parameter_name), - ('round_data', self.current_round_data if round_data is None else round_data)]) + return dict([ + ('parameter', parameter) if parameter else ('parameter__name', parameter_name), + ('round_data', self.current_round_data if round_data is None else round_data) + ]) def get_group_data_values(self, name=None, *names): diff -r cf69da643df8 -r df4a526461d3 vcweb/core/templates/experimenter/monitor.html --- a/vcweb/core/templates/experimenter/monitor.html Fri Apr 15 14:59:38 2011 -0700 +++ b/vcweb/core/templates/experimenter/monitor.html Mon Apr 18 10:38:59 2011 -0700 @@ -10,6 +10,7 @@ } else { if (json.should_transition) { + console.log("Transitioning participants to " + json.transition_url); getCachedSocket().send(createGotoEvent(json.transition_url)); } $('#statusDiv').html(json.status); @@ -71,8 +72,7 @@ break; case 'submit': $('#participant_data_value_' + json.participant_data_value_pk).html(json.message).effect("highlight", {}, 5000); - addExperimentMessage("Participant " + json.participant_number + " (Group #" + json.participant_group + - ") submit a harvest decision of " + json.message); + addExperimentMessage("Participant " + json.participant_number + " (Group #" + json.participant_group + ") submit a harvest decision of " + json.message); break; default: } diff -r cf69da643df8 -r df4a526461d3 vcweb/core/templates/participant/base.html --- a/vcweb/core/templates/participant/base.html Fri Apr 15 14:59:38 2011 -0700 +++ b/vcweb/core/templates/participant/base.html Mon Apr 18 10:38:59 2011 -0700 @@ -2,8 +2,8 @@ {% block head %} {{block.super}} + <script type='text/javascript' src='/static/js/jquery.validate.min.js'></script> {% block participant_socket_io %} - <script type='text/javascript' src='/static/js/jquery.validate.min.js'></script> {% include "includes/participant.events.html" %} {% include "includes/socket.io.html" %} <script type='text/javascript'> diff -r cf69da643df8 -r df4a526461d3 vcweb/core/views.py --- a/vcweb/core/views.py Fri Apr 15 14:59:38 2011 -0700 +++ b/vcweb/core/views.py Mon Apr 18 10:38:59 2011 -0700 @@ -15,9 +15,6 @@ RegisterEmailListParticipantsForm, RegisterSimpleParticipantsForm) from vcweb.core.models import (Participant, Experimenter, Experiment, Institution, is_participant, is_experimenter) from vcweb.core.decorators import anonymous_required, experimenter_required, participant_required -import hashlib -import base64 -from datetime import datetime from vcweb.core import unicodecsv import itertools import logging @@ -43,6 +40,7 @@ if is_experimenter(user): return Experiment.objects.filter(experimenter__pk=self.request.user.experimenter.pk) else: +# nested dictionary, {ExperimentMetadata -> { status -> [experiments,...] }} experiment_dict = {} for experiment in user.participant.experiments.exclude(status__in=(Experiment.INACTIVE, Experiment.PAUSED, Experiment.COMPLETED)): if not experiment.experiment_metadata in experiment_dict: @@ -52,7 +50,6 @@ return experiment_dict def set_authentication_token(user, authentication_token=None): - logger.debug("Setting auth token %s on user %s" % (authentication_token, user)) commons_user = None if is_participant(user): commons_user = user.participant @@ -60,10 +57,9 @@ commons_user = user.experimenter else: logger.error("Invalid user: %s" % user) - if commons_user is not None: - commons_user.authentication_token = authentication_token - commons_user.save() - + return + commons_user.authentication_token = authentication_token + commons_user.save() class LoginView(FormView, AnonymousMixin): form_class = LoginForm @@ -110,12 +106,18 @@ else: participant = Participant.objects.create(user=user, institution=institution) logger.debug("Creating new participant: %s" % participant) - auth.login(self.request, auth.authenticate(username=email, password=password)) + request = self.request + auth.login(request, auth.authenticate(username=email, password=password)) + set_authentication_token(user, request.session.session_key) return super(RegistrationView, self).form_valid(form) def get_success_url(self): return reverse('core:dashboard') +class AccountView(FormView): + pass + + @login_required def account_profile(request): user = request.user diff -r cf69da643df8 -r df4a526461d3 vcweb/forestry/templates/forestry/instructions.html --- a/vcweb/forestry/templates/forestry/instructions.html Fri Apr 15 14:59:38 2011 -0700 +++ b/vcweb/forestry/templates/forestry/instructions.html Mon Apr 18 10:38:59 2011 -0700 @@ -1,22 +1,24 @@ {% extends "participant/base.html" %} {% block head %} {{ block.super }} - {% include "includes/participant.events.html" %} - {% include "includes/socket.io.html" %} <script type="text/javascript"> $(function() { - var s = connect(window.location.hostname, 8888, 'participant/{{participant_experiment_relationship.pk}}'); + var s = getCachedSocket(); s.on('message', function(json_string) { var json = jQuery.parseJSON(json_string); + console.log("received json string: " + json_string); switch (json.message_type) { case 'refresh': console.log("refreshing.."); window.location.reload(true); break; case 'goto': - console.log("going to " + json.url); + console.log("goto " + json.url); window.location.href = json.url; break; + default: + console.log("unhandled json message type: " + json.message_type + ":" + json.message); + break; } }); }); diff -r cf69da643df8 -r df4a526461d3 vcweb/vcweb-tornadio.py --- a/vcweb/vcweb-tornadio.py Fri Apr 15 14:59:38 2011 -0700 +++ b/vcweb/vcweb-tornadio.py Mon Apr 18 10:38:59 2011 -0700 @@ -131,11 +131,13 @@ ''' def send_refresh(self, connection, experiment, experimenter_id=None): for (participant_group_pk, connection) in self.all_participants(connection, experiment): + logger.debug("sending refresh to %s, %s" % (participant_group_pk, + connection)) connection.send(ConnectionManager.refresh_json) def send_goto(self, connection, experiment, url): notified_participants = [] - json = goto_json(url) + json = simplejson.dumps({'message_type': 'goto', 'url': url}) for (participant_group_pk, connection) in self.all_participants(connection, experiment): connection.send(json) notified_participants.append(participant_group_pk) @@ -191,7 +193,6 @@ experimenter_id = event.experimenter_id experiment = Experiment.objects.get(pk=experiment_id) connection_manager.send_refresh(self, experiment, experimenter_id) - logger.debug("pinging back to experimenter") self.send(info_json("Refreshed all participants")) elif event.message_type == 'goto': experiment_id = event.experiment_id |
From: <vir...@li...> - 2011-04-15 21:59:44
|
Subject: hg.virtualcommons 342 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/cf69da643df8 changeset: 342:cf69da643df8 user: Allen Lee <all...@as...> date: Fri Apr 15 14:59:38 2011 -0700 description: improving logging, switched to dictConfig setup improving experimenter transitions by automatically transitioning participants to the wait page when a round ends and to the participate page when a round begins, added should_transition and transition_url to ajax json response for the experiment monitor sent back to the experiment monitor. setting user.authentication_token to django session key diffstat: vcweb/core/ajax.py | 7 +++ vcweb/core/forms.py | 24 +++++------ vcweb/core/models.py | 1 - vcweb/core/templates/experimenter/monitor.html | 5 ++ vcweb/core/views.py | 51 ++++++++++++++++--------- vcweb/forestry/views.py | 6 ++- vcweb/settings.py | 54 ++++++++++++++++++++++++--- 7 files changed, 107 insertions(+), 41 deletions(-) diffs (302 lines): diff -r a305b887eb79 -r cf69da643df8 vcweb/core/ajax.py --- a/vcweb/core/ajax.py Fri Apr 15 12:39:51 2011 -0700 +++ b/vcweb/core/ajax.py Fri Apr 15 14:59:38 2011 -0700 @@ -96,7 +96,14 @@ logger.warning("tried to invoke nonexistent action %s on experiment %s", action, experiment.status_line) status_block = _render_experiment_monitor_block('status', experiment, request) data_block = _render_experiment_monitor_block('data', experiment, request) + transition_url = None + should_transition = action in ('start_round', 'end_round') + if should_transition: + transition_url = 'wait' if action == 'end_round' else 'participate' + return simplejson.dumps({ + 'should_transition': action in ('start_round', 'end_round'), + 'transition_url': transition_url, 'status': status_block, 'experimentData': data_block, 'active_round_number': experiment.current_round.sequence_number, diff -r a305b887eb79 -r cf69da643df8 vcweb/core/forms.py --- a/vcweb/core/forms.py Fri Apr 15 12:39:51 2011 -0700 +++ b/vcweb/core/forms.py Fri Apr 15 14:59:38 2011 -0700 @@ -17,15 +17,13 @@ REQUIRED_EMAIL_ATTRIBUTES = { 'class' : 'required email' } REQUIRED_ATTRIBUTES = { 'class' : 'required' } -class RegistrationForm(forms.Form): +class BaseRegistrationForm(forms.Form): first_name = forms.CharField(widget=widgets.TextInput(attrs=REQUIRED_ATTRIBUTES)) last_name = forms.CharField(widget=widgets.TextInput(attrs=REQUIRED_ATTRIBUTES)) email = forms.EmailField(widget=widgets.TextInput(attrs=REQUIRED_EMAIL_ATTRIBUTES), help_text='Please enter a valid email. We will never share your email in any way shape or form.') password = forms.CharField(widget=widgets.PasswordInput(attrs=REQUIRED_ATTRIBUTES)) confirm_password = forms.CharField(widget=widgets.PasswordInput(attrs=REQUIRED_ATTRIBUTES)) institution = forms.CharField(widget=widgets.TextInput(attrs=REQUIRED_ATTRIBUTES), help_text='The primary institution, if any, you are affiliated with.') - experimenter = forms.BooleanField(help_text='Check this box if you would like to request experimenter access.') - def clean_email(self): email = self.cleaned_data['email'].lower() try: @@ -37,9 +35,12 @@ def clean_confirm_password(self): password = self.cleaned_data['password'] confirm_password = self.cleaned_data['confirm_password'] - if password != confirm_password: - raise forms.ValidationError(_("Please make sure your passwords match.")) - return self.confirm_password + if password == confirm_password: + return confirm_password + raise forms.ValidationError(_("Please make sure your passwords match.")) + +class RegistrationForm(BaseRegistrationForm): + experimenter = forms.BooleanField(required=False, help_text='Check this box if you would like to request experimenter access.') class LoginForm(forms.Form): email = forms.EmailField(widget=widgets.TextInput(attrs=REQUIRED_EMAIL_ATTRIBUTES)) @@ -56,17 +57,14 @@ raise forms.ValidationError(_("This user has been deactivated. Please contact us if this is in error.")) return self.cleaned_data -class ParticipantAccountForm(forms.ModelForm): - email = forms.EmailField(widget=widgets.TextInput(attrs=REQUIRED_EMAIL_ATTRIBUTES)) - password = forms.CharField(widget=widgets.PasswordInput(attrs=REQUIRED_ATTRIBUTES)) - confirm_password = forms.CharField(widget=widgets.PasswordInput(attrs=REQUIRED_ATTRIBUTES)) - - class Meta: - model = Participant +class ParticipantAccountForm(BaseRegistrationForm): + pass class ExperimenterAccountForm(forms.ModelForm): class Meta: model = Experimenter + exclude = ('user',) + email_separator_re = re.compile(r'[^\w\.\-\+@_]+') class EmailListField(forms.CharField): diff -r a305b887eb79 -r cf69da643df8 vcweb/core/models.py --- a/vcweb/core/models.py Fri Apr 15 12:39:51 2011 -0700 +++ b/vcweb/core/models.py Fri Apr 15 14:59:38 2011 -0700 @@ -481,7 +481,6 @@ def start_round(self, sender=None): self.status = 'ROUND_IN_PROGRESS' - ''' get_or_create round_data for this round ''' self.current_round_data self.current_round_elapsed_time = 0 self.current_round_start_time = datetime.now() diff -r a305b887eb79 -r cf69da643df8 vcweb/core/templates/experimenter/monitor.html --- a/vcweb/core/templates/experimenter/monitor.html Fri Apr 15 12:39:51 2011 -0700 +++ b/vcweb/core/templates/experimenter/monitor.html Fri Apr 15 14:59:38 2011 -0700 @@ -9,6 +9,9 @@ console.error("dajaxice error: " + json); } else { + if (json.should_transition) { + getCachedSocket().send(createGotoEvent(json.transition_url)); + } $('#statusDiv').html(json.status); $('#experimentData').accordion("destroy"); $('#experimentData').html(json.experimentData); @@ -116,10 +119,12 @@ <span class='vcweb-icon ui-icon icon-left' style='background:url(/static/images/famfamfam/arrow_refresh.png);'></span> refresh all participants</span> </li> + {% comment %} <li><span id='gotoUrl' title='Moves all connected participants from waiting page to active page.' class='clickable' > <span class='vcweb-icon ui-icon icon-left' style='background:url(/static/images/famfamfam/arrow_right.png);'></span> transition all participants to next round</span> </li> + {% endcomment %} <li> <a href='download/csv'> <span class='vcweb-icon ui-icon icon-left' style='margin: 8px 0.15em 0px 0px; background:url(/static/images/download-icon.png);'></span> diff -r a305b887eb79 -r cf69da643df8 vcweb/core/views.py --- a/vcweb/core/views.py Fri Apr 15 12:39:51 2011 -0700 +++ b/vcweb/core/views.py Fri Apr 15 14:59:38 2011 -0700 @@ -13,7 +13,7 @@ from django.views.generic.edit import UpdateView from vcweb.core.forms import (RegistrationForm, LoginForm, ParticipantAccountForm, ExperimenterAccountForm, RegisterEmailListParticipantsForm, RegisterSimpleParticipantsForm) -from vcweb.core.models import (Participant, Experiment, Institution, is_participant, is_experimenter) +from vcweb.core.models import (Participant, Experimenter, Experiment, Institution, is_participant, is_experimenter) from vcweb.core.decorators import anonymous_required, experimenter_required, participant_required import hashlib import base64 @@ -51,6 +51,20 @@ logger.debug("experiment_dict %s" % experiment_dict) return experiment_dict +def set_authentication_token(user, authentication_token=None): + logger.debug("Setting auth token %s on user %s" % (authentication_token, user)) + commons_user = None + if is_participant(user): + commons_user = user.participant + elif is_experimenter(user): + commons_user = user.experimenter + else: + logger.error("Invalid user: %s" % user) + if commons_user is not None: + commons_user.authentication_token = authentication_token + commons_user.save() + + class LoginView(FormView, AnonymousMixin): form_class = LoginForm template_name = 'registration/login.html' @@ -58,9 +72,8 @@ request = self.request user = form.user_cache auth.login(request, user) - sha1 = hashlib.sha1() - sha1.update("%s%i%s" % (user.email, user.pk, datetime.now())) - request.session['authentication_token'] = base64.urlsafe_b64encode(sha1.digest()) + logger.debug("session is %s" % request.session) + set_authentication_token(user, request.session.session_key) return super(LoginView, self).form_valid(form) def get_success_url(self): return_url = self.request.GET.get('next') @@ -69,16 +82,7 @@ class LogoutView(TemplateView): def get(self, request, *args, **kwargs): user = request.user - commons_user = None - if is_participant(user): - commons_user = user.participant - elif is_experimenter(user): - commons_user = user.experimenter - else: - logger.error("Invalid user: %s" % user) - if commons_user is not None: - commons_user.authentication_token = None - commons_user.save() + set_authentication_token(user) auth.logout(request) return redirect('home') @@ -91,13 +95,21 @@ first_name = form.cleaned_data['first_name'] last_name = form.cleaned_data['last_name'] institution_string = form.cleaned_data['institution'] + experimenter_requested = form.cleaned_data['experimenter'] institution, created = Institution.objects.get_or_create(name=institution_string) user = User.objects.create_user(email, email, password) user.first_name = first_name user.last_name = last_name user.save() - participant = Participant.objects.create(user=user, institution=institution) - logger.debug("Creating new participant: %s" % participant) + if experimenter_requested: + experimenter = Experimenter.objects.create(user=user, + institution=institution) + logger.debug("creating new experimenter: %s, adding default forestry experiment" % experimenter) + experiment = Experiment.objects.get(pk=2) + experiment.clone(experimenter=experimenter) + else: + participant = Participant.objects.create(user=user, institution=institution) + logger.debug("Creating new participant: %s" % participant) auth.login(self.request, auth.authenticate(username=email, password=password)) return super(RegistrationView, self).form_valid(form) @@ -106,10 +118,11 @@ @login_required def account_profile(request): - if is_participant(request.user): - form = ParticipantAccountForm(instance=request.user.participant) + user = request.user + if is_participant(user): + form = ParticipantAccountForm() else: - form = ExperimenterAccountForm(instance=request.user.experimenter) + form = ExperimenterAccountForm(instance=user.experimenter) return render_to_response('registration/profile.html', { 'form': form }, context_instance=RequestContext(request)) ''' participant views ''' diff -r a305b887eb79 -r cf69da643df8 vcweb/forestry/views.py --- a/vcweb/forestry/views.py Fri Apr 15 12:39:51 2011 -0700 +++ b/vcweb/forestry/views.py Fri Apr 15 14:59:38 2011 -0700 @@ -69,6 +69,7 @@ experiment = group.experiment participant_history = [] for round_data in experiment.playable_round_data: + logger.debug("Round %s" % round_data) data = ParticipantRoundData() data.round_configuration = round_data.round_configuration data.individual_harvest = get_harvest_decision(participant_group_relationship, round_data=round_data) @@ -80,8 +81,9 @@ if resource_level.value == 100: data.original_number_of_trees = 100 else: - data.original_number_of_trees = resource_level.value + data.group_harvest.value - data.group_regrowth.value - except AttributeError: + data.original_number_of_trees = min(resource_level.value + data.group_harvest.value - data.group_regrowth.value, 100) + except AttributeError as e: + logger.error("Caught attribute error while trying to calculate original number of trees %s", e) pass data.final_number_of_trees = resource_level.value participant_history.append(data) diff -r a305b887eb79 -r cf69da643df8 vcweb/settings.py --- a/vcweb/settings.py Fri Apr 15 12:39:51 2011 -0700 +++ b/vcweb/settings.py Fri Apr 15 14:59:38 2011 -0700 @@ -3,12 +3,54 @@ import logging LOG_FILENAME = 'vcweb.log' - -logging.basicConfig( - level=logging.DEBUG, - format='%(asctime)s %(levelname)s %(message)s', - filename=LOG_FILENAME, - ) +LOGGING = { + 'version': 1, + 'disable_existing_loggers': True, + 'formatters': { + 'verbose': { + 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' + }, + 'medium': { + 'format': '%(asctime)s %(levelname)s %(message)s' + }, + 'simple': { + 'format': '%(levelname)s %(message)s' + }, + }, + 'handlers': { + 'null': { + 'level':'DEBUG', + 'class':'django.utils.log.NullHandler', + }, + 'console':{ + 'level':'DEBUG', + 'class':'logging.StreamHandler', + 'formatter': 'simple' + }, + 'file': { + 'level': 'DEBUG', + 'class':'logging.handlers.RotatingFileHandler', + 'formatter': 'medium', + 'filename': LOG_FILENAME, + }, + }, + 'loggers': { + 'django': { + 'handlers':['null'], + 'propagate': True, + 'level':'INFO', + }, + 'django.request': { + 'handlers': ['console'], + 'level': 'ERROR', + 'propagate': False, + }, + 'vcweb': { + 'handlers': ['console', 'file'], + 'level': 'DEBUG', + } + } +} DEBUG = True TEMPLATE_DEBUG = DEBUG |
From: <vir...@li...> - 2011-04-15 19:40:10
|
Subject: hg.virtualcommons 341 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/a305b887eb79 changeset: 341:a305b887eb79 user: Allen Lee <all...@as...> date: Fri Apr 15 12:39:51 2011 -0700 description: improving form-as-div more, adding ability to request experimenter access. diffstat: vcweb/core/forms.py | 9 +- vcweb/core/templates/base.html | 6 ++ vcweb/core/templates/includes/experimenter-nav-menu.html | 2 +- vcweb/core/templates/includes/form-as-div.html | 24 ++++---- vcweb/core/templates/includes/nav-menu.html | 2 +- vcweb/core/templates/includes/participant-nav-menu.html | 2 +- vcweb/core/templates/registration/register.html | 63 +++++++-------------- vcweb/static/css/style.css | 2 +- 8 files changed, 48 insertions(+), 62 deletions(-) diffs (195 lines): diff -r 0d8d8482952e -r a305b887eb79 vcweb/core/forms.py --- a/vcweb/core/forms.py Thu Apr 14 18:08:16 2011 -0700 +++ b/vcweb/core/forms.py Fri Apr 15 12:39:51 2011 -0700 @@ -18,12 +18,13 @@ REQUIRED_ATTRIBUTES = { 'class' : 'required' } class RegistrationForm(forms.Form): - email = forms.EmailField(widget=widgets.TextInput(attrs=REQUIRED_EMAIL_ATTRIBUTES)) + first_name = forms.CharField(widget=widgets.TextInput(attrs=REQUIRED_ATTRIBUTES)) + last_name = forms.CharField(widget=widgets.TextInput(attrs=REQUIRED_ATTRIBUTES)) + email = forms.EmailField(widget=widgets.TextInput(attrs=REQUIRED_EMAIL_ATTRIBUTES), help_text='Please enter a valid email. We will never share your email in any way shape or form.') password = forms.CharField(widget=widgets.PasswordInput(attrs=REQUIRED_ATTRIBUTES)) confirm_password = forms.CharField(widget=widgets.PasswordInput(attrs=REQUIRED_ATTRIBUTES)) - first_name = forms.CharField(widget=widgets.TextInput(attrs=REQUIRED_ATTRIBUTES)) - last_name = forms.CharField(widget=widgets.TextInput(attrs=REQUIRED_ATTRIBUTES)) - institution = forms.CharField(widget=widgets.TextInput(attrs=REQUIRED_ATTRIBUTES)) + institution = forms.CharField(widget=widgets.TextInput(attrs=REQUIRED_ATTRIBUTES), help_text='The primary institution, if any, you are affiliated with.') + experimenter = forms.BooleanField(help_text='Check this box if you would like to request experimenter access.') def clean_email(self): email = self.cleaned_data['email'].lower() diff -r 0d8d8482952e -r a305b887eb79 vcweb/core/templates/base.html --- a/vcweb/core/templates/base.html Thu Apr 14 18:08:16 2011 -0700 +++ b/vcweb/core/templates/base.html Fri Apr 15 12:39:51 2011 -0700 @@ -42,6 +42,12 @@ {% endblock %} </div> <div id='page'> + <noscript> + <div class='alert alertIcon ui-corner-all'> + Please <b>enable JavaScript</b> before using this site. <br/>Our + experiments are highly interactive and <b>will not function properly</b> without JavaScript. + </div> + </noscript> {% if messages %} <h3>Notifications</h3> <ul id='messages' class="messages"> diff -r 0d8d8482952e -r a305b887eb79 vcweb/core/templates/includes/experimenter-nav-menu.html --- a/vcweb/core/templates/includes/experimenter-nav-menu.html Thu Apr 14 18:08:16 2011 -0700 +++ b/vcweb/core/templates/includes/experimenter-nav-menu.html Fri Apr 15 12:39:51 2011 -0700 @@ -13,7 +13,7 @@ {% if "experiment" in request.path %} <li class='{% active_re request "experiment" %}'><a name='experiment'>Experiment</a></li> {% endif %} - <li class='{% active request profile %}'><a href='{{ profile }}'>Your Account</a></li> + <li class='{% active request profile %}'><a href='{{ profile }}'>Profile</a></li> <li><a href='{{ logout }}'>Logout</a></li> </ul> </div> diff -r 0d8d8482952e -r a305b887eb79 vcweb/core/templates/includes/form-as-div.html --- a/vcweb/core/templates/includes/form-as-div.html Thu Apr 14 18:08:16 2011 -0700 +++ b/vcweb/core/templates/includes/form-as-div.html Fri Apr 15 12:39:51 2011 -0700 @@ -1,12 +1,12 @@ -{% for field in form %} -<div class='field'> -{% if not field.is_hidden %} -<span class='label' title='{{field.help_text}}'>{{ field.label_tag }}:</span> -{% endif %} -{{ field }} -{% if field.errors %} -<label class='error' for='id_{{ field.name }}' >{{ field.errors|join:". " }}</label> -{% endif %} -</div> -{% endfor %} -{% csrf_token %} +{% for field in form %} +<div class='field'> +{% if not field.is_hidden %} +<span class='label' {% if field.help_text %} title='{{field.help_text}}'{% endif %}>{{ field.label_tag }}:</span> +{% endif %} +{{ field }} +{% if field.errors %} +<label class='error' for='id_{{ field.name }}' >{{ field.errors|join:". " }}</label> +{% endif %} +</div> +{% endfor %} +{% csrf_token %} diff -r 0d8d8482952e -r a305b887eb79 vcweb/core/templates/includes/nav-menu.html --- a/vcweb/core/templates/includes/nav-menu.html Thu Apr 14 18:08:16 2011 -0700 +++ b/vcweb/core/templates/includes/nav-menu.html Fri Apr 15 12:39:51 2011 -0700 @@ -14,7 +14,7 @@ {% if request.user.is_authenticated %} <li class='{% active request home %}' ><a href='{{ home }}' class='first'>Home</a></li> <li class='{% active_re request dashboard %}'><a href='{{ dashboard }}'>Dashboard</a></li> - <li class='{% active request profile %}'><a href='{{ profile }}'>Your Account</a></li> + <li class='{% active request profile %}'><a href='{{ profile }}'>Profile</a></li> <li class='{% active request logout %}'><a href='{{ logout }}'>Logout</a></li> {% else %} <li class='{% active request home %}' ><a href='{{ home }}' class='first'>Home</a></li> diff -r 0d8d8482952e -r a305b887eb79 vcweb/core/templates/includes/participant-nav-menu.html --- a/vcweb/core/templates/includes/participant-nav-menu.html Thu Apr 14 18:08:16 2011 -0700 +++ b/vcweb/core/templates/includes/participant-nav-menu.html Fri Apr 15 12:39:51 2011 -0700 @@ -13,7 +13,7 @@ {% if "participate" in request.path or "wait" in request.path %} <li class='{% active_re request "participate" %} {% active_re request "wait" %}'><a href='#'>Participate</a></li> {% else %} - <li class='{% active request profile %}'><a href='{{ profile }}'>Account</a></li> + <li class='{% active request profile %}'><a href='{{ profile }}'>Profile</a></li> {% endif %} <li><a href='{{ logout }}'>Logout</a></li> </ul> diff -r 0d8d8482952e -r a305b887eb79 vcweb/core/templates/registration/register.html --- a/vcweb/core/templates/registration/register.html Thu Apr 14 18:08:16 2011 -0700 +++ b/vcweb/core/templates/registration/register.html Fri Apr 15 12:39:51 2011 -0700 @@ -16,6 +16,24 @@ equalTo: "Please make sure your passwords match." } }); + $('[title]').qtip({ + position: { corner: {target: 'topRight', tooltip: 'bottomMiddle'}}, + style: { name: 'cream', tip: 'bottomMiddle'}, + }); + + $('input:visible, textarea:visible').each(function(i, val) { + var labelTitle = $(val).prev().attr("title"); + if (! labelTitle) { + return; + } + $(val).qtip({ content: labelTitle, + position: { corner: {target: 'topRight', tooltip: 'bottomLeft'}}, + style: { name: 'cream', tip: 'bottomLeft'}, + show: { when: { event: 'mouseover focus'} }, + hide: { when: { event: 'mouseout blur' } } + }); + }); + $('button').button(); }); </script> @@ -30,50 +48,11 @@ <p> Returning users can <a href='{% url core:login %}'>login here</a> or <a href='{% url password-reset %}'>retrieve your password</a>. </p> -<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" /> +{% include "includes/form-as-div.html" %} -</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_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_institution">Institution</label>:</span> -<input id="id_institution" type="text" class="required" name="institution" /> -</div> - -<div class='submit'> -<input type='submit' value='Register' /> +<div> + <button class='submit'>Register</button> </div> </form> diff -r 0d8d8482952e -r a305b887eb79 vcweb/static/css/style.css --- a/vcweb/static/css/style.css Thu Apr 14 18:08:16 2011 -0700 +++ b/vcweb/static/css/style.css Fri Apr 15 12:39:51 2011 -0700 @@ -100,7 +100,7 @@ background-repeat: no-repeat; margin: 5px 0px; padding: 15px 10px 15px 40px; - background-position: 3px center; + background-position: 3px; } .errorIcon, .warningIcon, .alertIcon { background-image: url('/static/images/warning.png') |
From: <vir...@li...> - 2011-04-15 01:08:20
|
Subject: hg.virtualcommons 340 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/0d8d8482952e changeset: 340:0d8d8482952e user: Allen Lee <all...@as...> date: Thu Apr 14 18:08:16 2011 -0700 description: removing institution from Participant get_or_create query - it causes problems when we have a user with a given email associated with a different institution. diffstat: vcweb/core/models.py | 5 ++++- vcweb/core/urls.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diffs (27 lines): diff -r 94c99bc93841 -r 0d8d8482952e vcweb/core/models.py --- a/vcweb/core/models.py Thu Apr 14 11:20:34 2011 -0700 +++ b/vcweb/core/models.py Thu Apr 14 18:08:16 2011 -0700 @@ -386,7 +386,10 @@ u = User.objects.create_user(username=email, email=email, password=password) users.append(u) for user in users: - (p, created) = Participant.objects.get_or_create(user=user, institution=institution) + (p, created) = Participant.objects.get_or_create(user=user) + # FIXME: instead of asking for the email suffix, perhaps we just append the institution URL to keep it simpler? + p.institution = institution + p.save() ParticipantExperimentRelationship.objects.create(participant=p, experiment=self, created_by=self.experimenter.user) diff -r 94c99bc93841 -r 0d8d8482952e vcweb/core/urls.py --- a/vcweb/core/urls.py Thu Apr 14 11:20:34 2011 -0700 +++ b/vcweb/core/urls.py Thu Apr 14 18:08:16 2011 -0700 @@ -8,7 +8,7 @@ urlpatterns = patterns('vcweb.core.views', url(r'^dashboard/?$', login_required(Dashboard.as_view()), name='dashboard'), url(r'^accounts/login/$', LoginView.as_view(), name='login'), - url(r'^accounts/logout/$', LogoutView.as_view(), name='logout'), + url(r'^accounts/logout/$', login_required(LogoutView.as_view()), name='logout'), url(r'^accounts/register/$', RegistrationView.as_view(), name='register'), url(r'^accounts/profile/$', 'account_profile', name='profile'), url(r'^participate/(?P<pk>\d+)/instructions', 'instructions', name='instructions'), |
From: Bitbucket <iss...@bi...> - 2011-04-15 01:06:29
|
--- you can reply above this line --- New issue 2: register simple causing duplicate key violations https://bitbucket.org/virtualcommons/vcweb/issue/2/register-simple-causing-duplicate-key alllee on Fri, 15 Apr 2011 03:06:23 +0200: Description: register-simple with sav.sk as an email suffix causing duplicate key violations on participant.user {{{ #!python 2011-04-14 10:25:52,116 ERROR Internal Server Error: /experiment/3/register-simple Traceback (most recent call last): File "/opt/virtualenvs/vcweb/lib/python2.6/site-packages/django/core/handlers/base.py", line 111, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/opt/virtualenvs/vcweb/lib/python2.6/site-packages/django/views/generic/base.py", line 47, in view return self.dispatch(request, *args, **kwargs) File "/opt/virtualenvs/vcweb/lib/python2.6/site-packages/django/utils/decorators.py", line 28, in _wrapper return bound_func(*args, **kwargs) File "/opt/virtualenvs/vcweb/lib/python2.6/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view return view_func(request, *args, **kwargs) File "/opt/virtualenvs/vcweb/lib/python2.6/site-packages/django/utils/decorators.py", line 24, in bound_func return func(self, *args2, **kwargs2) File "/opt/webapps/virtualcommons/vcweb/core/views.py", line 139, in dispatch return super(ExperimenterMixin, self).dispatch(*args, **kwargs) File "/opt/virtualenvs/vcweb/lib/python2.6/site-packages/django/views/generic/base.py", line 68, in dispatch return handler(request, *args, **kwargs) File "/opt/virtualenvs/vcweb/lib/python2.6/site-packages/django/views/generic/edit.py", line 195, in post return super(BaseUpdateView, self).post(request, *args, **kwargs) File "/opt/virtualenvs/vcweb/lib/python2.6/site-packages/django/views/generic/edit.py", line 138, in post return self.form_valid(form) File "/opt/webapps/virtualcommons/vcweb/core/views.py", line 200, in form_valid password=experiment_passcode) File "/opt/webapps/virtualcommons/vcweb/core/models.py", line 411, in setup_test_participants self.register_participants(users=users, institution=institution) File "/opt/webapps/virtualcommons/vcweb/core/models.py", line 389, in register_participants (p, created) = Participant.objects.get_or_create(user=user, institution=institution) File "/opt/virtualenvs/vcweb/lib/python2.6/site-packages/django/db/models/manager.py", line 135, in get_or_create return self.get_query_set().get_or_create(**kwargs) File "/opt/virtualenvs/vcweb/lib/python2.6/site-packages/django/db/models/query.py", line 393, in get_or_create raise e IntegrityError: duplicate key violates unique constraint "core_participant_user_id_key" }}} Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: <vir...@li...> - 2011-04-14 18:20:38
|
Subject: hg.virtualcommons 339 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/94c99bc93841 changeset: 339:94c99bc93841 user: Allen Lee <all...@as...> date: Thu Apr 14 11:20:34 2011 -0700 description: fixing invalid HTML, hasty bugfix/workaround for https://bitbucket.org/virtualcommons/vcweb/issue/1/fix-logout-issues diffstat: vcweb/core/templates/experimenter/register-participants.html | 6 ++++-- vcweb/core/templates/registration/login.html | 2 +- vcweb/core/views.py | 7 +++++-- vcweb/forestry/templates/forestry/participate.html | 6 +++--- vcweb/forestry/views.py | 4 ++-- vcweb/static/css/guarantee/style.css | 4 ++-- 6 files changed, 17 insertions(+), 12 deletions(-) diffs (95 lines): diff -r 793cda6977d6 -r 94c99bc93841 vcweb/core/templates/experimenter/register-participants.html --- a/vcweb/core/templates/experimenter/register-participants.html Thu Apr 14 01:28:32 2011 -0700 +++ b/vcweb/core/templates/experimenter/register-participants.html Thu Apr 14 11:20:34 2011 -0700 @@ -29,7 +29,9 @@ <p> <span style='padding: 3px;' class='ui-state-highlight'><b>There are currently {{experiment.participants.count}} registered participants.</b></span> {% include "includes/form-as-div.html" %} - <button class='submit' type='submit'>Register</button> - <button><a href='/dashboard'>Cancel</a></button> + <div> + <button class='submit' type='submit'>Register</button> + <button><a href='/dashboard'>Cancel</a></button> + </div> </form> {% endblock page %} diff -r 793cda6977d6 -r 94c99bc93841 vcweb/core/templates/registration/login.html --- a/vcweb/core/templates/registration/login.html Thu Apr 14 01:28:32 2011 -0700 +++ b/vcweb/core/templates/registration/login.html Thu Apr 14 11:20:34 2011 -0700 @@ -24,7 +24,7 @@ </p> {% include "includes/form-as-div.html" %} - <button type='submit' class='submit'>Login</button> + <div><button type='submit' class='submit'>Login</button></div> </form> {% endblock page %} diff -r 793cda6977d6 -r 94c99bc93841 vcweb/core/views.py --- a/vcweb/core/views.py Thu Apr 14 01:28:32 2011 -0700 +++ b/vcweb/core/views.py Thu Apr 14 11:20:34 2011 -0700 @@ -74,8 +74,11 @@ commons_user = user.participant elif is_experimenter(user): commons_user = user.experimenter - commons_user.authentication_token = None - commons_user.save() + else: + logger.error("Invalid user: %s" % user) + if commons_user is not None: + commons_user.authentication_token = None + commons_user.save() auth.logout(request) return redirect('home') diff -r 793cda6977d6 -r 94c99bc93841 vcweb/forestry/templates/forestry/participate.html --- a/vcweb/forestry/templates/forestry/participate.html Thu Apr 14 01:28:32 2011 -0700 +++ b/vcweb/forestry/templates/forestry/participate.html Thu Apr 14 11:20:34 2011 -0700 @@ -80,9 +80,9 @@ </label> <input id='harvest-decision-id' style='width: 2em; text-align: right;' type="text" name='harvest_decision' class='required digits' maxlength='1'/> </div> - <button type='submit'> - Harvest - </button> + <div> + <button type='submit'>Harvest</button> + </div> </form> {% else %} <div class='alert ui-corner-all'> diff -r 793cda6977d6 -r 94c99bc93841 vcweb/forestry/views.py --- a/vcweb/forestry/views.py Thu Apr 14 01:28:32 2011 -0700 +++ b/vcweb/forestry/views.py Thu Apr 14 11:20:34 2011 -0700 @@ -61,7 +61,7 @@ logger.warning("No experiment available with id [%s]" % experiment_id) return redirect('core:experimenter_index') -class HarvestRoundData(object): +class ParticipantRoundData(object): pass def generate_participant_history(participant_group_relationship): @@ -69,7 +69,7 @@ experiment = group.experiment participant_history = [] for round_data in experiment.playable_round_data: - data = HarvestRoundData() + data = ParticipantRoundData() data.round_configuration = round_data.round_configuration data.individual_harvest = get_harvest_decision(participant_group_relationship, round_data=round_data) data.group_harvest = get_group_harvest(group, round_data=round_data) diff -r 793cda6977d6 -r 94c99bc93841 vcweb/static/css/guarantee/style.css --- a/vcweb/static/css/guarantee/style.css Thu Apr 14 01:28:32 2011 -0700 +++ b/vcweb/static/css/guarantee/style.css Thu Apr 14 11:20:34 2011 -0700 @@ -74,8 +74,8 @@ background: url(/static/images/guarantee/img04.gif) no-repeat left top; text-decoration: none; text-align: center; - font-family: Arial, Helvetica, sans-serif; - font-size: 1em; + font-family: Helvetica, sans-serif; + font-size: 0.95em; color: #FFFFFF; } |
From: Bitbucket <iss...@bi...> - 2011-04-14 18:03:43
|
--- you can reply above this line --- New issue 1: fix logout issues https://bitbucket.org/virtualcommons/vcweb/issue/1/fix-logout-issues virtualcommons on Thu, 14 Apr 2011 20:03:37 +0200: Description: Likely due to duplicate login sessions (somehow the logged-in user isn't an experimenter or participant?). Also, logout should be anonymous_required. {{{ #!python 2011-04-14 10:41:20,231 ERROR Internal Server Error: /accounts/logout/ Traceback (most recent call last): File "/opt/virtualenvs/vcweb/lib/python2.6/site-packages/django/core/handlers/base.py", line 111, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/opt/virtualenvs/vcweb/lib/python2.6/site-packages/django/views/generic/base.py", line 47, in view return self.dispatch(request, *args, **kwargs) File "/opt/virtualenvs/vcweb/lib/python2.6/site-packages/django/views/generic/base.py", line 68, in dispatch return handler(request, *args, **kwargs) File "/opt/webapps/virtualcommons/vcweb/core/views.py", line 77, in get commons_user.authentication_token = None AttributeError: 'NoneType' object has no attribute 'authentication_token' }}} Responsible: alllee -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. |
From: <vir...@li...> - 2011-04-14 08:28:37
|
Subject: hg.virtualcommons 338 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/793cda6977d6 changeset: 338:793cda6977d6 user: Allen Lee <all...@as...> date: Thu Apr 14 01:28:32 2011 -0700 description: minor ui changes diffstat: vcweb/core/forms.py | 5 +++-- vcweb/core/templates/registration/profile.html | 6 +++--- vcweb/static/css/guarantee/style.css | 4 ++-- vcweb/static/css/style.css | 7 +++---- 4 files changed, 11 insertions(+), 11 deletions(-) diffs (83 lines): diff -r ba1aad6ac06e -r 793cda6977d6 vcweb/core/forms.py --- a/vcweb/core/forms.py Thu Apr 14 00:45:57 2011 -0700 +++ b/vcweb/core/forms.py Thu Apr 14 01:28:32 2011 -0700 @@ -104,8 +104,9 @@ class RegisterSimpleParticipantsForm(RegisterParticipantsForm): - email_suffix = forms.CharField(min_length=3, help_text='An email suffix without the "@" symbol. Generated participants will have usernames of the format s1..sn@email_suffix. For example, if you register 20 participants with an email suffix of example.edu, the system will generate 20 participants with usernames ranging from s1...@ex..., s2...@ex..., s3...@ex..., ... s2...@ex....') - number_of_participants = forms.IntegerField(min_value=1, help_text='The number of participants to generate.') + email_suffix = forms.CharField(min_length=3, initial='asu.edu', + help_text='An email suffix without the "@" symbol. Generated participants will have usernames of the format s1..sn@email_suffix. For example, if you register 20 participants with an email suffix of example.edu, the system will generate 20 participants with usernames ranging from s1...@ex..., s2...@ex..., s3...@ex..., ... s2...@ex....') + number_of_participants = forms.IntegerField(min_value=1, help_text='The number of participants to register with this experiment.') class RegisterEmailListParticipantsForm(RegisterParticipantsForm): participant_emails = EmailListField(label="Participant emails", help_text='A comma or newline delimited list of emails to register as participants for this experiment.') diff -r ba1aad6ac06e -r 793cda6977d6 vcweb/core/templates/registration/profile.html --- a/vcweb/core/templates/registration/profile.html Thu Apr 14 00:45:57 2011 -0700 +++ b/vcweb/core/templates/registration/profile.html Thu Apr 14 01:28:32 2011 -0700 @@ -12,11 +12,11 @@ {% block title %}Your Account{% endblock %} -{% block content %} +{% block page %} <form id='profileForm' action='' method='post'> <h3>{{ request.user.get_full_name }}</h3> - {{ form.as_p }} + {% include "includes/form-as-div.html" %} </form> -{% endblock content %} +{% endblock %} diff -r ba1aad6ac06e -r 793cda6977d6 vcweb/static/css/guarantee/style.css --- a/vcweb/static/css/guarantee/style.css Thu Apr 14 00:45:57 2011 -0700 +++ b/vcweb/static/css/guarantee/style.css Thu Apr 14 01:28:32 2011 -0700 @@ -75,8 +75,7 @@ text-decoration: none; text-align: center; font-family: Arial, Helvetica, sans-serif; - font-size: 0.8em; - font-weight: bold; + font-size: 1em; color: #FFFFFF; } @@ -86,6 +85,7 @@ #menu .active a { background: url(/static/images/guarantee/img03.gif) no-repeat left top; + color: #FFFFF0; } #menu .first { diff -r ba1aad6ac06e -r 793cda6977d6 vcweb/static/css/style.css --- a/vcweb/static/css/style.css Thu Apr 14 00:45:57 2011 -0700 +++ b/vcweb/static/css/style.css Thu Apr 14 01:28:32 2011 -0700 @@ -1,5 +1,5 @@ body { - font-family: /*"Lucida Grande", "Trebuchet MS",*/ Arial, Helvetica, Tahoma, Verdana, sans-serif; + font-family: /*"Lucida Grande", "Trebuchet MS",*/ Arial, Verdana, Tahoma, Helvetica, sans-serif; font-size: 1.1em; } a.external { @@ -41,7 +41,7 @@ span.label { float: left; text-align: right; - width: 13em; + width: 15em; font-weight: bolder; margin-top: 0.37em; margin-right: 0.37em; @@ -52,8 +52,7 @@ font-size: 0.9em; } button.submit { - position: relative; - margin-left: 188px; + margin-left: 215px; } ul.messages { |
From: <vir...@li...> - 2011-04-14 07:46:05
|
Subject: hg.virtualcommons 337 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/ba1aad6ac06e changeset: 337:ba1aad6ac06e user: Allen Lee <all...@as...> date: Thu Apr 14 00:45:57 2011 -0700 description: updating interface diffstat: vcweb/forestry/templates/forestry/participate.html | 14 ++++++++------ vcweb/forestry/templates/forestry/wait.html | 2 +- vcweb/static/css/style.css | 7 ------- 3 files changed, 9 insertions(+), 14 deletions(-) diffs (68 lines): diff -r 59d0f0e65a09 -r ba1aad6ac06e vcweb/forestry/templates/forestry/participate.html --- a/vcweb/forestry/templates/forestry/participate.html Thu Apr 14 00:22:40 2011 -0700 +++ b/vcweb/forestry/templates/forestry/participate.html Thu Apr 14 00:45:57 2011 -0700 @@ -37,6 +37,7 @@ s.send(createSubmitEvent(harvestDecisionValue)); return true; }); + $('button').button(); }); </script> {% endblock %} @@ -74,13 +75,14 @@ {% if max_harvest_decision > 0 %} <form id='forestry-form' action='' method='post'> <div class='field'> - <br/> - <label for='harvest-decision-id'>How many trees will you harvest this round? <br/><span class='small-font bold'>Choose a number between 0 and {{ max_harvest_decision }}</span>:</label> - <input id='harvest-decision-id' type="text" name='harvest_decision' class='required digits two-digits' maxlength='1'/> + <label for='harvest-decision-id'>How many trees will you harvest this round? <br/> + <span>Enter a number between 0 and {{ max_harvest_decision }}</span>: + </label> + <input id='harvest-decision-id' style='width: 2em; text-align: right;' type="text" name='harvest_decision' class='required digits' maxlength='1'/> </div> - <div class='field'> - <input type='submit' value='Harvest' /> - </div> + <button type='submit'> + Harvest + </button> </form> {% else %} <div class='alert ui-corner-all'> diff -r 59d0f0e65a09 -r ba1aad6ac06e vcweb/forestry/templates/forestry/wait.html --- a/vcweb/forestry/templates/forestry/wait.html Thu Apr 14 00:22:40 2011 -0700 +++ b/vcweb/forestry/templates/forestry/wait.html Thu Apr 14 00:45:57 2011 -0700 @@ -57,7 +57,7 @@ <th style='width:12em;' class='tooltip' title='The total number of trees harvested by your group in this round.'> Total group harvest decisions (B) </th> - <th class='tooltip' title='The trees that regrew during this round (C = (A - B) * .10)'>Trees regrown (C)</th> + <th class='tooltip' title='The trees that regrew during this round (C = (A - B) * 0.10)'>Trees regrown (C)</th> <th class='tooltip' title='The number of trees available at the end of the round (A - B + C = D).'>Final # trees (D)</th></tr> </thead> <tbody> diff -r 59d0f0e65a09 -r ba1aad6ac06e vcweb/static/css/style.css --- a/vcweb/static/css/style.css Thu Apr 14 00:22:40 2011 -0700 +++ b/vcweb/static/css/style.css Thu Apr 14 00:45:57 2011 -0700 @@ -24,9 +24,6 @@ h3 { font-size: 1.2em; } h4 { font-size: 1.0em; } h5 { font-size: 0.9em; } -input[type=text], input[type=password] { - width: 12em; -} input.error { padding: 0; margin: 0; @@ -41,10 +38,6 @@ padding-left: 1.1em; margin-left: 0.3em; } -input.two-digits { - width: 2em; - text-align: right; -} span.label { float: left; text-align: right; |
From: <vir...@li...> - 2011-04-14 07:22:46
|
Subject: hg.virtualcommons 336 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/59d0f0e65a09 changeset: 336:59d0f0e65a09 user: Allen Lee <all...@as...> date: Thu Apr 14 00:22:40 2011 -0700 description: ordering, making button text a smidgen smaller diffstat: vcweb/core/models.py | 3 +++ vcweb/static/css/style.css | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-) diffs (26 lines): diff -r 79be44934eae -r 59d0f0e65a09 vcweb/core/models.py --- a/vcweb/core/models.py Wed Apr 13 21:48:46 2011 -0700 +++ b/vcweb/core/models.py Thu Apr 14 00:22:40 2011 -0700 @@ -545,6 +545,9 @@ def __unicode__(self): return u"%s #%s | %s" % (self.experiment_metadata.title, self.pk, self.experimenter) + class Meta: + ordering = ['date_created', 'status'] + class RoundConfiguration(models.Model): # maps round type name to (description, default_template_name) ROUND_TYPES_DICT = dict(REGULAR=('Regular interactive experiment round', 'participate.html'), diff -r 79be44934eae -r 59d0f0e65a09 vcweb/static/css/style.css --- a/vcweb/static/css/style.css Wed Apr 13 21:48:46 2011 -0700 +++ b/vcweb/static/css/style.css Thu Apr 14 00:22:40 2011 -0700 @@ -55,6 +55,9 @@ display:inline; font-size: 0.8em; } +span.ui-button-text { + font-size: 0.9em; +} button.submit { position: relative; margin-left: 188px; |
From: <vir...@li...> - 2011-04-14 04:48:51
|
Subject: hg.virtualcommons 335 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/79be44934eae changeset: 335:79be44934eae user: Allen Lee <all...@as...> date: Wed Apr 13 21:48:46 2011 -0700 description: replacing jquery-ui with CDN diffstat: vcweb/static/css/pepper-grinder/jquery-ui-1.8.10.custom.css | 564 -------------- vcweb/static/js/jquery-ui-1.8.10.custom.min.js | 705 ----------------- 2 files changed, 0 insertions(+), 1269 deletions(-) diffs (1287 lines): diff -r 15c1569ce91d -r 79be44934eae vcweb/static/css/pepper-grinder/jquery-ui-1.8.10.custom.css --- a/vcweb/static/css/pepper-grinder/jquery-ui-1.8.10.custom.css Wed Apr 13 21:47:07 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,573 +0,0 @@ -/* - * jQuery UI CSS Framework 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Theming/API - */ - -/* Layout helpers -----------------------------------*/ -.ui-helper-hidden { display: none; } -.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } -.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } -.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } -.ui-helper-clearfix { display: inline-block; } -/* required comment for clearfix to work in Opera \*/ -* html .ui-helper-clearfix { height:1%; } -.ui-helper-clearfix { display:block; } -/* end clearfix */ -.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } - - -/* Interaction Cues -----------------------------------*/ -.ui-state-disabled { cursor: default !important; } - - -/* Icons -----------------------------------*/ - -/* states and images */ -.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } - - -/* Misc visuals -----------------------------------*/ - -/* Overlays */ -.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } - - -/* - * jQuery UI CSS Framework 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Theming/API - * - * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=6px&bgColorHeader=ffffff&bgTextureHeader=23_fine_grain.png&bgImgOpacityHeader=15&borderColorHeader=d4d1bf&fcHeader=453821&iconColorHeader=b83400&bgColorContent=eceadf&bgTextureContent=23_fine_grain.png&bgImgOpacityContent=10&borderColorContent=d9d6c4&fcContent=1f1f1f&iconColorContent=222222&bgColorDefault=f8f7f6&bgTextureDefault=23_fine_grain.png&bgImgOpacityDefault=10&borderColorDefault=cbc7bd&fcDefault=654b24&iconColorDefault=b83400&bgColorHover=654b24&bgTextureHover=23_fine_grain.png&bgImgOpacityHover=65&borderColorHover=654b24&fcHover=ffffff&iconColorHover=ffffff&bgColorActive=eceadf&bgTextureActive=23_fine_grain.png&bgImgOpacityActive=15&borderColorActive=d9d6c4&fcActive=140f06&iconColorActive=8c291d&bgColorHighlight=f7f3de&bgTextureHighlight=23_fine_grain.png&bgImgOpacityHighlight=15&borderColorHighlight=b2a266&fcHighlight=3a3427&iconColorHighlight=3572ac&bgColorError=b83400&bgTextureError=23_fine_grain.png&bgImgOpacityError=68&borderColorError=681818&fcError=ffffff&iconColorError=fbdb93&bgColorOverlay=6e4f1c&bgTextureOverlay=16_diagonal_maze.png&bgImgOpacityOverlay=20&opacityOverlay=60&bgColorShadow=000000&bgTextureShadow=16_diagonal_maze.png&bgImgOpacityShadow=40&opacityShadow=60&thicknessShadow=5px&offsetTopShadow=0&offsetLeftShadow=-10px&cornerRadiusShadow=18px - */ - - -/* Component containers -----------------------------------*/ -.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; } -.ui-widget .ui-widget { font-size: 1em; } -.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; } -.ui-widget-content { border: 1px solid #d9d6c4; background: #eceadf url(/static/images/pepper-grinder/ui-bg_fine-grain_10_eceadf_60x60.png) 50% 50% repeat; color: #1f1f1f; } -.ui-widget-content a { color: #1f1f1f; } -.ui-widget-header { border: 1px solid #d4d1bf; background: #ffffff url(/static/images/pepper-grinder/ui-bg_fine-grain_15_ffffff_60x60.png) 50% 50% repeat; color: #453821; font-weight: bold; } -.ui-widget-header a { color: #453821; } - -/* Interaction states -----------------------------------*/ -.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cbc7bd; background: #f8f7f6 url(/static/images/pepper-grinder/ui-bg_fine-grain_10_f8f7f6_60x60.png) 50% 50% repeat; font-weight: bold; color: #654b24; } -.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #654b24; text-decoration: none; } -.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #654b24; background: #654b24 url(/static/images/pepper-grinder/ui-bg_fine-grain_65_654b24_60x60.png) 50% 50% repeat; font-weight: bold; color: #ffffff; } -.ui-state-hover a, .ui-state-hover a:hover { color: #ffffff; text-decoration: none; } -.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #d9d6c4; background: #eceadf url(/static/images/pepper-grinder/ui-bg_fine-grain_15_eceadf_60x60.png) 50% 50% repeat; font-weight: bold; color: #140f06; } -.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #140f06; text-decoration: none; } -.ui-widget :active { outline: none; } - -/* Interaction Cues -----------------------------------*/ -.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #b2a266; background: #f7f3de url(/static/images/pepper-grinder/ui-bg_fine-grain_15_f7f3de_60x60.png) 50% 50% repeat; color: #3a3427; } -.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #3a3427; } -.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #681818; background: #b83400 url(/static/images/pepper-grinder/ui-bg_fine-grain_68_b83400_60x60.png) 50% 50% repeat; color: #ffffff; } -.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; } -.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; } -.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } -.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } -.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } - -/* Icons -----------------------------------*/ - -/* states and images */ -.ui-icon { width: 16px; height: 16px; background-image: url(/static/images/pepper-grinder/ui-icons_222222_256x240.png); } -.ui-widget-content .ui-icon {background-image: url(/static/images/pepper-grinder/ui-icons_222222_256x240.png); } -.ui-widget-header .ui-icon {background-image: url(/static/images/pepper-grinder/ui-icons_b83400_256x240.png); } -.ui-state-default .ui-icon { background-image: url(/static/images/pepper-grinder/ui-icons_b83400_256x240.png); } -.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(/static/images/pepper-grinder/ui-icons_ffffff_256x240.png); } -.ui-state-active .ui-icon {background-image: url(/static/images/pepper-grinder/ui-icons_8c291d_256x240.png); } -.ui-state-highlight .ui-icon {background-image: url(/static/images/pepper-grinder/ui-icons_3572ac_256x240.png); } -.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(/static/images/pepper-grinder/ui-icons_fbdb93_256x240.png); } - -/* positioning */ -.ui-icon-carat-1-n { background-position: 0 0; } -.ui-icon-carat-1-ne { background-position: -16px 0; } -.ui-icon-carat-1-e { background-position: -32px 0; } -.ui-icon-carat-1-se { background-position: -48px 0; } -.ui-icon-carat-1-s { background-position: -64px 0; } -.ui-icon-carat-1-sw { background-position: -80px 0; } -.ui-icon-carat-1-w { background-position: -96px 0; } -.ui-icon-carat-1-nw { background-position: -112px 0; } -.ui-icon-carat-2-n-s { background-position: -128px 0; } -.ui-icon-carat-2-e-w { background-position: -144px 0; } -.ui-icon-triangle-1-n { background-position: 0 -16px; } -.ui-icon-triangle-1-ne { background-position: -16px -16px; } -.ui-icon-triangle-1-e { background-position: -32px -16px; } -.ui-icon-triangle-1-se { background-position: -48px -16px; } -.ui-icon-triangle-1-s { background-position: -64px -16px; } -.ui-icon-triangle-1-sw { background-position: -80px -16px; } -.ui-icon-triangle-1-w { background-position: -96px -16px; } -.ui-icon-triangle-1-nw { background-position: -112px -16px; } -.ui-icon-triangle-2-n-s { background-position: -128px -16px; } -.ui-icon-triangle-2-e-w { background-position: -144px -16px; } -.ui-icon-arrow-1-n { background-position: 0 -32px; } -.ui-icon-arrow-1-ne { background-position: -16px -32px; } -.ui-icon-arrow-1-e { background-position: -32px -32px; } -.ui-icon-arrow-1-se { background-position: -48px -32px; } -.ui-icon-arrow-1-s { background-position: -64px -32px; } -.ui-icon-arrow-1-sw { background-position: -80px -32px; } -.ui-icon-arrow-1-w { background-position: -96px -32px; } -.ui-icon-arrow-1-nw { background-position: -112px -32px; } -.ui-icon-arrow-2-n-s { background-position: -128px -32px; } -.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } -.ui-icon-arrow-2-e-w { background-position: -160px -32px; } -.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } -.ui-icon-arrowstop-1-n { background-position: -192px -32px; } -.ui-icon-arrowstop-1-e { background-position: -208px -32px; } -.ui-icon-arrowstop-1-s { background-position: -224px -32px; } -.ui-icon-arrowstop-1-w { background-position: -240px -32px; } -.ui-icon-arrowthick-1-n { background-position: 0 -48px; } -.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } -.ui-icon-arrowthick-1-e { background-position: -32px -48px; } -.ui-icon-arrowthick-1-se { background-position: -48px -48px; } -.ui-icon-arrowthick-1-s { background-position: -64px -48px; } -.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } -.ui-icon-arrowthick-1-w { background-position: -96px -48px; } -.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } -.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } -.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } -.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } -.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } -.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } -.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } -.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } -.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } -.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } -.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } -.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } -.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } -.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } -.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } -.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } -.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } -.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } -.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } -.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } -.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } -.ui-icon-arrow-4 { background-position: 0 -80px; } -.ui-icon-arrow-4-diag { background-position: -16px -80px; } -.ui-icon-extlink { background-position: -32px -80px; } -.ui-icon-newwin { background-position: -48px -80px; } -.ui-icon-refresh { background-position: -64px -80px; } -.ui-icon-shuffle { background-position: -80px -80px; } -.ui-icon-transfer-e-w { background-position: -96px -80px; } -.ui-icon-transferthick-e-w { background-position: -112px -80px; } -.ui-icon-folder-collapsed { background-position: 0 -96px; } -.ui-icon-folder-open { background-position: -16px -96px; } -.ui-icon-document { background-position: -32px -96px; } -.ui-icon-document-b { background-position: -48px -96px; } -.ui-icon-note { background-position: -64px -96px; } -.ui-icon-mail-closed { background-position: -80px -96px; } -.ui-icon-mail-open { background-position: -96px -96px; } -.ui-icon-suitcase { background-position: -112px -96px; } -.ui-icon-comment { background-position: -128px -96px; } -.ui-icon-person { background-position: -144px -96px; } -.ui-icon-print { background-position: -160px -96px; } -.ui-icon-trash { background-position: -176px -96px; } -.ui-icon-locked { background-position: -192px -96px; } -.ui-icon-unlocked { background-position: -208px -96px; } -.ui-icon-bookmark { background-position: -224px -96px; } -.ui-icon-tag { background-position: -240px -96px; } -.ui-icon-home { background-position: 0 -112px; } -.ui-icon-flag { background-position: -16px -112px; } -.ui-icon-calendar { background-position: -32px -112px; } -.ui-icon-cart { background-position: -48px -112px; } -.ui-icon-pencil { background-position: -64px -112px; } -.ui-icon-clock { background-position: -80px -112px; } -.ui-icon-disk { background-position: -96px -112px; } -.ui-icon-calculator { background-position: -112px -112px; } -.ui-icon-zoomin { background-position: -128px -112px; } -.ui-icon-zoomout { background-position: -144px -112px; } -.ui-icon-search { background-position: -160px -112px; } -.ui-icon-wrench { background-position: -176px -112px; } -.ui-icon-gear { background-position: -192px -112px; } -.ui-icon-heart { background-position: -208px -112px; } -.ui-icon-star { background-position: -224px -112px; } -.ui-icon-link { background-position: -240px -112px; } -.ui-icon-cancel { background-position: 0 -128px; } -.ui-icon-plus { background-position: -16px -128px; } -.ui-icon-plusthick { background-position: -32px -128px; } -.ui-icon-minus { background-position: -48px -128px; } -.ui-icon-minusthick { background-position: -64px -128px; } -.ui-icon-close { background-position: -80px -128px; } -.ui-icon-closethick { background-position: -96px -128px; } -.ui-icon-key { background-position: -112px -128px; } -.ui-icon-lightbulb { background-position: -128px -128px; } -.ui-icon-scissors { background-position: -144px -128px; } -.ui-icon-clipboard { background-position: -160px -128px; } -.ui-icon-copy { background-position: -176px -128px; } -.ui-icon-contact { background-position: -192px -128px; } -.ui-icon-image { background-position: -208px -128px; } -.ui-icon-video { background-position: -224px -128px; } -.ui-icon-script { background-position: -240px -128px; } -.ui-icon-alert { background-position: 0 -144px; } -.ui-icon-info { background-position: -16px -144px; } -.ui-icon-notice { background-position: -32px -144px; } -.ui-icon-help { background-position: -48px -144px; } -.ui-icon-check { background-position: -64px -144px; } -.ui-icon-bullet { background-position: -80px -144px; } -.ui-icon-radio-off { background-position: -96px -144px; } -.ui-icon-radio-on { background-position: -112px -144px; } -.ui-icon-pin-w { background-position: -128px -144px; } -.ui-icon-pin-s { background-position: -144px -144px; } -.ui-icon-play { background-position: 0 -160px; } -.ui-icon-pause { background-position: -16px -160px; } -.ui-icon-seek-next { background-position: -32px -160px; } -.ui-icon-seek-prev { background-position: -48px -160px; } -.ui-icon-seek-end { background-position: -64px -160px; } -.ui-icon-seek-start { background-position: -80px -160px; } -/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ -.ui-icon-seek-first { background-position: -80px -160px; } -.ui-icon-stop { background-position: -96px -160px; } -.ui-icon-eject { background-position: -112px -160px; } -.ui-icon-volume-off { background-position: -128px -160px; } -.ui-icon-volume-on { background-position: -144px -160px; } -.ui-icon-power { background-position: 0 -176px; } -.ui-icon-signal-diag { background-position: -16px -176px; } -.ui-icon-signal { background-position: -32px -176px; } -.ui-icon-battery-0 { background-position: -48px -176px; } -.ui-icon-battery-1 { background-position: -64px -176px; } -.ui-icon-battery-2 { background-position: -80px -176px; } -.ui-icon-battery-3 { background-position: -96px -176px; } -.ui-icon-circle-plus { background-position: 0 -192px; } -.ui-icon-circle-minus { background-position: -16px -192px; } -.ui-icon-circle-close { background-position: -32px -192px; } -.ui-icon-circle-triangle-e { background-position: -48px -192px; } -.ui-icon-circle-triangle-s { background-position: -64px -192px; } -.ui-icon-circle-triangle-w { background-position: -80px -192px; } -.ui-icon-circle-triangle-n { background-position: -96px -192px; } -.ui-icon-circle-arrow-e { background-position: -112px -192px; } -.ui-icon-circle-arrow-s { background-position: -128px -192px; } -.ui-icon-circle-arrow-w { background-position: -144px -192px; } -.ui-icon-circle-arrow-n { background-position: -160px -192px; } -.ui-icon-circle-zoomin { background-position: -176px -192px; } -.ui-icon-circle-zoomout { background-position: -192px -192px; } -.ui-icon-circle-check { background-position: -208px -192px; } -.ui-icon-circlesmall-plus { background-position: 0 -208px; } -.ui-icon-circlesmall-minus { background-position: -16px -208px; } -.ui-icon-circlesmall-close { background-position: -32px -208px; } -.ui-icon-squaresmall-plus { background-position: -48px -208px; } -.ui-icon-squaresmall-minus { background-position: -64px -208px; } -.ui-icon-squaresmall-close { background-position: -80px -208px; } -.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } -.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } -.ui-icon-grip-solid-vertical { background-position: -32px -224px; } -.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } -.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } -.ui-icon-grip-diagonal-se { background-position: -80px -224px; } - - -/* Misc visuals -----------------------------------*/ - -/* Corner radius */ -.ui-corner-tl { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; } -.ui-corner-tr { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } -.ui-corner-bl { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } -.ui-corner-br { -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } -.ui-corner-top { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; } -.ui-corner-bottom { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } -.ui-corner-right { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; } -.ui-corner-left { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; } -.ui-corner-all { -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; } - -/* Overlays */ -.ui-widget-overlay { background: #6e4f1c url(/static/images/pepper-grinder/ui-bg_diagonal-maze_20_6e4f1c_10x10.png) 50% 50% repeat; opacity: .60;filter:Alpha(Opacity=60); } -.ui-widget-shadow { margin: 0 0 0 -10px; padding: 5px; background: #000000 url(/static/images/pepper-grinder/ui-bg_diagonal-maze_40_000000_10x10.png) 50% 50% repeat; opacity: .60;filter:Alpha(Opacity=60); -moz-border-radius: 18px; -webkit-border-radius: 18px; border-radius: 18px; }/* - * jQuery UI Resizable 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Resizable#theming - */ -.ui-resizable { position: relative;} -.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} -.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } -.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } -.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } -.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } -.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } -.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } -.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } -.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } -.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* - * jQuery UI Selectable 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Selectable#theming - */ -.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } -/* - * jQuery UI Accordion 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Accordion#theming - */ -/* IE/Win - Fix animation bug - #4615 */ -.ui-accordion { width: 100%; } -.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } -.ui-accordion .ui-accordion-li-fix { display: inline; } -.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } -.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } -.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } -.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } -.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } -.ui-accordion .ui-accordion-content-active { display: block; } -/* - * jQuery UI Autocomplete 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Autocomplete#theming - */ -.ui-autocomplete { position: absolute; cursor: default; } - -/* workarounds */ -* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ - -/* - * jQuery UI Menu 1.8.10 - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Menu#theming - */ -.ui-menu { - list-style:none; - padding: 2px; - margin: 0; - display:block; - float: left; -} -.ui-menu .ui-menu { - margin-top: -3px; -} -.ui-menu .ui-menu-item { - margin:0; - padding: 0; - zoom: 1; - float: left; - clear: left; - width: 100%; -} -.ui-menu .ui-menu-item a { - text-decoration:none; - display:block; - padding:.2em .4em; - line-height:1.5; - zoom:1; -} -.ui-menu .ui-menu-item a.ui-state-hover, -.ui-menu .ui-menu-item a.ui-state-active { - font-weight: normal; - margin: -1px; -} -/* - * jQuery UI Button 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Button#theming - */ -.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ -.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ -button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ -.ui-button-icons-only { width: 3.4em; } -button.ui-button-icons-only { width: 3.7em; } - -/*button text element */ -.ui-button .ui-button-text { display: block; line-height: 1.4; } -.ui-button-text-only .ui-button-text { padding: .4em 1em; } -.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } -.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } -.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } -.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } -/* no icon support for input elements, provide padding by default */ -input.ui-button { padding: .4em 1em; } - -/*button icon element(s) */ -.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } -.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } -.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } -.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } -.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } - -/*button sets*/ -.ui-buttonset { margin-right: 7px; } -.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } - -/* workarounds */ -button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ -/* - * jQuery UI Dialog 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Dialog#theming - */ -.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } -.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } -.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } -.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } -.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } -.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } -.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } -.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } -.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } -.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } -.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } -.ui-draggable .ui-dialog-titlebar { cursor: move; } -/* - * jQuery UI Slider 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Slider#theming - */ -.ui-slider { position: relative; text-align: left; } -.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } -.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } - -.ui-slider-horizontal { height: .8em; } -.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } -.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } -.ui-slider-horizontal .ui-slider-range-min { left: 0; } -.ui-slider-horizontal .ui-slider-range-max { right: 0; } - -.ui-slider-vertical { width: .8em; height: 100px; } -.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } -.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } -.ui-slider-vertical .ui-slider-range-min { bottom: 0; } -.ui-slider-vertical .ui-slider-range-max { top: 0; }/* - * jQuery UI Tabs 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Tabs#theming - */ -.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ -.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } -.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } -.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } -.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ -.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } -.ui-tabs .ui-tabs-hide { display: none !important; } -/* - * jQuery UI Datepicker 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Datepicker#theming - */ -.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } -.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } -.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } -.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } -.ui-datepicker .ui-datepicker-prev { left:2px; } -.ui-datepicker .ui-datepicker-next { right:2px; } -.ui-datepicker .ui-datepicker-prev-hover { left:1px; } -.ui-datepicker .ui-datepicker-next-hover { right:1px; } -.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } -.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } -.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } -.ui-datepicker select.ui-datepicker-month-year {width: 100%;} -.ui-datepicker select.ui-datepicker-month, -.ui-datepicker select.ui-datepicker-year { width: 49%;} -.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } -.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } -.ui-datepicker td { border: 0; padding: 1px; } -.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } -.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } -.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } -.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } - -/* with multiple calendars */ -.ui-datepicker.ui-datepicker-multi { width:auto; } -.ui-datepicker-multi .ui-datepicker-group { float:left; } -.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } -.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } -.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } -.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } -.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } -.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } -.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } -.ui-datepicker-row-break { clear:both; width:100%; } - -/* RTL support */ -.ui-datepicker-rtl { direction: rtl; } -.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } -.ui-datepicker-rtl .ui-datepicker-group { float:right; } -.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } -.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } - -/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ -.ui-datepicker-cover { - display: none; /*sorry for IE5*/ - display/**/: block; /*sorry for IE5*/ - position: absolute; /*must have*/ - z-index: -1; /*must have*/ - filter: mask(); /*must have*/ - top: -4px; /*must have*/ - left: -4px; /*must have*/ - width: 200px; /*must have*/ - height: 200px; /*must have*/ -}/* - * jQuery UI Progressbar 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar#theming - */ -.ui-progressbar { height:2em; text-align: left; } -.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } diff -r 15c1569ce91d -r 79be44934eae vcweb/static/js/jquery-ui-1.8.10.custom.min.js --- a/vcweb/static/js/jquery-ui-1.8.10.custom.min.js Wed Apr 13 21:47:07 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,705 +0,0 @@ -/*! - * jQuery UI 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI - */ -(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.10",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106, -NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this, -"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position"); -if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f, -"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h, -d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}}); -c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&& -b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery); -;/*! - * jQuery UI Widget 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Widget - */ -(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h, -a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h; -e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options, -this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")}, -widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this}, -enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery); -;/*! - * jQuery UI Mouse 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Mouse - * - * Depends: - * jquery.ui.widget.js - */ -(function(c){c.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(b){return a._mouseDown(b)}).bind("click."+this.widgetName,function(b){if(true===c.data(b.target,a.widgetName+".preventClickEvent")){c.removeData(b.target,a.widgetName+".preventClickEvent");b.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent= -a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var b=this,e=a.which==1,f=typeof this.options.cancel=="string"?c(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){b.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted= -this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}this._mouseMoveDelegate=function(d){return b._mouseMove(d)};this._mouseUpDelegate=function(d){return b._mouseUp(d)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return a.originalEvent.mouseHandled=true}},_mouseMove:function(a){if(c.browser.msie&&!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a); -return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;a.target==this._mouseDownEvent.target&&c.data(a.target,this.widgetName+".preventClickEvent", -true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery); -;/* - * jQuery UI Position 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Position - */ -(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY, -left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+= -k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-= -m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left= -d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+= -a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b), -g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery); -;/* - * jQuery UI Draggable 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Draggables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper== -"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b= -this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;return true},_mouseStart:function(a){var b=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top- -this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions(); -d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis|| -this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&& -this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this== -a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone():this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]|| -0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0], -this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top- -(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment== -"parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[(a.containment=="document"?0:d(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,(a.containment=="document"?0:d(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"? -0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){var b=d(a.containment)[0];if(b){a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"), -10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}}else if(a.containment.constructor== -Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop(): -f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,g=a.pageY; -if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])e=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])e=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/ -b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;e=this.originalPageX+Math.round((e-this.originalPageX)/b.grid[0])*b.grid[0];e=this.containment?!(e-this.offset.click.left<this.containment[0]||e-this.offset.click.left>this.containment[2])?e:!(e-this.offset.click.left<this.containment[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:g-this.offset.click.top- -this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!= -this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.origi... [truncated message content] |
From: <vir...@li...> - 2011-04-14 04:47:11
|
Subject: hg.virtualcommons 334 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/15c1569ce91d changeset: 334:15c1569ce91d user: Allen Lee <all...@as...> date: Wed Apr 13 21:47:07 2011 -0700 description: removing dead code diffstat: vcweb/vcweb-gevent.py | 12 ------------ 1 files changed, 0 insertions(+), 12 deletions(-) diffs (16 lines): diff -r e4c58e47350e -r 15c1569ce91d vcweb/vcweb-gevent.py --- a/vcweb/vcweb-gevent.py Wed Apr 13 21:46:19 2011 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#!/usr/bin/env python - -from gevent import monkey; monkey.patch_all() -from gevent import WSGIServer - -import sys -import os - -sys.path.append('..') -os.environ['DJANGO_SETTINGS_MODULE'] = 'vcweb.settings' - - |
From: <vir...@li...> - 2011-04-14 04:46:24
|
Subject: hg.virtualcommons 333 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/e4c58e47350e changeset: 333:e4c58e47350e user: Allen Lee <all...@as...> date: Wed Apr 13 21:46:19 2011 -0700 description: updating jquery version diffstat: vcweb/core/templates/base.html | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (13 lines): diff -r 7cdd36c8cb67 -r e4c58e47350e vcweb/core/templates/base.html --- a/vcweb/core/templates/base.html Wed Apr 13 21:39:50 2011 -0700 +++ b/vcweb/core/templates/base.html Wed Apr 13 21:46:19 2011 -0700 @@ -11,8 +11,8 @@ <link href="/static/css/guarantee/style.css" rel="stylesheet" type="text/css" media="screen" /> <link href="/static/css/style.css" rel="stylesheet" type="text/css" media="screen" /> <!-- vcweb common js --> + <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script> <script type='text/javascript' src='/static/js/common.js'></script> - <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js'></script> <script type='text/javascript' src='/static/js/jquery.qtip-1.0.0-rc3.min.js'></script> {% include "includes/jquery.ui.html" %} {% dajaxice_js_import %} |
From: <vir...@li...> - 2011-04-14 04:40:05
|
Subject: hg.virtualcommons 332 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/7cdd36c8cb67 changeset: 332:7cdd36c8cb67 user: Allen Lee <all...@as...> date: Wed Apr 13 21:39:50 2011 -0700 description: updated apache vhost static alias diffstat: vcweb/vcweb.apache.vhost | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-) diffs (15 lines): diff -r 6049dc6a4e95 -r 7cdd36c8cb67 vcweb/vcweb.apache.vhost --- a/vcweb/vcweb.apache.vhost Wed Apr 13 18:10:53 2011 -0700 +++ b/vcweb/vcweb.apache.vhost Wed Apr 13 21:39:50 2011 -0700 @@ -4,10 +4,7 @@ DocumentRoot /var/www/vcweb ServerName vcweb.asu.edu -# FIXME: replace in django 1.3 with django.contrib.staticfiles - Alias /static "/opt/webapps/virtualcommons/vcweb/static" - Alias /media "/var/www/vcweb.asu.edu/media" - + Alias /static "/var/www/vcweb/static" WSGIDaemonProcess vcweb-production user=apache group=commons threads=25 python-path=/opt/virtualenvs/vcweb/lib/python2.6/site-packages WSGIProcessGroup vcweb-production |
From: <vir...@li...> - 2011-04-14 01:10:57
|
Subject: hg.virtualcommons 331 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/6049dc6a4e95 changeset: 331:6049dc6a4e95 user: Allen Lee <all...@as...> date: Wed Apr 13 18:10:53 2011 -0700 description: minor hygiene diffstat: vcweb/vcweb-tornadio.py | 33 +++++++++++---------------------- 1 files changed, 11 insertions(+), 22 deletions(-) diffs (102 lines): diff -r 6117f77466bb -r 6049dc6a4e95 vcweb/vcweb-tornadio.py --- a/vcweb/vcweb-tornadio.py Wed Apr 13 18:02:57 2011 -0700 +++ b/vcweb/vcweb-tornadio.py Wed Apr 13 18:10:53 2011 -0700 @@ -36,19 +36,12 @@ Manages socket.io connections to tornadio. ''' class ConnectionManager: - # FIXME: use (participant, experiment) tuples instead of - # ParticipantGroupRelationship? The problem is that when the experiment is - # first started but groups haven't been allocated, socket.io won't work. Using - # the ParticipantExperiment tuple would allow us to broadcast messages when we - # want to from the experimenter.. - # (participant.pk, experiment.pk) -> connection + # bidi maps for (participant.pk, experiment.pk) -> connection connection_to_participant = {} participant_to_connection = {} -# experimenter maps + # bidi maps for (experimenter.pk, experiment.pk) -> connection connection_to_experimenter = {} -# (experimenter.pk, experiment.pk) -> connection experimenter_to_connection = {} - refresh_json = simplejson.dumps({ 'message_type': 'refresh' }) def add_experimenter(self, connection, incoming_experimenter_pk, incoming_experiment_pk): @@ -104,9 +97,8 @@ participant_tuple = self.connection_to_participant[connection] del self.participant_to_connection[participant_tuple] del self.connection_to_participant[connection] - except KeyError, k: + except KeyError as k: logger.warning("caught key error %s while trying to remove connection %s" % (connection, k) ) - pass ''' Generator function that yields (participant_group_relationship_id, connection) tuples @@ -120,7 +112,6 @@ participant_tuple = (participant.pk, experiment.pk) if participant_tuple in self.participant_to_connection: yield (participant_group_relationship.pk, self.participant_to_connection[participant_tuple]) - pass def all_participants(self, connection, experiment): if connection in self.connection_to_experimenter: @@ -169,6 +160,7 @@ experimenter = experiment.experimenter self.send_to_experimenter((experimenter.pk, experiment.pk), json) +# replace with namedtuple class Struct: def __init__(self, **attributes): self.__dict__.update(attributes) @@ -176,10 +168,9 @@ def to_event(message): return Struct(**message) -# global connection manager for experimenters + participants +# connection manager for experimenters + participants connection_manager = ConnectionManager() - -# FIXME: move to core tornado module? +# FIXME: move to a core tornado module? class ExperimenterHandler(SocketConnection): # FIXME: add authentication def on_open(self, *args, **kwargs): @@ -241,23 +232,21 @@ 'message': "Participant %s connected to experiment." % participant_experiment_relationship, 'message_type': 'info', })) - except KeyError, e: + except KeyError as e: logger.debug("no participant group relationship id %s" % e) - except ParticipantExperimentRelationship.DoesNotExist, e: + except ParticipantExperimentRelationship.DoesNotExist as e: logger.debug("no participant experiment relationship with id %s (%s)" % (relationship_id, e)) def on_message(self, message, *args, **kwargs): logger.debug("received message %s from handler %s" % (message, self)) event = to_event(message) - # FIXME: on_message / connect should add them to the list of participants + # could handle connection here or in on_open, revisit if 'connect' in event.message_type: return elif event.message_type == 'submit': - # FIXME: need to set this up so that this forwards to the appropriate - # experiment handler... (participant_pk, experiment_pk) = connection_manager.get_participant_experiment_tuple(self) experiment = Experiment.objects.get(pk=experiment_pk) -# sanity check, make sure this is a data round. + # sanity check, make sure this is a data round. if experiment.is_data_round_in_progress: experimenter_tuple = (experiment.experimenter.pk, experiment.pk) event.participant_pk = participant_pk @@ -273,7 +262,7 @@ if experiment.all_participants_have_submitted: connection_manager.send_to_experimenter( experimenter_tuple, - info_json('All participants have submitted a harvest decision.')) + info_json('All participants have submitted a decision.')) else: logger.debug("No data round in progress, received late submit event: %s" % event) |
From: <vir...@li...> - 2011-04-14 01:03:03
|
Subject: hg.virtualcommons 330 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/6117f77466bb changeset: 330:6117f77466bb user: Allen Lee <all...@as...> date: Wed Apr 13 18:02:57 2011 -0700 description: fixing experimenter goto json request fixing reference to form.institution improving participant tree display div, we don't need a for loop to iterate, just use the repeat-y just like we use repeat-x to determine how many multiples of 20 to include. diffstat: vcweb/core/ajax.py | 2 +- vcweb/core/forms.py | 4 ++-- vcweb/core/templates/experimenter/monitor.html | 2 +- vcweb/core/templates/experimenter/register-participants.html | 7 +++---- vcweb/core/templates/includes/experimenter.events.html | 2 +- vcweb/core/templates/registration/login.html | 5 ++--- vcweb/core/views.py | 4 ++-- vcweb/forestry/templates/forestry/participate.html | 9 +-------- vcweb/forestry/templates/forestry/wait.html | 4 +++- vcweb/static/css/style.css | 2 +- vcweb/vcweb-tornadio.py | 2 +- 11 files changed, 18 insertions(+), 25 deletions(-) diffs (180 lines): diff -r abe85ac785f0 -r 6117f77466bb vcweb/core/ajax.py --- a/vcweb/core/ajax.py Wed Apr 13 17:18:01 2011 -0700 +++ b/vcweb/core/ajax.py Wed Apr 13 18:02:57 2011 -0700 @@ -81,7 +81,7 @@ raise Experiment.DoesNotExist("Sorry, %s - you do not have access to experiment %s" % (experiment.experimenter, pk)) def _render_experiment_monitor_block(block, experiment, request): - return render_block_to_string('monitor.html', block, { 'experiment': experiment }, + return render_block_to_string('experimenter/monitor.html', block, { 'experiment': experiment }, context_instance=RequestContext(request)) @experimenter_required diff -r abe85ac785f0 -r 6117f77466bb vcweb/core/forms.py --- a/vcweb/core/forms.py Wed Apr 13 17:18:01 2011 -0700 +++ b/vcweb/core/forms.py Wed Apr 13 18:02:57 2011 -0700 @@ -87,7 +87,7 @@ required=False, initial='Arizona State University', help_text='The name of the institution to be associated with these test participants') institution_url = forms.URLField(min_length=3, label='Institution URL', - required=False, initial='http://www.asu.edu', + required=False, initial='http://www.asu.edu/', verify_exists=True, help_text='A URL, if applicable, for the institution (e.g., http://www.asu.edu)') def clean(self): @@ -100,7 +100,7 @@ institution_url)) (institution, created) = Institution.objects.get_or_create(name=institution_name, url=institution_url) self.institution = institution - super(RegisterParticipantsForm, self).clean() + return self.cleaned_data class RegisterSimpleParticipantsForm(RegisterParticipantsForm): diff -r abe85ac785f0 -r 6117f77466bb vcweb/core/templates/experimenter/monitor.html --- a/vcweb/core/templates/experimenter/monitor.html Wed Apr 13 17:18:01 2011 -0700 +++ b/vcweb/core/templates/experimenter/monitor.html Wed Apr 13 18:02:57 2011 -0700 @@ -24,7 +24,7 @@ confirmable.fastConfirm({ questionText: description + " - continue?", onProceed: function(trigger) { - Dajaxice.vcweb.core.experiment_controller(update, {'experiment_id': {{experiment_id}}, 'action':action}); + Dajaxice.vcweb.core.experiment_controller(update, {'pk': {{experiment.pk}}, 'action':action}); $('#statusDiv').hide('fast'); $('#experimentData').hide('fast'); $('#statusSpinner').show('fast'); diff -r abe85ac785f0 -r 6117f77466bb vcweb/core/templates/experimenter/register-participants.html --- a/vcweb/core/templates/experimenter/register-participants.html Wed Apr 13 17:18:01 2011 -0700 +++ b/vcweb/core/templates/experimenter/register-participants.html Wed Apr 13 18:02:57 2011 -0700 @@ -24,13 +24,12 @@ {% block page %} <form id='register-participants-form' action='' method='post'> <h3>Register participants</h3> - <p>Please register participants for <span style='padding:1px;' class='info'>{{experiment}}</span>. + <p>Registering participants for <span style='padding:1px;' class='info'>{{experiment}}</span>. </p> <p> <span style='padding: 3px;' class='ui-state-highlight'><b>There are currently {{experiment.participants.count}} registered participants.</b></span> {% include "includes/form-as-div.html" %} - <div class='submit'> - <button type='submit'>Register</button> - </div> + <button class='submit' type='submit'>Register</button> + <button><a href='/dashboard'>Cancel</a></button> </form> {% endblock page %} diff -r abe85ac785f0 -r 6117f77466bb vcweb/core/templates/includes/experimenter.events.html --- a/vcweb/core/templates/includes/experimenter.events.html Wed Apr 13 17:18:01 2011 -0700 +++ b/vcweb/core/templates/includes/experimenter.events.html Wed Apr 13 18:02:57 2011 -0700 @@ -7,7 +7,7 @@ if (! url) { url = "participate"; } - return createMessageEvent(url); + return createMessageEvent(url, "goto"); } function createConnectionEvent() { return createMessageEvent("Initial connection", "connect"); diff -r abe85ac785f0 -r 6117f77466bb vcweb/core/templates/registration/login.html --- a/vcweb/core/templates/registration/login.html Wed Apr 13 17:18:01 2011 -0700 +++ b/vcweb/core/templates/registration/login.html Wed Apr 13 18:02:57 2011 -0700 @@ -10,6 +10,7 @@ $(':input').addClass('required'); $('#loginForm').validate(); $('#id_email').focus(); + $('button').button(); }); </script> {% endblock head %} @@ -23,9 +24,7 @@ </p> {% include "includes/form-as-div.html" %} - <div class='submit'> - <input type='submit' value='Login' /> - </div> + <button type='submit' class='submit'>Login</button> </form> {% endblock page %} diff -r abe85ac785f0 -r 6117f77466bb vcweb/core/views.py --- a/vcweb/core/views.py Wed Apr 13 17:18:01 2011 -0700 +++ b/vcweb/core/views.py Wed Apr 13 18:02:57 2011 -0700 @@ -182,7 +182,7 @@ experiment = self.object logger.debug("registering participants %s for experiment: %s" % (emails, experiment)) experiment.authentication_code = form.cleaned_data.get('experiment_passcode') - experiment.register_participants(emails=emails, institution=self.institution, + experiment.register_participants(emails=emails, institution=form.institution, password=experiment.authentication_code) @@ -195,7 +195,7 @@ experiment = self.object experiment_passcode = form.cleaned_data.get('experiment_passcode') experiment.setup_test_participants(count=number_of_participants, - institution=self.institution, + institution=form.institution, email_suffix=email_suffix, password=experiment_passcode) return super(RegisterSimpleParticipantsView, self).form_valid(form) diff -r abe85ac785f0 -r 6117f77466bb vcweb/forestry/templates/forestry/participate.html --- a/vcweb/forestry/templates/forestry/participate.html Wed Apr 13 17:18:01 2011 -0700 +++ b/vcweb/forestry/templates/forestry/participate.html Wed Apr 13 18:02:57 2011 -0700 @@ -45,16 +45,9 @@ {% endblock %} {% block content %} <h3>Forestry round number {{ experiment.current_round.round_number }}</h3> -<div style="background: url('/static/images/forestry/{{tree.name}}.png') repeat-x repeat-y; width:{{max_width}}px; height: {{max_height}}px;"> +<div style="background: url('/static/images/forestry/{{tree.name}}.png'); width:{{max_width}}px; height: {{max_height}}px;"> </div> -{% comment %} -{% for i in number_of_resource_divs %} -<div style="background: url('/static/images/forestry/{{tree.name}}.png') repeat-x; width:{{max_width}}px; height: {{tree.height}}px;"> - -</div> -{% endfor %} -{% endcomment %} {% if resource_width > 0 %} <div style="background: url('/static/images/forestry/pine-tree.png') repeat-x; width:{{resource_width}}px; height: {{tree.height}}px;"> diff -r abe85ac785f0 -r 6117f77466bb vcweb/forestry/templates/forestry/wait.html --- a/vcweb/forestry/templates/forestry/wait.html Wed Apr 13 17:18:01 2011 -0700 +++ b/vcweb/forestry/templates/forestry/wait.html Wed Apr 13 18:02:57 2011 -0700 @@ -37,8 +37,10 @@ <h3>Waiting for the next round to start</h3> <p> The facilitator will start the next round when every participant is ready. +<br/> <span class='ui-state-highlight ui-corner-all'> - <small><a class='contactIcon' href="#">send a private message to the facilitator</a></small> + <small><a class='contactIcon' href="#">send a private message to the facilitator</a> + | <a href='participate'>return to participation page</a></small> </span> <br/> </p> diff -r abe85ac785f0 -r 6117f77466bb vcweb/static/css/style.css --- a/vcweb/static/css/style.css Wed Apr 13 17:18:01 2011 -0700 +++ b/vcweb/static/css/style.css Wed Apr 13 18:02:57 2011 -0700 @@ -55,7 +55,7 @@ display:inline; font-size: 0.8em; } -.submit input,button { +button.submit { position: relative; margin-left: 188px; } diff -r abe85ac785f0 -r 6117f77466bb vcweb/vcweb-tornadio.py --- a/vcweb/vcweb-tornadio.py Wed Apr 13 17:18:01 2011 -0700 +++ b/vcweb/vcweb-tornadio.py Wed Apr 13 18:02:57 2011 -0700 @@ -187,7 +187,7 @@ extra = kwargs['extra'] logger.debug('%s received extra: %s' % (self, extra)) experimenter_id = extra - except Experimenter.DoesNotExist as e: + except Experimenter.DoesNotExist: logger.warning("Tried to establish connection but there isn't any experimenter with id %s" % experimenter_id) def on_message(self, message): |
From: <vir...@li...> - 2011-04-14 00:18:10
|
Subject: hg.virtualcommons 329 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/abe85ac785f0 changeset: 329:abe85ac785f0 user: Allen Lee <all...@as...> date: Wed Apr 13 17:18:01 2011 -0700 description: version bump for jquery.ui and switching to CDN for theme as well diffstat: vcweb/core/fixtures/initial_data.json | 2 +- vcweb/core/forms.py | 29 ++++++++++++-- vcweb/core/models.py | 3 +- vcweb/core/templates/experimenter/dashboard.html | 5 ++- vcweb/core/templates/experimenter/register-participants.html | 2 +- vcweb/core/templates/includes/jquery.ui.html | 4 +- vcweb/core/urls.py | 2 +- vcweb/core/views.py | 17 ++------ vcweb/forestry/templates/forestry/participate.html | 7 +++- vcweb/forestry/templates/forestry/wait.html | 3 +- vcweb/forestry/views.py | 6 ++- 11 files changed, 51 insertions(+), 29 deletions(-) diffs (246 lines): diff -r 7303ce5ac2fe -r abe85ac785f0 vcweb/core/fixtures/initial_data.json --- a/vcweb/core/fixtures/initial_data.json Wed Apr 13 14:50:18 2011 -0700 +++ b/vcweb/core/fixtures/initial_data.json Wed Apr 13 17:18:01 2011 -0700 @@ -3,7 +3,7 @@ "pk": 1, "model": "core.institution", "fields": { - "url": "http://www.asu.edu", + "url": "http://www.asu.edu/", "name": "Arizona State University", "description": null } diff -r 7303ce5ac2fe -r abe85ac785f0 vcweb/core/forms.py --- a/vcweb/core/forms.py Wed Apr 13 14:50:18 2011 -0700 +++ b/vcweb/core/forms.py Wed Apr 13 17:18:01 2011 -0700 @@ -4,12 +4,16 @@ from django.forms import widgets, ValidationError from django.utils.translation import ugettext_lazy as _ -from vcweb.core.models import Participant, Experimenter +from vcweb.core.models import (Participant, Experimenter, Institution) from django.core.validators import email_re import re +import logging + +logger = logging.getLogger(__name__) + REQUIRED_EMAIL_ATTRIBUTES = { 'class' : 'required email' } REQUIRED_ATTRIBUTES = { 'class' : 'required' } @@ -78,11 +82,26 @@ class RegisterParticipantsForm(forms.ModelForm): experiment_pk = forms.IntegerField(widget=widgets.HiddenInput) - experiment_passcode = forms.CharField(min_length=3, label="Experiment passcode", help_text='The password used to login to your experiment.') - institution_name = forms.CharField(min_length=3,label="Institution name", + experiment_passcode = forms.CharField(min_length=3, label="Experiment passcode", help_text='The password used to login to your experiment.', initial='test') + institution_name = forms.CharField(min_length=3, label="Institution name", + required=False, initial='Arizona State University', help_text='The name of the institution to be associated with these test participants') - institution_url = forms.URLField(min_length=3,label='Institution URL', - verify_exists=True, required=False, help_text='A URL, if applicable, for the institution (e.g., http://www.asu.edu)') + institution_url = forms.URLField(min_length=3, label='Institution URL', + required=False, initial='http://www.asu.edu', + verify_exists=True, help_text='A URL, if applicable, for the institution (e.g., http://www.asu.edu)') + + def clean(self): + institution_name = self.cleaned_data.get('institution_name') + institution_url = self.cleaned_data.get('institution_url') + if institution_name is None and institution_url is None: + self.institution = None + else: + logger.debug("get or create institution with name [%s] and url [%s]" % (institution_name, + institution_url)) + (institution, created) = Institution.objects.get_or_create(name=institution_name, url=institution_url) + self.institution = institution + super(RegisterParticipantsForm, self).clean() + class RegisterSimpleParticipantsForm(RegisterParticipantsForm): email_suffix = forms.CharField(min_length=3, help_text='An email suffix without the "@" symbol. Generated participants will have usernames of the format s1..sn@email_suffix. For example, if you register 20 participants with an email suffix of example.edu, the system will generate 20 participants with usernames ranging from s1...@ex..., s2...@ex..., s3...@ex..., ... s2...@ex....') diff -r 7303ce5ac2fe -r abe85ac785f0 vcweb/core/models.py --- a/vcweb/core/models.py Wed Apr 13 14:50:18 2011 -0700 +++ b/vcweb/core/models.py Wed Apr 13 17:18:01 2011 -0700 @@ -392,12 +392,11 @@ ''' hardcoded defaults for the slovakia pretest ''' - def setup_test_participants(self, count=20, institution_name='Slovak Academy of Sciences', institution_url='http://www.sav.sk', email_suffix='sav.sk', password='test'): + def setup_test_participants(self, count=20, institution=None, email_suffix='sav.sk', password='test'): if self.participants.count() > 0: logger.warning("This experiment %s already has %d participants - aborting" % (self, self.participants.count())) return - (institution, created) = Institution.objects.get_or_create(name=institution_name, url=institution_url) users = [] for i in xrange(1, count+1): email = u's%d@%s' % (i, email_suffix) diff -r 7303ce5ac2fe -r abe85ac785f0 vcweb/core/templates/experimenter/dashboard.html --- a/vcweb/core/templates/experimenter/dashboard.html Wed Apr 13 14:50:18 2011 -0700 +++ b/vcweb/core/templates/experimenter/dashboard.html Wed Apr 13 17:18:01 2011 -0700 @@ -50,7 +50,10 @@ <li><a class='confirm-experiment-action' title='Creates a new copy of this experiment with the exact same configuration but no registered participants.' href='{{e.clone_url}}'><img src='/static/images/famfamfam/page_copy.png' alt='Clone experiment'/> clone</a></li> {% if e.participants.count == 0 %} <li> - <a title='Register participants' href='{{e.controller_url}}/register-simple'><img src='/static/images/famfamfam/group_add.png' alt='register'/> register participants</a> + <a title='Register participants for this experiment with actual email addresses' href='{{e.controller_url}}/register-email-list'><img src='/static/images/famfamfam/group_add.png' alt='register'/> register participants by email</a> + </li> + <li> + <a title='Register participants for this experiment with fake email addresses by providing an email suffix and the number of participants.' href='{{e.controller_url}}/register-simple'><img src='/static/images/famfamfam/group_add.png' alt='register'/> register example participants</a> </li> {% else %} <li><a title='clear all participants' href='{{e.controller_url}}/clear-participants' class='confirm-experiment-action'><img src='/static/images/famfamfam/group_delete.png' alt=''/> clear all participants</a></li> diff -r 7303ce5ac2fe -r abe85ac785f0 vcweb/core/templates/experimenter/register-participants.html --- a/vcweb/core/templates/experimenter/register-participants.html Wed Apr 13 14:50:18 2011 -0700 +++ b/vcweb/core/templates/experimenter/register-participants.html Wed Apr 13 17:18:01 2011 -0700 @@ -6,7 +6,7 @@ {% include "includes/jquery.forms.html" %} <script type='text/javascript'> $(function() { - $('input:visible').each(function(i, val) { + $('input:visible, textarea:visible').each(function(i, val) { var labelTitle = $(val).prev().attr("title"); $(val).qtip({ content: labelTitle, position: { corner: {target: 'topRight', tooltip: 'bottomLeft'}}, diff -r 7303ce5ac2fe -r abe85ac785f0 vcweb/core/templates/includes/jquery.ui.html --- a/vcweb/core/templates/includes/jquery.ui.html Wed Apr 13 14:50:18 2011 -0700 +++ b/vcweb/core/templates/includes/jquery.ui.html Wed Apr 13 17:18:01 2011 -0700 @@ -1,2 +1,2 @@ -<link href="/static/css/pepper-grinder/jquery-ui-1.8.10.custom.css" rel="stylesheet" type="text/css" media="screen" /> -<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script> +<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/pepper-grinder/jquery-ui.css" rel="stylesheet" type="text/css" media="screen" /> +<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script> diff -r 7303ce5ac2fe -r abe85ac785f0 vcweb/core/urls.py --- a/vcweb/core/urls.py Wed Apr 13 14:50:18 2011 -0700 +++ b/vcweb/core/urls.py Wed Apr 13 17:18:01 2011 -0700 @@ -14,7 +14,7 @@ url(r'^participate/(?P<pk>\d+)/instructions', 'instructions', name='instructions'), url(r'^participate/(?P<namespace>\w+)/instructions', 'instructions', name='namespace_instructions'), url(r'^experiment/(?P<pk>\d+)/monitor$', MonitorExperimentView.as_view(), name='monitor_experiment'), - url(r'^experiment/(?P<pk>\d+)/register-by-emails$', RegisterEmailListView.as_view(), name='register_by_emails'), + url(r'^experiment/(?P<pk>\d+)/register-email-list$', RegisterEmailListView.as_view(), name='register_email_list'), url(r'^experiment/(?P<pk>\d+)/register-simple$', RegisterSimpleParticipantsView.as_view(), name='register_simple'), url(r'^experiment/(?P<pk>\d+)/clone$', CloneExperimentView.as_view(), name='clone'), url(r'^experiment/(?P<pk>\d+)/clear-participants', ClearParticipantsExperimentView.as_view(), name='clear_participants'), diff -r 7303ce5ac2fe -r abe85ac785f0 vcweb/core/views.py --- a/vcweb/core/views.py Wed Apr 13 14:50:18 2011 -0700 +++ b/vcweb/core/views.py Wed Apr 13 17:18:01 2011 -0700 @@ -10,18 +10,17 @@ from django.views.generic import ListView, FormView, TemplateView from django.views.generic.base import TemplateResponseMixin from django.views.generic.detail import SingleObjectMixin, DetailView -from django.views.generic.edit import BaseUpdateView, UpdateView +from django.views.generic.edit import UpdateView from vcweb.core.forms import (RegistrationForm, LoginForm, ParticipantAccountForm, ExperimenterAccountForm, RegisterEmailListParticipantsForm, RegisterSimpleParticipantsForm) -from vcweb.core.models import (Participant, Experiment, Institution, ParticipantExperimentRelationship, - is_participant, is_experimenter) +from vcweb.core.models import (Participant, Experiment, Institution, is_participant, is_experimenter) from vcweb.core.decorators import anonymous_required, experimenter_required, participant_required import hashlib import base64 from datetime import datetime -import logging from vcweb.core import unicodecsv import itertools +import logging logger = logging.getLogger(__name__) """ account registration / login / logout / profile views """ @@ -183,10 +182,7 @@ experiment = self.object logger.debug("registering participants %s for experiment: %s" % (emails, experiment)) experiment.authentication_code = form.cleaned_data.get('experiment_passcode') - institution_name = form.cleaned_data.get('institution_name') - institution_url = form.cleaned_data.get('institution_url') - institution = Institution.objects.get_or_create(name=institution_name, url=institution_url) - experiment.register_participants(emails=emails, institution=institution, + experiment.register_participants(emails=emails, institution=self.institution, password=experiment.authentication_code) @@ -198,11 +194,8 @@ email_suffix = form.cleaned_data.get('email_suffix') experiment = self.object experiment_passcode = form.cleaned_data.get('experiment_passcode') - institution_name = form.cleaned_data.get('institution_name') - institution_url = form.cleaned_data.get('institution_url') experiment.setup_test_participants(count=number_of_participants, - institution_name=institution_name, - institution_url=institution_url, + institution=self.institution, email_suffix=email_suffix, password=experiment_passcode) return super(RegisterSimpleParticipantsView, self).form_valid(form) diff -r 7303ce5ac2fe -r abe85ac785f0 vcweb/forestry/templates/forestry/participate.html --- a/vcweb/forestry/templates/forestry/participate.html Wed Apr 13 14:50:18 2011 -0700 +++ b/vcweb/forestry/templates/forestry/participate.html Wed Apr 13 17:18:01 2011 -0700 @@ -45,13 +45,18 @@ {% endblock %} {% block content %} <h3>Forestry round number {{ experiment.current_round.round_number }}</h3> +<div style="background: url('/static/images/forestry/{{tree.name}}.png') repeat-x repeat-y; width:{{max_width}}px; height: {{max_height}}px;"> + +</div> +{% comment %} {% for i in number_of_resource_divs %} <div style="background: url('/static/images/forestry/{{tree.name}}.png') repeat-x; width:{{max_width}}px; height: {{tree.height}}px;"> </div> {% endfor %} +{% endcomment %} {% if resource_width > 0 %} -<div style="background: url('/static/images/forestry/pine-tree.png') repeat-x; width:{{resource_width}}px; height: 79px;"> +<div style="background: url('/static/images/forestry/pine-tree.png') repeat-x; width:{{resource_width}}px; height: {{tree.height}}px;"> </div> {% endif %} diff -r 7303ce5ac2fe -r abe85ac785f0 vcweb/forestry/templates/forestry/wait.html --- a/vcweb/forestry/templates/forestry/wait.html Wed Apr 13 14:50:18 2011 -0700 +++ b/vcweb/forestry/templates/forestry/wait.html Wed Apr 13 17:18:01 2011 -0700 @@ -6,7 +6,7 @@ {% include "includes/tablesorter.html" %} <script type="text/javascript"> $(function() { - $('#participant-history').tablesorter({widgets: ['zebra'], + $('#participant-history').tablesorter({widgets: ['zebra'], headers: { 0: {sorter: false}, 1: {sorter: false} } }); $('[title]').qtip({position: { corner: {target: 'topMiddle', tooltip: 'bottomMiddle'}}, style: { name: 'green', tip: 'bottomMiddle'} }); @@ -40,6 +40,7 @@ <span class='ui-state-highlight ui-corner-all'> <small><a class='contactIcon' href="#">send a private message to the facilitator</a></small> </span> +<br/> </p> <h3>Participant History</h3> diff -r 7303ce5ac2fe -r abe85ac785f0 vcweb/forestry/views.py --- a/vcweb/forestry/views.py Wed Apr 13 14:50:18 2011 -0700 +++ b/vcweb/forestry/views.py Wed Apr 13 17:18:01 2011 -0700 @@ -5,7 +5,7 @@ from django.shortcuts import render_to_response, redirect from django.template.context import RequestContext from django.views.generic import View -from django.views.generic.detail import SingleObjectTemplateResponseMixin, SingleObjectMixin +from django.views.generic.detail import SingleObjectTemplateResponseMixin from vcweb.core.decorators import participant_required, experimenter_required from vcweb.core.forms import QuizForm from vcweb.core.models import is_participant, is_experimenter, Experiment @@ -216,9 +216,11 @@ # FIXME: UI crap logic in view to determine how wide to make the tree div number_of_trees_per_row = 20 max_width = number_of_trees_per_row * 30 + tree = trees['pine'] + max_height = (resource_level.value / number_of_trees_per_row) * tree['height'] + number_of_resource_divs = range(0, resource_level.value / number_of_trees_per_row) resource_width = (resource_level.value % number_of_trees_per_row) * 30 - tree = trees['pine'] return render_to_response(experiment.current_round_template, locals(), context_instance=RequestContext(request)) |
From: <vir...@li...> - 2011-04-13 21:50:29
|
Subject: hg.virtualcommons 328 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/7303ce5ac2fe changeset: 328:7303ce5ac2fe user: Allen Lee <all...@as...> date: Wed Apr 13 14:50:18 2011 -0700 description: fixing form properties (was grabbing the actual form fields instead of the data from the form fields). switching institution URL to urlfield refactored setup_test_participants to use generic register_participants that takes in a list of users or a list of emails. fixing generic views, adding ExperimenterSingleExperimentView that overrides get(..) properly to set self.object and invoke process_experiment. diffstat: vcweb/core/forms.py | 4 +- vcweb/core/models.py | 43 +++++++++++--- vcweb/core/templates/experimenter/register-participants.html | 3 +- vcweb/core/urls.py | 6 +- vcweb/core/views.py | 50 +++++++++------- vcweb/static/css/style.css | 2 +- 6 files changed, 71 insertions(+), 37 deletions(-) diffs (229 lines): diff -r ccf7fec8f874 -r 7303ce5ac2fe vcweb/core/forms.py --- a/vcweb/core/forms.py Tue Apr 12 16:53:41 2011 -0700 +++ b/vcweb/core/forms.py Wed Apr 13 14:50:18 2011 -0700 @@ -81,8 +81,8 @@ experiment_passcode = forms.CharField(min_length=3, label="Experiment passcode", help_text='The password used to login to your experiment.') institution_name = forms.CharField(min_length=3,label="Institution name", help_text='The name of the institution to be associated with these test participants') - institution_url = forms.CharField(min_length=3,label='Institution URL', - required=False, help_text='A URL, if applicable, for the institution (e.g., http://www.asu.edu)') + institution_url = forms.URLField(min_length=3,label='Institution URL', + verify_exists=True, required=False, help_text='A URL, if applicable, for the institution (e.g., http://www.asu.edu)') class RegisterSimpleParticipantsForm(RegisterParticipantsForm): email_suffix = forms.CharField(min_length=3, help_text='An email suffix without the "@" symbol. Generated participants will have usernames of the format s1..sn@email_suffix. For example, if you register 20 participants with an email suffix of example.edu, the system will generate 20 participants with usernames ranging from s1...@ex..., s2...@ex..., s3...@ex..., ... s2...@ex....') diff -r ccf7fec8f874 -r 7303ce5ac2fe vcweb/core/models.py --- a/vcweb/core/models.py Tue Apr 12 16:53:41 2011 -0700 +++ b/vcweb/core/models.py Wed Apr 13 14:50:18 2011 -0700 @@ -367,24 +367,49 @@ pdvs = self.current_round_data.participant_data_values return pdvs.filter(submitted=False).count() == 0 + def register_participants(self, users=None, emails=None, institution=None, password=None): + if self.participants.count() > 0: + logger.warning("This experiment %s already has %d participants - aborting" % (self, + self.participants.count())) + return + if users is None: + users = [] + if emails is None: + logger.warning("No users or emails supplied, aborting.") + return + if password is None: + password = self.authentication_code + for email in emails: + try: + u = User.objects.get(username=email) + except User.DoesNotExist: + u = User.objects.create_user(username=email, email=email, password=password) + users.append(u) + for user in users: + (p, created) = Participant.objects.get_or_create(user=user, institution=institution) + ParticipantExperimentRelationship.objects.create(participant=p, experiment=self, + created_by=self.experimenter.user) + + ''' hardcoded defaults for the slovakia pretest ''' - def setup_test_participants(self, count=20, institution_name='Slovak Academy of Sciences', institution_url='http://www.sav.sk', email_suffix='sav.sk', test_password='test'): + def setup_test_participants(self, count=20, institution_name='Slovak Academy of Sciences', institution_url='http://www.sav.sk', email_suffix='sav.sk', password='test'): if self.participants.count() > 0: - logger.debug("This experiment %s already has %d participants - aborting" + logger.warning("This experiment %s already has %d participants - aborting" % (self, self.participants.count())) return (institution, created) = Institution.objects.get_or_create(name=institution_name, url=institution_url) + users = [] for i in xrange(1, count+1): email = u's%d@%s' % (i, email_suffix) try: - u = User.objects.get(username=email) + user = User.objects.get(username=email) except User.DoesNotExist: - u = User.objects.create_user(username=email, email=email, password=test_password) - u.first_name = u'Student' - u.last_name = u"%d" % i - u.save() - (p, created) = Participant.objects.get_or_create(user=u, institution=institution) - ParticipantExperimentRelationship.objects.create(participant=p, experiment=self, created_by=u) + user = User.objects.create_user(username=email, email=email, password=password) + user.first_name = u'Student' + user.last_name = u"%d" % i + user.save() + users.append(user) + self.register_participants(users=users, institution=institution) def log(self, log_message): if log_message: diff -r ccf7fec8f874 -r 7303ce5ac2fe vcweb/core/templates/experimenter/register-participants.html --- a/vcweb/core/templates/experimenter/register-participants.html Tue Apr 12 16:53:41 2011 -0700 +++ b/vcweb/core/templates/experimenter/register-participants.html Wed Apr 13 14:50:18 2011 -0700 @@ -17,6 +17,7 @@ ); }); $('#id_experiment_pk').val({{experiment.pk}}); + $('button').button(); }); </script> {% endblock %} @@ -29,7 +30,7 @@ <span style='padding: 3px;' class='ui-state-highlight'><b>There are currently {{experiment.participants.count}} registered participants.</b></span> {% include "includes/form-as-div.html" %} <div class='submit'> - <input type='submit' value='Register' /> + <button type='submit'>Register</button> </div> </form> {% endblock page %} diff -r ccf7fec8f874 -r 7303ce5ac2fe vcweb/core/urls.py --- a/vcweb/core/urls.py Tue Apr 12 16:53:41 2011 -0700 +++ b/vcweb/core/urls.py Wed Apr 13 14:50:18 2011 -0700 @@ -1,7 +1,7 @@ from django.conf.urls.defaults import patterns, url from django.contrib.auth.decorators import login_required -from vcweb.core.views import Dashboard, LoginView, LogoutView, RegistrationView, MonitorExperimentView, CloneExperimentView, \ - RegisterEmailListView, RegisterSimpleParticipantsView +from vcweb.core.views import (Dashboard, LoginView, LogoutView, RegistrationView, MonitorExperimentView, CloneExperimentView, + RegisterEmailListView, RegisterSimpleParticipantsView, ClearParticipantsExperimentView) ''' URLs defined by the core vcweb app. ''' @@ -17,8 +17,8 @@ url(r'^experiment/(?P<pk>\d+)/register-by-emails$', RegisterEmailListView.as_view(), name='register_by_emails'), url(r'^experiment/(?P<pk>\d+)/register-simple$', RegisterSimpleParticipantsView.as_view(), name='register_simple'), url(r'^experiment/(?P<pk>\d+)/clone$', CloneExperimentView.as_view(), name='clone'), + url(r'^experiment/(?P<pk>\d+)/clear-participants', ClearParticipantsExperimentView.as_view(), name='clear_participants'), # url(r'^experiment/(?P<pk>\d+)/add-participants/(?P<count>[\d]+)$', 'add_participants', name='add_participants'), -# url(r'^experiment/(?P<pk>\d+)/clear-participants', 'clear_participants', name='clear_participants'), url(r'^experiment/(?P<pk>\d+)/download/(?P<file_type>[\w]+)$', 'download_data', name='download_data'), # experiment controller actions are the most general, needs to be matched at the very end url(r'^experiment/(?P<pk>\d+)/(?P<experiment_action>[\w-]+)$', 'experiment_controller', name='experiment_controller'), diff -r ccf7fec8f874 -r 7303ce5ac2fe vcweb/core/views.py --- a/vcweb/core/views.py Tue Apr 12 16:53:41 2011 -0700 +++ b/vcweb/core/views.py Wed Apr 13 14:50:18 2011 -0700 @@ -165,6 +165,13 @@ return experiment raise PermissionDenied("You do not have access to %s" % experiment) +class ExperimenterSingleExperimentView(ExperimenterSingleExperimentMixin, TemplateView): + def get(self, request, **kwargs): + self.object = self.get_object() + self.process_experiment(self.object) + context = self.get_context_data(object=self.object) + return self.render_to_response(context) + class MonitorExperimentView(ExperimenterSingleExperimentMixin, DetailView): template_name = 'experimenter/monitor.html' @@ -172,50 +179,51 @@ form_class = RegisterEmailListParticipantsForm template_name = 'experimenter/register-email-participants.html' def form_valid(self, form): - emails = form['participant_emails'] + emails = form.cleaned_data.get('participant_emails') experiment = self.object logger.debug("registering participants %s for experiment: %s" % (emails, experiment)) - experiment.authentication_code = form['experiment_passcode'] - for email in emails: - try: - participant = Participant.objects.get(user__email=email) - except Participant.DoesNotExist: - user = User.objects.create_user(username=email, email=email, - password=experiment.authentication_code) - participant = Participant.objects.create(user=user) + experiment.authentication_code = form.cleaned_data.get('experiment_passcode') + institution_name = form.cleaned_data.get('institution_name') + institution_url = form.cleaned_data.get('institution_url') + institution = Institution.objects.get_or_create(name=institution_name, url=institution_url) + experiment.register_participants(emails=emails, institution=institution, + password=experiment.authentication_code) - ParticipantExperimentRelationship.objects.create(participant=participant, - experiment=experiment, - created_by=experiment.experimenter.user) - -class RegisterSimpleParticipantsView(ExperimenterSingleExperimentMixin, BaseUpdateView, TemplateResponseMixin): +class RegisterSimpleParticipantsView(ExperimenterSingleExperimentMixin, UpdateView): form_class = RegisterSimpleParticipantsForm template_name = 'experimenter/register-simple-participants.html' def form_valid(self, form): number_of_participants = form.cleaned_data.get('number_of_participants') - email_suffix = form['email_suffix'] + email_suffix = form.cleaned_data.get('email_suffix') experiment = self.object - experiment_passcode = form['experiment_passcode'] - institution_name = form['institution_name'] - institution_url = form['institution_url'] + experiment_passcode = form.cleaned_data.get('experiment_passcode') + institution_name = form.cleaned_data.get('institution_name') + institution_url = form.cleaned_data.get('institution_url') experiment.setup_test_participants(count=number_of_participants, institution_name=institution_name, institution_url=institution_url, email_suffix=email_suffix, - test_password=experiment_passcode) + password=experiment_passcode) return super(RegisterSimpleParticipantsView, self).form_valid(form) def get_success_url(self): return reverse('core:dashboard') # FIXME: uses GET (which should be idempotent) to modify database state which makes HTTP sadful -class CloneExperimentView(ExperimenterSingleExperimentMixin, TemplateView): +class CloneExperimentView(ExperimenterSingleExperimentView): def process_experiment(self, experiment): return experiment.clone() def render_to_response(self, context): return redirect('core:dashboard') +class ClearParticipantsExperimentView(ExperimenterSingleExperimentView): + def process_experiment(self, experiment): + experiment.participants.all().delete() + return experiment + def render_to_response(self, context): + return redirect('core:dashboard') + @experimenter_required def manage(request, pk=None): try : @@ -257,7 +265,7 @@ writer.writerow([chat_message.group, chat_message.participant, chat_message.message, chat_message.date_created, round_configuration]) return response - except Experiment.DoesNotExist as e: + except Experiment.DoesNotExist: error_message = "Tried to download non-existent experiment, id %s" % pk logger.warning(error_message) messages.warning(request, error_message) diff -r ccf7fec8f874 -r 7303ce5ac2fe vcweb/static/css/style.css --- a/vcweb/static/css/style.css Tue Apr 12 16:53:41 2011 -0700 +++ b/vcweb/static/css/style.css Wed Apr 13 14:50:18 2011 -0700 @@ -55,7 +55,7 @@ display:inline; font-size: 0.8em; } -.submit input { +.submit input,button { position: relative; margin-left: 188px; } |
From: <vir...@li...> - 2011-04-12 23:53:49
|
Subject: hg.virtualcommons 327 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/ccf7fec8f874 changeset: 327:ccf7fec8f874 user: Allen Lee <all...@as...> date: Tue Apr 12 16:53:41 2011 -0700 description: fixing issues with register participants form, would like to add some ajax autocomplete to the form fields, should investigate django-autocomplete or just roll our own for this. TODO: fix bugs with clear participants diffstat: vcweb/core/forms.py | 2 +- vcweb/core/templates/experimenter/dashboard.html | 13 ++++++------- vcweb/core/templates/experimenter/register-participants.html | 5 +++-- vcweb/core/views.py | 7 ++++++- vcweb/requirements.pip | 1 + vcweb/settings_production.py | 18 ------------------ vcweb/static/css/style.css | 3 ++- 7 files changed, 19 insertions(+), 30 deletions(-) diffs (168 lines): diff -r b9a182a67d44 -r ccf7fec8f874 vcweb/core/forms.py --- a/vcweb/core/forms.py Tue Apr 12 15:03:23 2011 -0700 +++ b/vcweb/core/forms.py Tue Apr 12 16:53:41 2011 -0700 @@ -85,7 +85,7 @@ required=False, help_text='A URL, if applicable, for the institution (e.g., http://www.asu.edu)') class RegisterSimpleParticipantsForm(RegisterParticipantsForm): - email_suffix = forms.CharField(min_length='3', help_text='An email suffix without the "@" symbol. Generated participants will have usernames of the format s1..sn@email_suffix. For example, if you register 20 participants with an email suffix of example.edu, the system will generate 20 participants with usernames ranging from s1...@ex..., s2...@ex..., s3...@ex..., ... s2...@ex....') + email_suffix = forms.CharField(min_length=3, help_text='An email suffix without the "@" symbol. Generated participants will have usernames of the format s1..sn@email_suffix. For example, if you register 20 participants with an email suffix of example.edu, the system will generate 20 participants with usernames ranging from s1...@ex..., s2...@ex..., s3...@ex..., ... s2...@ex....') number_of_participants = forms.IntegerField(min_value=1, help_text='The number of participants to generate.') class RegisterEmailListParticipantsForm(RegisterParticipantsForm): diff -r b9a182a67d44 -r ccf7fec8f874 vcweb/core/templates/experimenter/dashboard.html --- a/vcweb/core/templates/experimenter/dashboard.html Tue Apr 12 15:03:23 2011 -0700 +++ b/vcweb/core/templates/experimenter/dashboard.html Tue Apr 12 16:53:41 2011 -0700 @@ -21,6 +21,9 @@ return false; }); }); + $('.experiment-menu').each(function() { + $(this).find('li:last a').attr('style', 'background-image: none;'); + }); }); </script> {% endblock %} @@ -42,23 +45,19 @@ {% for e in experiments %} <div class='notice ui-corner-all'> {{e.status_line}} <span style='padding: 3px;' class='ui-state-highlight'><b>{{e.participants.count}} registered participants</b></span> - <ul class='horizontal'> + <ul class='horizontal experiment-menu'> <li><a title='Monitor and control this experiment' href='{{e.monitor_url}}'><img src='/static/images/famfamfam/zoom.png' alt='General experiment monitoring interface'/> monitor</a></li> <li><a class='confirm-experiment-action' title='Creates a new copy of this experiment with the exact same configuration but no registered participants.' href='{{e.clone_url}}'><img src='/static/images/famfamfam/page_copy.png' alt='Clone experiment'/> clone</a></li> {% if e.participants.count == 0 %} <li> <a title='Register participants' href='{{e.controller_url}}/register-simple'><img src='/static/images/famfamfam/group_add.png' alt='register'/> register participants</a> </li> - <li> - <a class='confirm-experiment-action' title='Register 15 participants for this experiment' href='{{e.controller_url}}/add-participants/15'><img src='/static/images/famfamfam/add.png' alt='add participants'/> register <b>15 students</b></a> - <a class='confirm-experiment-action' title='Register 20 participants for this experiment' href='{{e.controller_url}}/add-participants/20'><b>20 students</b></a> - </li> {% else %} - <li><a title='clear all participants' href='{{e.controller_url}}/clear-participants' class='confirm-experiment-action'><img src='/static/images/famfamfam/group_del.png' alt=''/> clear all participants</a></li> + <li><a title='clear all participants' href='{{e.controller_url}}/clear-participants' class='confirm-experiment-action'><img src='/static/images/famfamfam/group_delete.png' alt=''/> clear all participants</a></li> {% endif %} <!-- <li><a href='{{e.management_url}}'><img src='/static/images/famfamfam/application_go.png' alt='Custom management interface'/> manage (unfinished)</a></li> --> {% if e.is_active %} - <li><a title='stop this experiment' href='{{e.stop_url}}' class='confirm-experiment-action' style='background-image:none;' ><img src='/static/images/famfamfam/stop.png' alt=''/> stop</a></li> + <li><a title='stop this experiment' href='{{e.stop_url}}' class='confirm-experiment-action'><img src='/static/images/famfamfam/stop.png' alt=''/> stop</a></li> {% endif %} </ul> </div> diff -r b9a182a67d44 -r ccf7fec8f874 vcweb/core/templates/experimenter/register-participants.html --- a/vcweb/core/templates/experimenter/register-participants.html Tue Apr 12 15:03:23 2011 -0700 +++ b/vcweb/core/templates/experimenter/register-participants.html Tue Apr 12 16:53:41 2011 -0700 @@ -8,14 +8,15 @@ $(function() { $('input:visible').each(function(i, val) { var labelTitle = $(val).prev().attr("title"); - $(val).qtip({ content: labelTitle, - position: { corner: {target: 'topRight', tooltip: 'bottomLeft'}}, + $(val).qtip({ content: labelTitle, + position: { corner: {target: 'topRight', tooltip: 'bottomLeft'}}, style: { name: 'cream', tip: 'bottomLeft'}, show: { when: { event: 'mouseover focus'} }, hide: { when: { event: 'mouseout blur' } } } ); }); + $('#id_experiment_pk').val({{experiment.pk}}); }); </script> {% endblock %} diff -r b9a182a67d44 -r ccf7fec8f874 vcweb/core/views.py --- a/vcweb/core/views.py Tue Apr 12 15:03:23 2011 -0700 +++ b/vcweb/core/views.py Tue Apr 12 16:53:41 2011 -0700 @@ -97,6 +97,7 @@ participant = Participant.objects.create(user=user, institution=institution) logger.debug("Creating new participant: %s" % participant) auth.login(self.request, auth.authenticate(username=email, password=password)) + return super(RegistrationView, self).form_valid(form) def get_success_url(self): return reverse('core:dashboard') @@ -192,7 +193,7 @@ form_class = RegisterSimpleParticipantsForm template_name = 'experimenter/register-simple-participants.html' def form_valid(self, form): - number_of_participants = form['number_of_participants'] + number_of_participants = form.cleaned_data.get('number_of_participants') email_suffix = form['email_suffix'] experiment = self.object experiment_passcode = form['experiment_passcode'] @@ -203,6 +204,10 @@ institution_url=institution_url, email_suffix=email_suffix, test_password=experiment_passcode) + return super(RegisterSimpleParticipantsView, self).form_valid(form) + + def get_success_url(self): + return reverse('core:dashboard') # FIXME: uses GET (which should be idempotent) to modify database state which makes HTTP sadful class CloneExperimentView(ExperimenterSingleExperimentMixin, TemplateView): diff -r b9a182a67d44 -r ccf7fec8f874 vcweb/requirements.pip --- a/vcweb/requirements.pip Tue Apr 12 15:03:23 2011 -0700 +++ b/vcweb/requirements.pip Tue Apr 12 16:53:41 2011 -0700 @@ -7,6 +7,7 @@ kombu django-kombu django-dajaxice +django-autocomplete #django-unittest-depth #redis #beanstalkc diff -r b9a182a67d44 -r ccf7fec8f874 vcweb/settings_production.py --- a/vcweb/settings_production.py Tue Apr 12 15:03:23 2011 -0700 +++ b/vcweb/settings_production.py Tue Apr 12 16:53:41 2011 -0700 @@ -6,7 +6,6 @@ ADMINS = ( ('Allen Lee', 'all...@as...'), ) - MANAGERS = ADMINS DATABASES = { @@ -30,28 +29,11 @@ LANGUAGE_CODE = 'en-us' SITE_ID = 1 - # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. # XXX: no i18n for the time being USE_I18N = False -# Absolute path to the directory that holds media. -# Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = '' - -# URL that handles the media served from MEDIA_ROOT. Make sure to use a -# trailing slash if there is a path component (optional in other cases). -# Examples: "http://media.lawrence.com", "http://example.com/media/" -MEDIA_URL = '' - -# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a -# trailing slash. -# this typically stored somewhere like -# $VIRTUALENV/lib/python2.6/site-packages/django/contrib/admin/media -# FIXME: this will get adjusted once we switch to django 1.3 and use the django.contrib.staticfiles app -ADMIN_MEDIA_PREFIX = '/media/' - # django celery integration # celery rabbitmq/amqp configuration BROKER_HOST = "localhost" diff -r b9a182a67d44 -r ccf7fec8f874 vcweb/static/css/style.css --- a/vcweb/static/css/style.css Tue Apr 12 15:03:23 2011 -0700 +++ b/vcweb/static/css/style.css Tue Apr 12 16:53:41 2011 -0700 @@ -56,7 +56,8 @@ font-size: 0.8em; } .submit input { - margin-left: 13em; + position: relative; + margin-left: 188px; } ul.messages { |
From: <vir...@li...> - 2011-04-12 22:03:31
|
Subject: hg.virtualcommons 326 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/b9a182a67d44 changeset: 326:b9a182a67d44 user: Allen Lee <all...@as...> date: Tue Apr 12 15:03:23 2011 -0700 description: set up django.contrib.staticfiles app so static materials associated with each experiment can live within their own app_name/static/ directories. Unfortunately since I'd like to still namespace things properly within the final static root, this means we'll need to have directory structures like forestry/static/images/forestry/foo... should see if this can be adjusted or fixed. diffstat: vcweb/core/templates/experimenter/register-participants.html | 4 +- vcweb/core/views.py | 6 +- vcweb/forestry/static/images/forestry/deforestation.jpg | vcweb/forestry/static/images/forestry/logo.png | vcweb/forestry/static/images/forestry/pine-tree.png | vcweb/forestry/templates/forestry/wait.html | 2 +- vcweb/settings.py | 31 +++++++-------- vcweb/static/images/forestry/deforestation.jpg | vcweb/static/images/forestry/logo.png | vcweb/static/images/forestry/pine-tree.png | vcweb/urls.py | 16 ++----- 11 files changed, 26 insertions(+), 33 deletions(-) diffs (176 lines): diff -r cdac6c720808 -r b9a182a67d44 vcweb/core/templates/experimenter/register-participants.html --- a/vcweb/core/templates/experimenter/register-participants.html Fri Apr 08 22:37:22 2011 -0700 +++ b/vcweb/core/templates/experimenter/register-participants.html Tue Apr 12 15:03:23 2011 -0700 @@ -22,7 +22,9 @@ {% block page %} <form id='register-participants-form' action='' method='post'> <h3>Register participants</h3> - <p>Please register participants for {{experiment}}. + <p>Please register participants for <span style='padding:1px;' class='info'>{{experiment}}</span>. + </p> + <p> <span style='padding: 3px;' class='ui-state-highlight'><b>There are currently {{experiment.participants.count}} registered participants.</b></span> {% include "includes/form-as-div.html" %} <div class='submit'> diff -r cdac6c720808 -r b9a182a67d44 vcweb/core/views.py --- a/vcweb/core/views.py Fri Apr 08 22:37:22 2011 -0700 +++ b/vcweb/core/views.py Tue Apr 12 15:03:23 2011 -0700 @@ -11,9 +11,9 @@ from django.views.generic.base import TemplateResponseMixin from django.views.generic.detail import SingleObjectMixin, DetailView from django.views.generic.edit import BaseUpdateView, UpdateView -from vcweb.core.forms import (RegistrationForm, LoginForm, ParticipantAccountForm, ExperimenterAccountForm, +from vcweb.core.forms import (RegistrationForm, LoginForm, ParticipantAccountForm, ExperimenterAccountForm, RegisterEmailListParticipantsForm, RegisterSimpleParticipantsForm) -from vcweb.core.models import (Participant, Experiment, Institution, ParticipantExperimentRelationship, +from vcweb.core.models import (Participant, Experiment, Institution, ParticipantExperimentRelationship, is_participant, is_experimenter) from vcweb.core.decorators import anonymous_required, experimenter_required, participant_required import hashlib @@ -199,7 +199,7 @@ institution_name = form['institution_name'] institution_url = form['institution_url'] experiment.setup_test_participants(count=number_of_participants, - institution_name=institution_name, + institution_name=institution_name, institution_url=institution_url, email_suffix=email_suffix, test_password=experiment_passcode) diff -r cdac6c720808 -r b9a182a67d44 vcweb/forestry/static/images/forestry/deforestation.jpg Binary file vcweb/forestry/static/images/forestry/deforestation.jpg has changed diff -r cdac6c720808 -r b9a182a67d44 vcweb/forestry/static/images/forestry/logo.png Binary file vcweb/forestry/static/images/forestry/logo.png has changed diff -r cdac6c720808 -r b9a182a67d44 vcweb/forestry/static/images/forestry/pine-tree.png Binary file vcweb/forestry/static/images/forestry/pine-tree.png has changed diff -r cdac6c720808 -r b9a182a67d44 vcweb/forestry/templates/forestry/wait.html --- a/vcweb/forestry/templates/forestry/wait.html Fri Apr 08 22:37:22 2011 -0700 +++ b/vcweb/forestry/templates/forestry/wait.html Tue Apr 12 15:03:23 2011 -0700 @@ -54,7 +54,7 @@ <th style='width:12em;' class='tooltip' title='The total number of trees harvested by your group in this round.'> Total group harvest decisions (B) </th> - <th class='tooltip' title='The trees that regrew during this round.'>Trees regrown (C)</th> + <th class='tooltip' title='The trees that regrew during this round (C = (A - B) * .10)'>Trees regrown (C)</th> <th class='tooltip' title='The number of trees available at the end of the round (A - B + C = D).'>Final # trees (D)</th></tr> </thead> <tbody> diff -r cdac6c720808 -r b9a182a67d44 vcweb/settings.py --- a/vcweb/settings.py Fri Apr 08 22:37:22 2011 -0700 +++ b/vcweb/settings.py Tue Apr 12 15:03:23 2011 -0700 @@ -12,7 +12,6 @@ DEBUG = True TEMPLATE_DEBUG = DEBUG -LOCAL_DEVELOPMENT = True ADMINS = ( ('Allen Lee', 'all...@as...') @@ -42,21 +41,20 @@ # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. -USE_I18N = True +USE_I18N = False # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = '' +#MEDIA_ROOT = '' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" -MEDIA_URL = '/static/' +#MEDIA_URL = '/static/' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a -# trailing slash. -# Examples: "http://foo.com/media/", "/media/". -ADMIN_MEDIA_PREFIX = '/media/' +# trailing slash. Default is '/static/admin/' +# ADMIN_MEDIA_PREFIX = '/static/admin/' # Make this unique, and don't share it with anybody. SECRET_KEY = '2km^iq&48&6uv*x$ew@56d0#w9zqth@)_4tby(85+ac2wf4r-u' @@ -110,7 +108,6 @@ 'dajaxice', ) -STATIC_ROOT = "/var/www/vcweb/static" DAJAXICE_MEDIA_PREFIX = "dajaxice" @@ -137,19 +134,12 @@ # use email as username for authentication AUTHENTICATION_BACKENDS = ("vcweb.core.auth.AuthenticationBackend", "django.contrib.auth.backends.ModelBackend",) -# static base dir used in dev mode with a sanity check for windows paths -STATIC_BASE_DIR = path.join(path.dirname(__file__), 'static').replace('\\', '/') -STATIC_URL = "/static" +STATIC_URL = '/static/' +STATIC_ROOT = '/var/www/vcweb/static/' STATICFILES_DIRS = ( path.join(path.abspath(path.dirname(__file__)), 'static').replace('\\', '/'), ) -try: - from settings_local import * -except ImportError: - logging.debug("Couldn't load local settings") - pass - import djcelery djcelery.setup_loader() @@ -161,3 +151,10 @@ messages.constants.WARNING: 'ui-state-error ui-corner-all', messages.constants.ERROR: 'ui-state-error ui-corner-all' } +try: + from settings_local import * +except ImportError: + logging.debug("Couldn't load local settings") + pass + + diff -r cdac6c720808 -r b9a182a67d44 vcweb/static/images/forestry/deforestation.jpg Binary file vcweb/static/images/forestry/deforestation.jpg has changed diff -r cdac6c720808 -r b9a182a67d44 vcweb/static/images/forestry/logo.png Binary file vcweb/static/images/forestry/logo.png has changed diff -r cdac6c720808 -r b9a182a67d44 vcweb/static/images/forestry/pine-tree.png Binary file vcweb/static/images/forestry/pine-tree.png has changed diff -r cdac6c720808 -r b9a182a67d44 vcweb/urls.py --- a/vcweb/urls.py Fri Apr 08 22:37:22 2011 -0700 +++ b/vcweb/urls.py Tue Apr 12 15:03:23 2011 -0700 @@ -1,4 +1,4 @@ -from django.conf.urls.defaults import * +from django.conf.urls.defaults import patterns, url, include from django.contrib import admin from vcweb import settings @@ -22,8 +22,9 @@ url(r'^accounts/reset/done/$', 'django.contrib.auth.views.password_reset_complete', {'template_name':'password_reset_complete.html'}), url(r'^%s/' % settings.DAJAXICE_MEDIA_PREFIX, include('dajaxice.urls')), - # FIXME: figure out if we can dynamically include every custom app's - # urlconf + # FIXME: ideally this should be set up dynamically by iterating through each + # ExperimentMetadata instance and using their namespace (e.g., replace all + # instances of forestry with ExperimentMetadata.namespace) url(r'^forestry/', include('vcweb.forestry.urls', namespace='forestry', app_name='forestry')), url(r'^admin/', include(admin.site.urls)), # core catches everything else @@ -34,12 +35,5 @@ # (r'^admin/doc/', include('django.contrib.admindocs.urls')), ) -if settings.LOCAL_DEVELOPMENT: - ''' - urlpatterns += patterns('', - (r'^static/(?P<path>.*)/$', 'django.views.static.serve', - {'document_root': settings.STATIC_BASE_DIR, 'show_indexes': True} - ),) - ''' +if settings.DEBUG: urlpatterns += staticfiles_urlpatterns() - |
From: <vir...@li...> - 2011-04-12 22:03:31
|
Subject: hg.virtualcommons 325 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/cdac6c720808 changeset: 325:cdac6c720808 user: Allen Lee <all...@as...> date: Fri Apr 08 22:37:22 2011 -0700 description: switching to django 1.3 staticfiles app diffstat: vcweb/settings.py | 12 ++++++++---- vcweb/urls.py | 8 +++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diffs (69 lines): diff -r 6f16f4433a5f -r cdac6c720808 vcweb/settings.py --- a/vcweb/settings.py Fri Apr 08 17:17:44 2011 -0700 +++ b/vcweb/settings.py Fri Apr 08 22:37:22 2011 -0700 @@ -1,5 +1,5 @@ # Django settings for vcweb project. -import os.path +from os import path import logging LOG_FILENAME = 'vcweb.log' @@ -70,9 +70,9 @@ TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.request', + 'django.core.context_processors.static', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', -# 'django.core.context_processors.static', ) MIDDLEWARE_CLASSES = ( @@ -102,7 +102,7 @@ 'django.contrib.sites', 'django.contrib.admin', 'django.contrib.messages', -# 'django.contrib.staticfiles', + 'django.contrib.staticfiles', 'vcweb.core', 'vcweb.forestry', 'djcelery', @@ -138,7 +138,11 @@ AUTHENTICATION_BACKENDS = ("vcweb.core.auth.AuthenticationBackend", "django.contrib.auth.backends.ModelBackend",) # static base dir used in dev mode with a sanity check for windows paths -STATIC_BASE_DIR = os.path.join(os.path.dirname(__file__), 'static').replace('\\', '/') +STATIC_BASE_DIR = path.join(path.dirname(__file__), 'static').replace('\\', '/') +STATIC_URL = "/static" +STATICFILES_DIRS = ( + path.join(path.abspath(path.dirname(__file__)), 'static').replace('\\', '/'), + ) try: from settings_local import * diff -r 6f16f4433a5f -r cdac6c720808 vcweb/urls.py --- a/vcweb/urls.py Fri Apr 08 17:17:44 2011 -0700 +++ b/vcweb/urls.py Fri Apr 08 22:37:22 2011 -0700 @@ -3,6 +3,7 @@ from vcweb import settings from django.views.generic.base import TemplateView +from django.contrib.staticfiles.urls import staticfiles_urlpatterns from dajaxice.core import dajaxice_autodiscover # set up dajaxice URLs @@ -34,10 +35,11 @@ ) if settings.LOCAL_DEVELOPMENT: + ''' urlpatterns += patterns('', (r'^static/(?P<path>.*)/$', 'django.views.static.serve', {'document_root': settings.STATIC_BASE_DIR, 'show_indexes': True} - ), + ),) + ''' + urlpatterns += staticfiles_urlpatterns() - ) - |
From: <vir...@li...> - 2011-04-09 00:13:49
|
Subject: hg.virtualcommons 324 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/6f16f4433a5f changeset: 324:6f16f4433a5f user: Allen Lee <all...@as...> date: Fri Apr 08 17:17:44 2011 -0700 description: slight tooltip tweaking, add registration next. diffstat: vcweb/core/forms.py | 6 +++--- vcweb/core/templates/experimenter/base.html | 8 +++++++- vcweb/core/templates/experimenter/register-participants.html | 14 +++++++++++++- vcweb/core/templates/includes/form-as-div.html | 2 +- vcweb/static/css/guarantee/style.css | 6 ------ vcweb/static/css/style.css | 4 ++++ 6 files changed, 28 insertions(+), 12 deletions(-) diffs (111 lines): diff -r 463f25c8be9b -r 6f16f4433a5f vcweb/core/forms.py --- a/vcweb/core/forms.py Fri Apr 08 15:06:31 2011 -0700 +++ b/vcweb/core/forms.py Fri Apr 08 17:17:44 2011 -0700 @@ -78,14 +78,14 @@ class RegisterParticipantsForm(forms.ModelForm): experiment_pk = forms.IntegerField(widget=widgets.HiddenInput) - experiment_passcode = forms.CharField(min_length=3, label="Experiment passcode", help_text='The password used to login to your experiment.', initial='test') + experiment_passcode = forms.CharField(min_length=3, label="Experiment passcode", help_text='The password used to login to your experiment.') institution_name = forms.CharField(min_length=3,label="Institution name", help_text='The name of the institution to be associated with these test participants') institution_url = forms.CharField(min_length=3,label='Institution URL', - required=False, help_text='A URL, if applicable, for the institution. E.g., http://www.asu.edu') + required=False, help_text='A URL, if applicable, for the institution (e.g., http://www.asu.edu)') class RegisterSimpleParticipantsForm(RegisterParticipantsForm): - email_suffix = forms.CharField(min_length='3', help_text='Generated participants will have usernames of the format s1..sn@<email_suffix>. For example, if you register 20 participants with an email suffix of example.edu, the system will generate 20 participants with usernames ranging from s1...@ex..., s2...@ex..., up to s2...@ex....') + email_suffix = forms.CharField(min_length='3', help_text='An email suffix without the "@" symbol. Generated participants will have usernames of the format s1..sn@email_suffix. For example, if you register 20 participants with an email suffix of example.edu, the system will generate 20 participants with usernames ranging from s1...@ex..., s2...@ex..., s3...@ex..., ... s2...@ex....') number_of_participants = forms.IntegerField(min_value=1, help_text='The number of participants to generate.') class RegisterEmailListParticipantsForm(RegisterParticipantsForm): diff -r 463f25c8be9b -r 6f16f4433a5f vcweb/core/templates/experimenter/base.html --- a/vcweb/core/templates/experimenter/base.html Fri Apr 08 15:06:31 2011 -0700 +++ b/vcweb/core/templates/experimenter/base.html Fri Apr 08 17:17:44 2011 -0700 @@ -2,7 +2,13 @@ {% block head %} {{ block.super}} <script type='text/javascript'> - var qtipOptions = {position: { corner: {target: 'topMiddle', tooltip: 'bottomMiddle'}}, style: { name: 'dark', tip: 'bottomMiddle'} }; + function getQtipOptions(style) { + if (! style) { + style = "dark"; + } + return {position: { corner: {target: 'topMiddle', tooltip: 'bottomMiddle'}}, style: { name: style, tip: 'bottomMiddle'} }; + } + var qtipOptions = getQtipOptions(); $(function() { $('[title]').qtip(qtipOptions); }); diff -r 463f25c8be9b -r 6f16f4433a5f vcweb/core/templates/experimenter/register-participants.html --- a/vcweb/core/templates/experimenter/register-participants.html Fri Apr 08 15:06:31 2011 -0700 +++ b/vcweb/core/templates/experimenter/register-participants.html Fri Apr 08 17:17:44 2011 -0700 @@ -6,7 +6,16 @@ {% include "includes/jquery.forms.html" %} <script type='text/javascript'> $(function() { - + $('input:visible').each(function(i, val) { + var labelTitle = $(val).prev().attr("title"); + $(val).qtip({ content: labelTitle, + position: { corner: {target: 'topRight', tooltip: 'bottomLeft'}}, + style: { name: 'cream', tip: 'bottomLeft'}, + show: { when: { event: 'mouseover focus'} }, + hide: { when: { event: 'mouseout blur' } } + } + ); + }); }); </script> {% endblock %} @@ -16,5 +25,8 @@ <p>Please register participants for {{experiment}}. <span style='padding: 3px;' class='ui-state-highlight'><b>There are currently {{experiment.participants.count}} registered participants.</b></span> {% include "includes/form-as-div.html" %} + <div class='submit'> + <input type='submit' value='Register' /> + </div> </form> {% endblock page %} diff -r 463f25c8be9b -r 6f16f4433a5f vcweb/core/templates/includes/form-as-div.html --- a/vcweb/core/templates/includes/form-as-div.html Fri Apr 08 15:06:31 2011 -0700 +++ b/vcweb/core/templates/includes/form-as-div.html Fri Apr 08 17:17:44 2011 -0700 @@ -1,7 +1,7 @@ {% for field in form %} <div class='field'> {% if not field.is_hidden %} -<span class='label'>{{ field.label_tag }}:</span> +<span class='label' title='{{field.help_text}}'>{{ field.label_tag }}:</span> {% endif %} {{ field }} {% if field.errors %} diff -r 463f25c8be9b -r 6f16f4433a5f vcweb/static/css/guarantee/style.css --- a/vcweb/static/css/guarantee/style.css Fri Apr 08 15:06:31 2011 -0700 +++ b/vcweb/static/css/guarantee/style.css Fri Apr 08 17:17:44 2011 -0700 @@ -12,12 +12,6 @@ color: #8A8A8A; } -.submit input { - margin-left: 12em; -} - - - p, ul, ol { margin-top: 0; text-align: left; diff -r 463f25c8be9b -r 6f16f4433a5f vcweb/static/css/style.css --- a/vcweb/static/css/style.css Fri Apr 08 15:06:31 2011 -0700 +++ b/vcweb/static/css/style.css Fri Apr 08 17:17:44 2011 -0700 @@ -55,6 +55,10 @@ display:inline; font-size: 0.8em; } +.submit input { + margin-left: 13em; +} + ul.messages { margin-left: 0; list-style: none; |
From: <vir...@li...> - 2011-04-08 22:02:38
|
Subject: hg.virtualcommons 323 details: http://virtualcommons.hg.sourceforge.net:8000/hgroot/virtualcommons/virtualcommons/hgrepo/v/vi/virtualcommons/virtualcommons/rev/463f25c8be9b changeset: 323:463f25c8be9b user: Allen Lee <all...@as...> date: Fri Apr 08 15:06:31 2011 -0700 description: cleaning up docs a bit diffstat: .hgignore | 1 + docs/source/core.rst | 15 +++++ vcweb/core/forms.py | 2 +- vcweb/core/models.py | 75 ++++++++++++++++-------- vcweb/core/templates/includes/form-as-div.html | 2 +- vcweb/forestry/management.py | 7 ++- 6 files changed, 74 insertions(+), 28 deletions(-) diffs (226 lines): diff -r 122713a23d01 -r 463f25c8be9b .hgignore --- a/.hgignore Fri Apr 08 12:08:02 2011 -0700 +++ b/.hgignore Fri Apr 08 15:06:31 2011 -0700 @@ -8,3 +8,4 @@ .settings *.log .idea +build diff -r 122713a23d01 -r 463f25c8be9b docs/source/core.rst --- a/docs/source/core.rst Fri Apr 08 12:08:02 2011 -0700 +++ b/docs/source/core.rst Fri Apr 08 15:06:31 2011 -0700 @@ -1,5 +1,20 @@ VCWEB Core ========== +The vcweb core app provides data models and support for experiments, configurations, +participants, experimenters, and three primary types of data: + + 1. participant data generated during the course of a round + 2. group data shared across each participant in the group + 3. round and experiment configuration data. + +Using the forestry experiment as a concrete example, participant data may consist of +a harvest decision in a given round or a chat message sent during a communication +round. Examples of group shared data are the current resource level for a given +group and the amount of regrowth experienced by the group. Round and experiment +configuration data include how many initial trees are provided at the start of the +experiment, how many rounds the experiment should consist of as well as the explicit +ordering of the rounds. + .. automodule:: vcweb.core.models :members: diff -r 122713a23d01 -r 463f25c8be9b vcweb/core/forms.py --- a/vcweb/core/forms.py Fri Apr 08 12:08:02 2011 -0700 +++ b/vcweb/core/forms.py Fri Apr 08 15:06:31 2011 -0700 @@ -78,7 +78,7 @@ class RegisterParticipantsForm(forms.ModelForm): experiment_pk = forms.IntegerField(widget=widgets.HiddenInput) - experiment_passcode = forms.CharField(min_length=3, label="Experiment passcode", help_text='The password used to login to your experiment.') + experiment_passcode = forms.CharField(min_length=3, label="Experiment passcode", help_text='The password used to login to your experiment.', initial='test') institution_name = forms.CharField(min_length=3,label="Institution name", help_text='The name of the institution to be associated with these test participants') institution_url = forms.CharField(min_length=3,label='Institution URL', diff -r 122713a23d01 -r 463f25c8be9b vcweb/core/models.py --- a/vcweb/core/models.py Fri Apr 08 12:08:02 2011 -0700 +++ b/vcweb/core/models.py Fri Apr 08 15:06:31 2011 -0700 @@ -38,12 +38,15 @@ def get_by_natural_key(self, key): return self.get(namespace=key) -""" -ExperimentMetadata contains records for each type of supported and implement -experiment. A single app could add multiple experiment metadata records but -they should be closely related. -""" class ExperimentMetadata(models.Model): + """ + An ExperimentMetadata record represents the *type* of a given implemented Experiment, e.g., **Forestry** or + **Irrigation**. This shouldn't be confused with a **Forestry** or **Irrigation** Experiment instance, which + represents a concrete experiment run, with a specific configuration, experimenter, etc. Each experiment app + should define and add a single ExperimentMetadata record for the experiment type that it represents. You can + register an ExperimentMetadata object by creating a JSON/YAML/SQL representation of it in your app/fixtures + directory (e.g., irrigation/fixtures/irrigation.json) and then invoking ``python manage.py loaddata irrigation``. + """ title = models.CharField(max_length=255) # the URL fragment that this experiment_metadata will occupy, namespace_regex = re.compile(r'^(?:[/]?[a-z0-9_]+\/?)+$') @@ -80,11 +83,8 @@ 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. - FIXME: should revisit to see if this is recommended practice. - (either one or the other) + Base class for both Participants and Experimenters. The actual participant or experimenter can be resolved as + user.participant or user.experimenter due to the OneToOne with django.contrib.User. """ user = models.OneToOneField(User, related_name='%(class)s', verbose_name=u'Django User', unique=True) failed_password_attempts = models.PositiveIntegerField(default=0) @@ -123,6 +123,10 @@ ordering = ['user'] class ExperimentConfiguration(models.Model): + """ + The configuration for a given Experiment instance. One ExperimentConfiguration can be applied to many Experiment + instances but can only be associated to a single ExperimentMetadata record. + """ experiment_metadata = models.ForeignKey(ExperimentMetadata, related_name='configurations') creator = models.ForeignKey(Experimenter, related_name='experiment_configurations') name = models.CharField(max_length=255) @@ -165,9 +169,11 @@ for experiment in es.all(): experiment.check_elapsed_time() -# an actual instance of an experiment; represents a concrete -# parameterization of this experiment. class Experiment(models.Model): + """ + Experiment instances are a concrete parameterization of an ExperimentMetadata record, with associated + ExperimentConfiguration, Experimenter, etc. In other words, they represent an actual experiment run. + """ STATUS_CHOICES = (('INACTIVE', 'Not active'), ('ACTIVE', 'Active, no round in progress'), ('PAUSED', 'Paused'), @@ -175,44 +181,51 @@ ('COMPLETED', 'Completed')) (INACTIVE, ACTIVE, PAUSED, ROUND_IN_PROGRESS, COMPLETED) = [ choice[0] for choice in STATUS_CHOICES ] authentication_code = models.CharField(max_length=32, default="vcweb.auth.code") + """ + currently unused, but kept here in the event that we want to allow participants to authenticate with this + authentication_code either in lieu or in addition to their own user password. + """ current_round_sequence_number = models.PositiveIntegerField(default=1) + """ Each round is assigned a sequential sequence number, ranging from 1 to N. Used to identify which round the + experiment is currently running. """ experimenter = models.ForeignKey(Experimenter, related_name='experiments') + """ the user running this experiment """ experiment_metadata = models.ForeignKey(ExperimentMetadata) - experiment_configuration = models.ForeignKey(ExperimentConfiguration, - related_name='experiments') + """ the experiment metadata object that this experiment instance represents """ + experiment_configuration = models.ForeignKey(ExperimentConfiguration, related_name='experiments') + """ the configuration parameters in use for this experiment run. """ status = models.CharField(max_length=32, choices=STATUS_CHOICES, default='INACTIVE') + """ + the status of an experiment can be either INACTIVE, ACTIVE, PAUSED, ROUND_IN_PROGRESS, or COMPLETED + """ date_created = models.DateTimeField(auto_now_add=True) last_modified = models.DateTimeField(auto_now=True) start_date_time = models.DateTimeField(null=True, blank=True) # how long this experiment should run in a date format # 1w2d = 1 week 2 days = 9d duration = models.CharField(max_length=32, null=True, blank=True) + tick_duration = models.CharField(max_length=32, null=True, blank=True) """ how often the experiment_metadata server should tick. """ - tick_duration = models.CharField(max_length=32, null=True, blank=True) + total_elapsed_time = models.PositiveIntegerField(default=0) """ total elapsed time in seconds since this experiment_metadata was started, incremented by the heartbeat monitor. """ - total_elapsed_time = models.PositiveIntegerField(default=0) + current_round_start_time = models.DateTimeField(null=True, blank=True) """ current round start time """ - current_round_start_time = models.DateTimeField(null=True, blank=True) + current_round_elapsed_time = models.PositiveIntegerField(default=0) """ elapsed time in seconds for the current round. """ - current_round_elapsed_time = models.PositiveIntegerField(default=0) + is_experimenter_driven = models.BooleanField(default=True) """ Experimenter driven experiments have checkpoints where the experimenter needs to explicitly signal the system to move to the next round or stage. """ - is_experimenter_driven = models.BooleanField(default=True) - """ name of the AMQP exchange hosting this experiment """ amqp_exchange_name = models.CharField(max_length=64, default="vcweb.default.exchange") - ''' - short slug to use instead of pk - FIXME: still needs to be implemented - ''' slug = models.SlugField(max_length=16, unique=True, null=True, blank=True) + ''' short slug to use instead of experiment pk, currently unimplemented ''' objects = ExperimentManager() @@ -1157,12 +1170,24 @@ round_data=current_round_data) class ChatMessage(models.Model): + """ + A chat message sent by a participant in a group to the rest of the members of the group or a target participant + if target_participant is set. + """ participant_group_relationship = models.ForeignKey(ParticipantGroupRelationship, related_name='chat_messages') + """ the combination of participant and group that generated this chat message """ + message = models.CharField(max_length=512) + """ the chat message """ + + target_participant = models.ForeignKey(ParticipantGroupRelationship, null=True, blank=True, related_name='targets') """ if set, this is a targeted message to the other participant in this group. If null, this is a broadcast message to the entire group """ - target_participant = models.ForeignKey(ParticipantGroupRelationship, null=True, blank=True, related_name='targets') + date_created = models.DateTimeField(auto_now_add=True) + """ the creation datetime of this chat message """ + round_data = models.ForeignKey(RoundData, related_name='chat_messages') + """ the round data associated with this chat message """ objects = ChatMessageManager() diff -r 122713a23d01 -r 463f25c8be9b vcweb/core/templates/includes/form-as-div.html --- a/vcweb/core/templates/includes/form-as-div.html Fri Apr 08 12:08:02 2011 -0700 +++ b/vcweb/core/templates/includes/form-as-div.html Fri Apr 08 15:06:31 2011 -0700 @@ -5,7 +5,7 @@ {% endif %} {{ field }} {% if field.errors %} -<label class='error' for='id_{{ field.name }}' title='{{field.help_text}}'>{{ field.errors|join:". " }}</label> +<label class='error' for='id_{{ field.name }}' >{{ field.errors|join:". " }}</label> {% endif %} </div> {% endfor %} diff -r 122713a23d01 -r 463f25c8be9b vcweb/forestry/management.py --- a/vcweb/forestry/management.py Fri Apr 08 12:08:02 2011 -0700 +++ b/vcweb/forestry/management.py Fri Apr 08 15:06:31 2011 -0700 @@ -14,7 +14,12 @@ XXX: also create forestry parameters here? FIXME: what are pros/cons for doing it this way vs adding it to initial_data.json -pro: don't have to hard-code pks and pk references.. +pros: +1. don't have to hard-code pks and pk references.. + +cons: +1. have to invoke syncdb in order to get this to run + ''' def post_syncdb_handler(sender, **kwargs): |