Skip to content

Commit

Permalink
participant interest form added
Browse files Browse the repository at this point in the history
  • Loading branch information
manojmc committed Jul 24, 2012
1 parent 6943b0a commit e067ba2
Show file tree
Hide file tree
Showing 28 changed files with 1,794 additions and 55 deletions.
1,262 changes: 1,262 additions & 0 deletions mobile/css/bootstrap.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions mobile/css/bootstrap.min.css

Large diffs are not rendered by default.

Binary file added mobile/css/font/fontawesome-webfont.eot
Binary file not shown.
175 changes: 175 additions & 0 deletions mobile/css/font/fontawesome-webfont.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/css/font/fontawesome-webfont.svgz
Binary file not shown.
Binary file added mobile/css/font/fontawesome-webfont.ttf
Binary file not shown.
Binary file added mobile/css/font/fontawesome-webfont.woff
Binary file not shown.
Binary file added mobile/css/images/ajax-loader.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/css/images/icons-18-black.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/css/images/icons-18-white.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/css/images/icons-36-black.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/css/images/icons-36-white.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/css/jqm-icon-pack-1.1.1-fa.css
Binary file not shown.
2 changes: 2 additions & 0 deletions mobile/css/jquery.mobile.structure-1.1.0.min.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions mobile/js/jquery-1.7.1.min.js

Large diffs are not rendered by default.

177 changes: 177 additions & 0 deletions mobile/js/jquery.mobile-1.1.0.min.js

Large diffs are not rendered by default.

Binary file added static/img/phone.ico
Binary file not shown.
7 changes: 7 additions & 0 deletions static/js/confirmsubmit.js
@@ -0,0 +1,7 @@
function confirmsubmit(path) {
if (confirm("You sure you want to delete?")) {
document.location = path;
}

return false;
}
29 changes: 29 additions & 0 deletions static/js/participant_registration.js
@@ -0,0 +1,29 @@
function participant() {

if( document.getElementById('id_user_type').value == 'P' ) {
if(document.getElementById('id_groupname')!=null) {
var table = document.getElementById('reg_table');
table.deleteRow(-1);
}
}
else {
if(document.getElementById('id_groupname')==null) {
var table = document.getElementById('reg_table');

var rowCount = table.rows.length;
var row = table.insertRow(rowCount);

var cell1 = row.insertCell(0);
var element1 = document.createElement("label");
element1.innerHTML = 'Group Name'
cell1.appendChild(element1);

var cell2 = row.insertCell(1);
var element2 = document.createElement("input");
element2.type = "text";
element2.name = 'groupname'
element2.id = 'id_groupname'
cell2.appendChild(element2);
}
}
}
20 changes: 8 additions & 12 deletions templates/experiment/experiment_profile.html
Expand Up @@ -14,7 +14,7 @@ <h2>Experiment Profile: {{experiment.name}} {% if userprofile.user_type == 'L' %
<td><strong>Members ({{experiment.user.count}}): </strong></td>
<td>
{% for member in experiment.user.all %}
{{member}}{% if userprofile.user_type == 'L' %} <a href="javascript:confirmsubmit('/experiment/delete_member/{{experiment.id}}/{{member}}/')" id="member_delete"><img alt="Delete Member" title="Delete Member" src="{{STATIC_URL}}img/delete.ico"></a>{% endif %}<br>
{{member}}{% if userprofile.user_type == 'L' %} <a onclick="javascript:confirmsubmit('/experiment/delete_member/{{experiment.id}}/{{member}}/')" id="member_delete"><img alt="Delete Member" title="Delete Member" src="{{STATIC_URL}}img/delete.ico"></a>{% endif %}<br>
{% endfor %}
</td>
</tr>
Expand All @@ -31,14 +31,14 @@ <h2>Experiment Profile: {{experiment.name}} {% if userprofile.user_type == 'L' %
<td><strong>Applications ({{experiment.app.count}}):</strong></td>
<td>
{% for app in experiment.app.all %}
<a href="/application/{{app.id}}">{{app}}</a> {% if userprofile.user_type == 'L' %} <a href="javascript:confirmsubmit('/experiment/delete_app/{{experiment.id}}/{{app.id}}/')" id="app_delete"><img alt="Delete Application" title="Delete Application" src="{{STATIC_URL}}img/delete.ico"></a>{% endif %}<br>
<a href="/application/{{app.id}}">{{app}}</a> {% if userprofile.user_type == 'L' %} <a href="javascript:confirmsubmit('/experiment/delete_app/{{experiment.id}}/{{app.id}}')" id="app_delete"><img alt="Delete Application" title="Delete Application" src="{{STATIC_URL}}img/delete.ico"></a>{% endif %}<br>
{% endfor %}
</td>
</tr>
</tbody>
</table>
{% if userprofile.user_type == 'L' %}
<a class="btn btn-danger" href="javascript:confirmsubmit('/experiment/delete_exp/{{experiment.id}}/')"><img src="{{ STATIC_URL }}img/trash.ico"> Delete</a>
<a class="btn btn-danger" ><img onclick="javascript:confirmsubmit('/experiment/delete_exp/{{experiment.id}}/')" src="{{ STATIC_URL }}img/trash.ico"> Delete</a>
{% endif %}
</div><!-- well -->
<div class="modal fade" id="exp_edit">
Expand All @@ -54,16 +54,12 @@ <h3>Experiment Profile: <a href="/experiment/{{experiment.id}}/"> {{experiment.n
</div>
</div><!-- modal fade -->


{% endblock %}

{% block js %}
<!-- JavaScript -->
<script type="text/javascript">
function confirmsubmit(path) {
if (confirm("You sure you want to delete?")) {
document.location = path;
}
return false;

}
</script>
<script src="{{STATIC_URL}}js/confirmsubmit.js"></script>
<script type="text/javascript">
//initialize modal
$('#add_member').modal('{
Expand Down
30 changes: 30 additions & 0 deletions templates/index.html
Expand Up @@ -8,8 +8,10 @@ <h2>A Participatory and Large-scale Smartphone Testbed</h2>
<p>
<br><br>
{% if not user.is_authenticated %}

<a href="/register" class="btn btn-primary btn-large"><i class="icon-user icon-white"></i> Sign Up</a>
<a href="/login" class="btn btn-large"><i class="icon-ok"></i> Log In</a>
<a data-toggle="modal" href='#participant' class="btn btn-primary"><img src= "{{ STATIC_URL }}img/phone.ico"> Get A Phone</a><br>
{% else %}
<br>
{% endif %}
Expand Down Expand Up @@ -47,4 +49,32 @@ <h2>Power</h2>
</div>
</div>
</div>

<!-- Modal -->
<div class="modal fade" id="participant">
<form class="modal-form" method="post" action="/participant">
<div class="modal-header">
<a class="close" data-dismiss="modal">&times;</a>
<h1>Device Request</h1>
</div>
<div class="modal-body">
<table class="table">
<tbody>
<tr>
<td width='20%'><strong>Full Name: </strong></td>
<td><input type='text' name='name' id='name'/></td>
</tr>
<tr>
<td><strong>Email: </strong></td>
<td><input type='text' name='email' id='email'/></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<input type="submit" class='btn btn-primary' value="Submit" />
<a href="." class="btn">Cancel</a>
</div>
</form>
</div>
{% endblock %}
36 changes: 0 additions & 36 deletions templates/users/group_profile.html
Expand Up @@ -57,42 +57,6 @@ <h2>Group Profile: <a href="/accounts/group_profile/">{{group.name}}</a></h2>
</tr>
</tbody>
</table>
{% if userprofile.user_type == 'L' %}
<a data-toggle="modal" class="btn btn-primary" href="#request_devices">Request Devices</a>
{% endif %}
</div><!-- well -->
<div class="modal fade" id="request_devices">
<form class="form-horizontal" method="post" action="/accounts/group_profile/">
<div class="modal-header">
<a class="close" data-dismiss="modal">&times;</a>
<h1>Request Devices</h1>
</div><!-- modal-header -->
<div class="modal-body">
<label for="req_devices"> Number of Devices required: </label>
<input id="req_devices" type='text' name='req_devices' id='member' placeholder="Available devices: {{available_devices.count}}"/>

</div><!-- modal-body -->
<div class="modal-footer">
<input type="submit" class='btn btn-primary' value="Request" />
<a href="." class="btn">Cancel</a>
</div>
</form>
</div><!-- modal -->

<!-- JavaScript -->
<script type="text/javascript">
function confirmsubmit(path) {
if (confirm("You sure you want to delete the member?")) {
document.location = path;
}

return false;
}
</script>
<script type="text/javascript">
//initialize modal
$('#add_member').modal('{
keyboard: false
}')
</script>
{% endblock %}
22 changes: 21 additions & 1 deletion templates/users/group_tab.html
Expand Up @@ -25,4 +25,24 @@ <h2>Group Profile: <a href="/accounts/group_profile/">{{group.name}}</a></h2>
</tr>
</tbody>
</table>
</div><!-- well -->
{% if userprofile.user_type == 'L' %}
<a data-toggle="modal" class="btn btn-primary" href="#request_devices">Request Devices</a>
{% endif %}
</div><!-- well -->
<div class="modal fade" id="request_devices">
<form class="form-horizontal" method="post" action="/accounts/group_profile/">
<div class="modal-header">
<a class="close" data-dismiss="modal">&times;</a>
<h1>Request Devices</h1>
</div><!-- modal-header -->
<div class="modal-body">
<label for="req_devices"> Number of Devices required: </label>
<input id="req_devices" type='text' name='req_devices' id='member' placeholder="Available devices: {{available_devices.count}}"/>

</div><!-- modal-body -->
<div class="modal-footer">
<input type="submit" class='btn btn-primary' value="Request" />
<a href="." class="btn">Cancel</a>
</div>
</form>
</div><!-- modal -->
16 changes: 16 additions & 0 deletions templates/users/participant_reg.html
@@ -0,0 +1,16 @@
{% extends "base.html" %}
{% block title %}PhoneLab Testbed Web Site{% endblock %}
{% block content %}
<h1>Request For Sign UP</h1>
<form class="form-horizontal" method="post" action=".">
<table class = "table table-striped" id="reg_table">
<tbody>

{{ form.as_p }}

</tbody>
</table>
<input type="submit" class="btn btn-primary" value="Sign Up" />
<a onclick="history.back()" class="btn">Cancel</a>
</form>
{% endblock %}
5 changes: 4 additions & 1 deletion templates/users/register.html
Expand Up @@ -60,7 +60,7 @@ <h1>User Registration</h1>

{% else %}

<form method="post" action=".">
<form method="post" action="." onclick="participant()">
{% csrf_token %}
<table class = "table table-striped" id="reg_table">
<tbody>
Expand All @@ -75,3 +75,6 @@ <h1>User Registration</h1>
{% endif %}
</div>
{% endblock %}
{% block js %}
<script src="{{STATIC_URL}}js/participant_registration.js"></script>
{% endblock %}
4 changes: 4 additions & 0 deletions urls.py
Expand Up @@ -41,6 +41,10 @@
url(r'^logout/$', logout, {'next_page': '/'}, name='logout'),
#signup page
url(r'^register/$', 'users.views.register'),
#participant interest form
url(r'^participant/$', 'users.views.participant'),
#terms and conditions
url(r'^accounts/terms_and_conditions/$', 'users.views.terms_and_conditions'),
#profile page
url(r'^accounts/profile/$', 'users.views.profile'),
#delete member from group
Expand Down
14 changes: 12 additions & 2 deletions users/forms.py
Expand Up @@ -16,6 +16,7 @@ class RegistrationForm(forms.Form):
CHOICE = (
(u'L',u'Leader'),
(u'M', u'Member'),
(u'P', u'Participant'),
)

username =forms.CharField(label=u'Username', max_length=30)
Expand Down Expand Up @@ -80,8 +81,17 @@ def clean_groupname(self):
raise forms.ValidationError('"%s" is not a registered group.' % groupname )
return group




"""
Particiapnt email list
@date 07/23/2012
@author Manoj
"""

class ParticipantForm(forms.Form):
name =forms.CharField(label=u'Full Name', max_length=50)
email = forms.EmailField(label=u'Email')


37 changes: 34 additions & 3 deletions users/views.py
Expand Up @@ -16,14 +16,30 @@
from lib.helper import json_response_from, json
from users.models import UserProfile
from device.models import Device, DeviceProfile
from users.forms import RegistrationForm
from users.forms import RegistrationForm, ParticipantForm
from application.models import Application
from experiment.models import Experiment


admin_mail = 'tempphonelab@gmail.com'

#TO = [ email for name, email in ADMINS ]

"""
Participant Email List
@date 07/23/2012
@author Manoj
"""

def participant(request):

if request.method == 'POST':
form = ParticipantForm(request.POST)
if form.is_valid:


"""
Register New User with activation
Expand Down Expand Up @@ -233,6 +249,18 @@ def confirm(request, activation_key):
context_instance=RequestContext(request)
)


"""
Terms and Conditions
@date 07/23/2012
@author Manoj
"""
def terms_and_conditions(request):

return render_to_response('users/terms_and_conditions.html')

"""
User Profile
Expand Down Expand Up @@ -273,6 +301,9 @@ def profile(request):
leader = get_object_or_404(UserProfile, user_type='L', group=group)
no_of_members = UserProfile.objects.filter(user_type='M', group=group).count()
apps = Application.objects.filter(group=group)

#get the availble no of devices
available_devices = DeviceProfile.objects.filter(status='W').exclude(dev__in=devices)
#get experiment information
experiments = Experiment.objects.filter(group=group).order_by('id')

Expand All @@ -284,6 +315,7 @@ def profile(request):
'no_of_members': no_of_members,
'no_of_devices': no_of_devices,
'devices' : devices,
'available_devices': available_devices,
'apps': apps,
'experiments': experiments },
context_instance=RequestContext(request)
Expand Down Expand Up @@ -368,7 +400,7 @@ def group_profile(request):
devices = DeviceProfile.objects.filter(group=group)
no_of_devices = devices.count()

available_devices = DeviceProfile.objects.filter(status='W')

#get the leader
leader = get_object_or_404(UserProfile, user_type='L', group=group)

Expand Down Expand Up @@ -401,7 +433,6 @@ def group_profile(request):
'apps': apps,
'leader': leader,
'members': members,
'available_devices': available_devices,
'no_of_devices': no_of_devices,
'devices' : devices },
context_instance=RequestContext(request)
Expand Down

0 comments on commit e067ba2

Please sign in to comment.