Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Merge branch 'testing' of https://bitbucket.org/dtraviglia/stout into…
… dashboard
  • Loading branch information
Kyle Finley committed Sep 25, 2015
2 parents 2373ff6 + 75f52c1 commit 31f7758f60e6f872195edeccf36184bf5f99da7c
Show file tree
Hide file tree
Showing 29 changed files with 305 additions and 9,655 deletions.
@@ -14,4 +14,5 @@ op_tasks/migrations/*
exp_portal/migrations/*
developer/migrations/*
uploads/migrations/*
secret.py
secret.py

@@ -0,0 +1,27 @@
from django.shortcuts import render
from op_tasks.models import UserProfile
from django.core import mail
from django.conf import settings


def send_email(request):
if request.method == 'POST':
email_to = request.POST.get('email_to', 'xdataonlineerrors@gmail.com')
subject = request.POST.get('email_subject', 'error')
message = request.POST.get('email_message', 'error')
print email_to, subject, message
status = mail.send_mail(subject, message, settings.EMAIL_HOST_USER, [email_to], fail_silently=False)
else:
status = 2
userprofiles = UserProfile.objects.all()
if status == 0:
statusMessage = "The email did not send. Try again."
elif status == 1:
statusMessage = "Email sent!"
elif status == 2:
statusMessage = ""
return render(request, 'email_form.html', {'userprofiles': userprofiles, 'status': status, 'statusMessage': statusMessage})


def printme(string):
print string
@@ -1,7 +1,5 @@
from django.shortcuts import render, redirect
from op_tasks.models import UserProfile, Product, Dataset, OpTask, TaskListItem, Experiment
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from op_tasks.models import Product, Dataset

def view_products(request):
products = Product.objects.all()
@@ -0,0 +1,43 @@
{% extends "experimentpage.html" %}

{% block content %}
<form method="POST" name="emailBlast" action="{%url 'exp_portal:send_email' %}">
<div>
<div class="emailRow">
<label for="email-to" class="emailLabel">To:</label>
<input class="emailInput" name="email_to" id="email-to"/>
<div class="input-group-btn">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-user"></span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" id="contacts">
<li value="all">All Participants</li>
<div role="separator" class="divider"></div>
{% for userprofile in userprofiles %}
<li>{{userprofile.user.email}}</li>
{% endfor %}
</ul>
</div>
</div>
<div class="emailRow">
<label for="email-subject" class="emailLabel">Subject:</label>
<input class="emailInput" name="email_subject" id="email-subject"/>
</div>
<div class="emailRow">
<label for="email-message" class="emailLabel">Message:</label>
<div>
<textarea name="email_message" id="email-message"></textarea>
</div>
</div>
</div>
<div id="emailSubmit">
<input class="btn btn-default" type="submit" value="Send Mail">
</div>
{% csrf_token %}
</form>
<div id="statusMessage" class="{{ status }}">
{{ statusMessage }}
</div>

{% endblock %}
@@ -17,6 +17,7 @@
<a href="{% url 'exp_portal:manage_tasks' %}">Manage Tasks</a><br>
<a href="{% url 'exp_portal:manage_products' %}">Manage Products</a><br>
<a href="{% url 'exp_portal:manage_users' %}">Manage Users</a><br>
<a href="{% url 'exp_portal:send_email' %}">Send Email</a>
</div>
</div>

@@ -40,4 +40,5 @@
url(r'^users/tasks/update/(?P<userpk>.*)/(?P<datasetpk>.*)/(?P<productpk>.*)/(?P<taskpk>.*)', views.update_user_tasks, name='update_user_tasks'),
url(r'^users/tasks/viewall/(?P<profile>.*)$', views.view_user_tasks, name='view_user_tasks'),
url(r'^experiment/products/$', views.view_experiment_products, name='view_experiment_products'),
url(r'^email/$', views.send_email, name='send_email'),
)
@@ -1,11 +1,11 @@
from django.shortcuts import render, redirect
from op_tasks.models import UserProfile, Product, Dataset, OpTask, TaskListItem, Experiment
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.http import JsonResponse
from users import *
from products import *
from tasks import *
from email import *
import csv
import pandas

@@ -48,14 +48,17 @@ def view_status(request):
masterList[name] = experimentList
return render(request, 'status.html', {'experimentList': masterList})


def manage_exps(request):
experimentlist = Experiment.objects.all()
return render(request, 'experiments.html', {'experimentlist': experimentlist})


def view_exp_details(request, exppk):
experiment = Experiment.objects.get(id=exppk)
return render(request, 'experiment_details.html', {'experiment':experiment})


def add_exp(request):
if request.method == 'POST':
experiment = Experiment()
@@ -75,6 +78,7 @@ def add_exp(request):

return render(request, 'add_experiment.html')


def edit_exp(request, exppk):
experiment = Experiment.objects.get(id=exppk)
experiment.name = request.POST['exp_name']
@@ -92,14 +96,17 @@ def edit_exp(request, exppk):

return redirect('exp_portal:manage_exps')


def manage_datasets(request):
datasets = Dataset.objects.all()
return render(request, 'datasets.html', {'datasets':datasets})


def view_dataset_details(request, datasetpk):
dataset = Dataset.objects.get(id=datasetpk)
return render(request, 'dataset_details.html', {'dataset':dataset})


def add_dataset(request):
if request.method == 'POST':
# do update
@@ -113,6 +120,7 @@ def add_dataset(request):
# else fall here
return render(request, 'add_dataset.html')


def edit_dataset(request, datasetpk):
dataset = Dataset.objects.get(id=datasetpk)
dataset.name = request.POST['dataset_name']
@@ -123,6 +131,7 @@ def edit_dataset(request, datasetpk):

return redirect('exp_portal:manage_datasets')


def view_experiment_products(request):
experiments = Experiment.objects.all()
masterList = {}
@@ -157,4 +166,4 @@ def view_experiment_products(request):
experimentList["percentageComplete"] = percentageComplete
masterList[name] = experimentList
response = JsonResponse({'experimentInfo': str(masterList)})
return response
return response
@@ -1,9 +1,5 @@
{% extends "main.html" %}

{% block head %}
<!-- <link rel="stylesheet" type="text/css" href="/static/css/styles.css"> -->
{% endblock %}

{% block container %}
<section>
<h1 align="center"><b>Login to XDATA Online</b></h1>
@@ -14,5 +10,8 @@ <h4 class="form-signin-heading">Please sign in</h4>
<input class="form-control" type="password" name="password" value="" placeholder="Password" required/>
<button class="btn btn-lg btn-primary btn-block" type="submit" value="submit">Sign in</button>
</form>
<h4 align="center">
<a href="{% url 'op_tasks:reset' %}">Forgot password?</a>
</h4>
</section>
{% endblock %}
@@ -0,0 +1,16 @@
{% extends "main.html" %}
{% block title %}Reset Password{% endblock %}
{% block container %}
<div align="center">
{% if validlink %}
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Submit</button>
</form>
{% else %}
<p>This reset link is no longer valid!</p>
{% endif %}
</div>

{% endblock%}
@@ -0,0 +1,11 @@
{% extends "main.html" %}

{% block title %}Password Reset In Progress{% endblock %}

{% block container %}

<h1>Password reset in progress</h1>

<p>We've emailed you instructions for setting your password to the email address you submitted. You should be receiving it shortly.</p>

{% endblock %}
@@ -0,0 +1,14 @@
{% autoescape off %}
You're receiving this email because you requested a password reset for your user account at {{ site_name }}.

Please go to the following page and choose a new password:
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'op_tasks:reset_confirm' uidb64=uid token=token %}
{% endblock %}
Your username, in case you've forgotten: {{ user.get_username }}

Thanks for using our site!

The {{ site_name }} team

{% endautoescape %}
@@ -0,0 +1,16 @@
{% extends "main.html" %}
{% block title %}Reset Password{% endblock %}
{% block container %}

<form method="post">
<h2 align="center">Password Reset</h2>
<h4 align="center">Please enter your email to continue:</h4>
{% csrf_token %}
<div align="center">
{{ form.as_p }}
<button type="submit">Submit</button>
</div>
</form>

{% endblock %}

@@ -12,7 +12,6 @@
url(r'^task_test/(?P<task_pk>[0-9]+)$', views.task_test, name='task_test'),
url(r'^task_launch/(?P<task_pk>[0-9]+)$', views.task_launch, name='task_launch'),
url(r'^register$', views.register, name='register'),
# url(r'^login/(?P<title>\w+)$', views.login_participant, name='login'),
url(r'^login/$', views.login_participant, name='login'),
url(r'^logout/$', views.logout_participant, name='logout'),
url(r'^intro/$', views.intro, name='intro'),
@@ -22,7 +21,10 @@
url(r'^experiment_instructions$', views.exp_instruct, name='exp_instruct'),
url(r'^portal_instructions$', views.portal_instruct, name='portal_instruct'),
url(r'^product_instructions$', views.product_instruct, name='product_instruct'),
url(r'^user_profile$', views.view_profile, name='view_profile'),
url(r'^user_profile$', views.view_profile, name='view_profile'),
url(r'^reset/confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', views.reset_confirm, name='reset_confirm'),
url(r'^reset/$', views.reset, name='reset'),
url(r'^reset/sent/$', views.reset_sent, name='reset_sent')
)

# print settings.DEBUG, settings.STATIC_ROOT

0 comments on commit 31f7758

Please sign in to comment.