[virtualcommons-svn] commit/vcweb: alllee: placeholders and initial set up for the sanitation exper
Status: Beta
Brought to you by:
alllee
From: Bitbucket <com...@bi...> - 2011-05-25 21:53:53
|
1 new changeset in vcweb: http://bitbucket.org/virtualcommons/vcweb/changeset/ec158c1f9650/ changeset: r371:ec158c1f9650 user: alllee date: 2011-05-25 23:53:46 summary: placeholders and initial set up for the sanitation experiment affected #: 11 files (3.3 KB) --- a/vcweb/core/models.py Fri May 20 23:26:48 2011 -0700 +++ b/vcweb/core/models.py Wed May 25 14:53:46 2011 -0700 @@ -274,6 +274,10 @@ return "/%s/experimenter" % self.get_absolute_url() @property + def configure_url(self): + return "/%s/configure" % self.get_absolute_url() + + @property def stop_url(self): return "%s/stop" % self.controller_url @@ -1325,4 +1329,3 @@ def is_participant(user): return hasattr(user, 'participant') and isinstance(user.participant, Participant) - --- a/vcweb/core/templates/experimenter/dashboard.html Fri May 20 23:26:48 2011 -0700 +++ b/vcweb/core/templates/experimenter/dashboard.html Wed May 25 14:53:46 2011 -0700 @@ -58,9 +58,12 @@ {% else %} <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_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_URL}}images/famfamfam/stop.png' alt=''/> stop</a></li> + {% else %} + <li> + <a title='Configure this experiment (currently implemented for sanitation game)' href='{{e.configure_url}}'><img src='{{STATIC_URL}}images/famfamfam/wrench.png' alt='configure' /> configure</a> + </li> {% endif %} </ul></div> --- a/vcweb/core/views.py Fri May 20 23:26:48 2011 -0700 +++ b/vcweb/core/views.py Wed May 25 14:53:46 2011 -0700 @@ -53,8 +53,9 @@ elif is_experimenter(user): commons_user = user.experimenter else: - logger.error("Invalid user: %s" % user) + logger.error("Invalid user: %s", user) return + logger.debug("%s authentication_token=%s", commons_user, authentication_token) commons_user.authentication_token = authentication_token commons_user.save() @@ -65,7 +66,6 @@ request = self.request user = form.user_cache auth.login(request, user) - 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): @@ -97,13 +97,14 @@ if experimenter_requested: experimenter = Experimenter.objects.create(user=user, institution=institution) - logger.debug("creating new experimenter: %s, adding default forestry experiment" % experimenter) + logger.debug("creating new experimenter: %s, adding default forestry experiment", experimenter) + # FIXME: add a default experiment for all ExperimentMetadata types # FIXME: hard coded slovakia experiment, get rid of this! experiment = Experiment.objects.get(pk=1) experiment.clone(experimenter=experimenter) else: participant = Participant.objects.create(user=user, institution=institution) - logger.debug("Creating new participant: %s" % participant) + logger.debug("Creating new participant: %s", participant) request = self.request auth.login(request, auth.authenticate(username=email, password=password)) set_authentication_token(user, request.session.session_key) @@ -139,7 +140,7 @@ experiment = Experiment.objects.get(experiment_metadata__namespace=namespace) if not experiment: - logger.warning("Tried to request instructions for id %s or namespace %s" % (pk, namespace)) + logger.warning("Tried to request instructions for id %s or namespace %s", pk, namespace) return redirect('home') return render_to_response(experiment.get_template_path('instructions.html'), locals(), context_instance=RequestContext(request)) @@ -196,7 +197,7 @@ def form_valid(self, form): emails = form.cleaned_data.get('participant_emails') experiment = self.object - logger.debug("registering participants %s for experiment: %s" % (emails, experiment)) + 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=form.institution, password=experiment.authentication_code) @@ -240,8 +241,7 @@ # redirect to experiment specific management page? return redirect(experiment.management_url) except Experiment.DoesNotExist: - logger.warning("Tried to manage non-existent experiment with id %s" % - pk) + logger.warning("Tried to manage non-existent experiment with id %s", pk) # FIXME: add data converter objects to write to csv, excel, etc. --- a/vcweb/forestry/urls.py Fri May 20 23:26:48 2011 -0700 +++ b/vcweb/forestry/urls.py Wed May 25 14:53:46 2011 -0700 @@ -4,8 +4,8 @@ url(r'^$', 'index', name='index'), url(r'^participate/?$', 'participant_index', name='participant_index'), url(r'^experiment/?$', 'experimenter_index', name='experimenter_index'), - url(r'^configure/(?P<experiment_id>\d+)$', 'configure', name='configure'), - url(r'^(?P<experiment_id>\d+)/experimenter$', 'manage_experiment', name='manage_experiment'), + url(r'^(?P<experiment_id>\d+)/configure$', 'configure', name='configure'), + url(r'^(?P<experiment_id>\d+)/experimenter$', 'monitor_experiment', name='monitor_experiment'), url(r'^(?P<experiment_id>\d+)/wait$', 'wait', name='wait'), url(r'^(?P<experiment_id>\d+)/participate$', 'participate', name='participate'), ) --- a/vcweb/forestry/views.py Fri May 20 23:26:48 2011 -0700 +++ b/vcweb/forestry/views.py Wed May 25 14:53:46 2011 -0700 @@ -47,11 +47,11 @@ return render_to_response('forestry/participant-index.html', locals(), context_instance=RequestContext(request)) @experimenter_required -def configure(request): - return Http404() +def configure(request, experiment_id=None): + raise Http404() @experimenter_required -def manage_experiment(request, experiment_id=None): +def monitor_experiment(request, experiment_id=None): try: experiment = Experiment.objects.get(pk=experiment_id) return render_to_response('forestry/manage-experiment.html', --- a/vcweb/sanitation/views.py Fri May 20 23:26:48 2011 -0700 +++ b/vcweb/sanitation/views.py Wed May 25 14:53:46 2011 -0700 @@ -1,1 +1,12 @@ # Create your views here. +from vcweb.core.models import Experiment +from django.shortcuts import render_to_response, redirect +from django.template.context import RequestContext + +def configure(request, experiment_id=None): + experiment = Experiment.objects.get(pk=experiment_id) + return render_to_response('sanitation/configure.html', { + 'experiment': experiment, + }, + context_instance=RequestContext(request)) + --- a/vcweb/settings.py Fri May 20 23:26:48 2011 -0700 +++ b/vcweb/settings.py Wed May 25 14:53:46 2011 -0700 @@ -98,6 +98,7 @@ 'django.contrib.staticfiles', 'vcweb.core', 'vcweb.forestry', + 'vcweb.sanitation', 'dajaxice', 'djcelery', 'djkombu', --- a/vcweb/urls.py Fri May 20 23:26:48 2011 -0700 +++ b/vcweb/urls.py Wed May 25 14:53:46 2011 -0700 @@ -26,6 +26,7 @@ # 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'^sanitation/', include('vcweb.sanitation.urls', namespace='sanitation', app_name='sanitation')), url(r'^admin/', include(admin.site.urls)), # core catches everything else url(r'', include('vcweb.core.urls', namespace='core', app_name='core')), Repository URL: https://bitbucket.org/virtualcommons/vcweb/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |