Skip to content
Snippets Groups Projects
Commit f196cf0a authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

Progress III

parent 8f4281b2
No related branches found
No related tags found
No related merge requests found
...@@ -65,7 +65,8 @@ from django.core.validators import email_re ...@@ -65,7 +65,8 @@ from django.core.validators import email_re
from astakos.im.settings import ( from astakos.im.settings import (
DEFAULT_USER_LEVEL, INVITATIONS_PER_LEVEL, DEFAULT_USER_LEVEL, INVITATIONS_PER_LEVEL,
AUTH_TOKEN_DURATION, BILLING_FIELDS, AUTH_TOKEN_DURATION, BILLING_FIELDS,
EMAILCHANGE_ACTIVATION_DAYS, LOGGING_LEVEL EMAILCHANGE_ACTIVATION_DAYS, LOGGING_LEVEL,
GROUP_CREATION_SUBJECT
) )
from astakos.im.endpoints.qh import ( from astakos.im.endpoints.qh import (
register_users, send_quota, register_resources register_users, send_quota, register_resources
...@@ -1178,7 +1179,7 @@ class Project(models.Model): ...@@ -1178,7 +1179,7 @@ class Project(models.Model):
@property @property
def approved_members(self): def approved_members(self):
return self.members.filter(is_accepted=True) return [m.person for m in self.members.filter(is_accepted=True)]
def suspend(self): def suspend(self):
self.last_approval_date = None self.last_approval_date = None
...@@ -1269,9 +1270,9 @@ def submit_application(definition, applicant, comments, precursor_application=No ...@@ -1269,9 +1270,9 @@ def submit_application(definition, applicant, comments, precursor_application=No
application.save() application.save()
notification = build_notification( notification = build_notification(
settings.SERVER_EMAIL, settings.SERVER_EMAIL,
[settings.ADMINS], [i[1] for i in settings.ADMINS],
_(GROUP_CREATION_SUBJECT) % {'group':app.definition.name}, _(GROUP_CREATION_SUBJECT) % {'group':application.definition.name},
_('An new project application identified by %(serial)s has been submitted.') % app.serial _('An new project application identified by %(serial)s has been submitted.') % application.__dict__
) )
notification.send() notification.send()
return application return application
......
...@@ -36,12 +36,13 @@ import socket ...@@ -36,12 +36,13 @@ import socket
from django.conf import settings from django.conf import settings
from django.core.mail import send_mail from django.core.mail import send_mail
from django.utils.translation import ugettext as _
import astakos.im.messages as astakos_messages import astakos.im.messages as astakos_messages
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
def build_notification(): def build_notification(sender, recipients, subject, message):
return EmailNotification(sender, recipients, subject, message) return EmailNotification(sender, recipients, subject, message)
class Notification(object): class Notification(object):
...@@ -58,12 +59,13 @@ class EmailNotification(Notification): ...@@ -58,12 +59,13 @@ class EmailNotification(Notification):
def send(self): def send(self):
try: try:
send_mail( send_mail(
subject, self.subject,
message, self.message,
sender, self.sender,
recipients self.recipients
) )
except: except BaseException, e:
logger.exception(e)
raise SendNotificationError() raise SendNotificationError()
class SendMailError(Exception): class SendMailError(Exception):
......
...@@ -3,22 +3,23 @@ ...@@ -3,22 +3,23 @@
{% load filters %} {% load filters %}
{% block page.body %} {% block page.body %}
{% with object.owners as owners %} {% with object.project.members as members %}
{% with object.project.approved_members as approved_members %}
<div class="projects"> <div class="projects">
<h2> <h2>
{% if object.is_member %} {% if user in members %}
<em> <em>
{% if object.is_owner %} {% if user == object.owner %}
{% if object.is_enabled %} {% if object.is_active %}
[ ADMINISTRATOR - ACTIVE ] [ ADMINISTRATOR - ACTIVE ]
{% else %} {% else %}
[ ADMINISTRATOR - PENDING ] [ ADMINISTRATOR - PENDING ]
{% endif %} {% endif %}
{% else %} {% else %}
{% if object.is_active_member %} {% if user in approve_members %}
[ ENROLLED - ACTIVE ] [ ENROLLED - ACTIVE ]
{% else %} {% else %}
[ ENROLLED - PENDING ] [ ENROLLED - PENDING ]
...@@ -26,36 +27,36 @@ ...@@ -26,36 +27,36 @@
{% endif %} {% endif %}
</em> </em>
{% endif %} {% endif %}
<span>{{ object.name|upper }}</span> <span>{{ object.definition.name|upper }}</span>
</h2> </h2>
<div class="details"> <div class="details">
<h3> <h3>
GENERAL INFO GENERAL INFO
{% if object.is_owner %} {% if user == object.owner %}
<a href="#" class="edit">EDIT</a> <a href="#" class="edit">EDIT</a>
{% endif %} {% endif %}
</h3> </h3>
<div class="data"> <div class="data">
<p class="restricted">{{ object.desc|safe }}</p> <p class="restricted">{{ object.definition.description|safe }}</p>
<dl class="alt-style"> <dl class="alt-style">
<dt>Homepage url</dt> <dt>Homepage url</dt>
<dd> <dd>
{% if object.homepage%} {% if object.definition.homepage%}
<a href="{{ object.homepage }}">{{ object.homepage }}</a> <a href="{{ object.definition.homepage }}">{{ object.definition.homepage }}</a>
{% else %} {% else %}
Not set yet Not set yet
{% endif %} {% endif %}
</dd> </dd>
<dt>Moderation</dt> <dt>Moderation</dt>
<dd> <dd>
{{ object.moderation_enabled|yesno:"Yes, No" }} {{ object.definition.member_accept_policy.description }}
</dd> </dd>
</dl> </dl>
</div> </div>
<div class="editable" style="display:none;"> <div class="editable" style="display:none;">
<form action="{% url astakos.im.views.group_detail object.id %}" method="post" <form action="{% url project_detail object.serial %}" method="post"
class="withlabels">{% csrf_token %} class="withlabels">{% csrf_token %}
{% with update_form as form %} {% with update_form as form %}
{% include "im/form_render.html" %} {% include "im/form_render.html" %}
...@@ -70,49 +71,48 @@ ...@@ -70,49 +71,48 @@
<h3>DETAILS</h3> <h3>DETAILS</h3>
<dl class="alt-style"> <dl class="alt-style">
<dt>Name</dt> <dt>Name</dt>
<dd>{{ object.name }}&nbsp;</dd> <dd>{{ object.definition.name }}&nbsp;</dd>
<!--<dt>Type</dt>
<dd>{{object.kindname|capfirst}}&nbsp;</dd>-->
<dt>Issue date:</dt> <dt>Issue date:</dt>
<dd>{{object.issue_date|date:"d/m/Y"}}&nbsp;</dd> <dd>{{object.issue_date|date:"d/m/Y"}}&nbsp;</dd>
<dt>Expiration Date</dt> <dt>Start date:</dt>
<dd>{{object.expiration_date|date:"d/m/Y"}}&nbsp;</dd> <dd>{{object.definition.start_date|date:"d/m/Y"}}&nbsp;</dd>
<dt>End Date</dt>
<dd>{{object.definition.end_date|date:"d/m/Y"}}&nbsp;</dd>
<!-- <!--
<dt>Moderation</dt> <dt>Moderation</dt>
<dd>{% if object.moderation_enabled%}Yes{% else %}No{% endif %}</dd> <dd>{% if object.moderation_enabled%}Yes{% else %}No{% endif %}</dd>
--> -->
<dt>Activated</dt> <dt>Activated</dt>
<dd>{% if object.is_enabled %}Yes{% else %}No{% endif %}</dd> <dd>{% if object.is_active %}Yes{% else %}No{% endif %}</dd>
<dt>Owner</dt> <dt>Owner</dt>
{{ o.owners }} {{ o.owner }}
<dd>{% for o in owners %} <dd>{% if user == o.owner %}
{% if object.is_owner %}
Me Me
{% else%} {% else%}
{{o.realname}} ({{o.email}}) {{o.owner.realname}} ({{o.owner.email}})
{% endif %} {% endif %}
{% endfor %}&nbsp; &nbsp;
</dd> </dd>
<dt>Max participants</dt> <dt>Max participants</dt>
<dd>{% if object.max_participants%}{{object.max_participants}}{% else %}&nbsp;{% endif %}</dd> <dd>{% if object.definition.limit_on_members_number%}{{object.definition.limit_on_members_number}}{% else %}&nbsp;{% endif %}</dd>
</dl> </dl>
</div> </div>
<div class="full-dotted"> <div class="full-dotted">
<h3>RESOURCES</h3> <h3>RESOURCES</h3>
{% if quota %} {% if object.definition.projectresourcegrant_set.all %}
<dl class="alt-style"> <dl class="alt-style">
{% for q in quota %} {% for q in object.definition.projectresourcegrant_set.all %}
q.resource
<dt> <dt>
Max {% if q.is_abbreviation %}{{ q.verbose_name|upper }}{% else %}{{ q.verbose_name }}{% endif %}{% if not q.unit %}s {% endif %} per user Max {% if q.is_abbreviation %}{{ q.verbose_name|upper }}{% else %}{{ q.verbose_name }}{% endif %}{% if not q.unit %}s {% endif %} per user
</dt> </dt>
<dd> <dd>
{% if q.value %} {% if q.member_limit %}
{% if q.unit %} {% if q.unit %}
{{ q.value|sizeof_fmt }} {{ q.member_limit|sizeof_fmt }}
{% else %} {% else %}
{{ q.value|isinf }} {{ q.member_limit|isinf }}
{% endif %} {% endif %}
{% else %} {% else %}
Unlimited Unlimited
...@@ -128,10 +128,10 @@ ...@@ -128,10 +128,10 @@
<p>No resources</p> <p>No resources</p>
{% endif %} {% endif %}
</div> </div>
{% if object.is_owner %} {% if user == object.owner %}
<div class="full-dotted"> <div class="full-dotted">
{% with page|concat:sorting as args %} {% with page|concat:sorting as args %}
{% with object.membership_set.select_related.all|paginate:args as membership %} {% with object.project.projectmembership_set.select_related.all|paginate:args as membership %}
{% if membership %} {% if membership %}
<form method="GET" class="minimal" action="#members-table"> <form method="GET" class="minimal" action="#members-table">
<div class="form-row"> <div class="form-row">
...@@ -156,20 +156,20 @@ ...@@ -156,20 +156,20 @@
<tr> <tr>
<td>{{m.person.email}}</td> <td>{{m.person.email}}</td>
<td>{{m.person.realname}}</td> <td>{{m.person.realname}}</td>
{% if m.person in owners %} {% if m.person == o.owner %}
<td>Owner</td> <td>Owner</td>
{% else %} {% else %}
{% if m.is_approved %} {% if m.is_accepted %}
<td>Approved <td>Approved
{% if object.is_owner %} {% if user == object.owner %}
<a href="{% url disapprove_member object.id m.person.id %}?{% if page %}page={{ page }}{% endif %}{% if sorting %}&sorting={{sorting}}{% endif %}">Remove</a> <a href="{% url project_disapprove_member object.serial m.person.id %}?{% if page %}page={{ page }}{% endif %}{% if sorting %}&sorting={{sorting}}{% endif %}">Remove</a>
{% endif %} {% endif %}
</td> </td>
{% else %} {% else %}
<td>Pending <td>Pending
{% if object.is_owner %} {% if user == object.owner %}
<a href="{% url approve_member object.id m.person.id %}?{% if page %}page={{ page }}{% endif %}{% if sorting %}&sorting={{sorting}}{% endif %}">Accept</a> <a href="{% url project_approve_member object.serial m.person.id %}?{% if page %}page={{ page }}{% endif %}{% if sorting %}&sorting={{sorting}}{% endif %}">Accept</a>
<a href="{% url disapprove_member object.id m.person.id %}?{% if page %}page={{ page }}{% endif %}{% if sorting %}&sorting={{sorting}}{% endif %}">Remove</a> <a href="{% url project_disapprove_member object.serial m.person.id %}?{% if page %}page={{ page }}{% endif %}{% if sorting %}&sorting={{sorting}}{% endif %}">Remove</a>
{% endif %} {% endif %}
</td> </td>
{% endif %} {% endif %}
...@@ -203,7 +203,7 @@ ...@@ -203,7 +203,7 @@
<div class="full-dotted"> <div class="full-dotted">
<form action="{% url astakos.im.views.group_detail object.id %}#members-table" method="post" class="withlabels" >{% csrf_token %} <form action="{% url project_detail object.serial %}#members-table" method="post" class="withlabels" >{% csrf_token %}
<h2>Enroll more members</h2> <h2>Enroll more members</h2>
{% with addmembers_form as form %} {% with addmembers_form as form %}
{% include "im/form_render.html" %} {% include "im/form_render.html" %}
...@@ -227,5 +227,6 @@ ...@@ -227,5 +227,6 @@
</div> </div>
{% endwith %}
{% endwith %} {% endwith %}
{% endblock %} {% endblock %}
{% extends "im/account_base.html" %}
{% load filters %}
{% block page.body %}
{% with form.data as data %}
<div class="projects summary">
<form action="{% url group_add_complete %}" method="post" class="quotas-form">{% csrf_token %}
<legend>CONFIRMATION REQUEST</legend>
<P>These are the specifications of the Project you want to create. If you hit the "Submit" button this form will be officially sent to GRNET for review. Please make sure the following reflect exactly your request. After submitting, there is no way to modify your Project request. </P>
<!--
{% for k,v in data.iteritems %}
<input type="hidden" name="{{ k }}" value="{{ v }}">
{% endfor %}
-->
{% include "im/form_render.html" %}
<div class="full-dotted">
<h3>GENERAL INFO</h3>
<p class="restricted">{{ data.desc|safe }}</p>
<dl class="alt-style">
<dt>Homepage Url</dt>
<dd>{{ data.homepage }}&nbsp;</dd>
<dt>Modaration</dt>
<dd>{{ data.moderation_enabled|yesno:"Yes, No" }}</dd>
</dl>
</div>
<div class="full-dotted">
<h3>DETAILS</h3>
<dl class="alt-style">
<dt>Name</dt>
<dd>{{ data.name }}&nbsp;</dd>
<!--<dt>Type</dt>
<dd>Course&nbsp;</dd>-->
<dt>Issue date:</dt>
<dd>{{ data.issue_date|date:"d/m/Y"}}&nbsp;</dd>
<dt>Expiration Date</dt>
<dd>{{ data.expiration_date|date:"d/m/Y"}}&nbsp;</dd>
<dt>Max members per group</dt>
<dd>{% if data.max_participants %}{{ data.max_participants }}{% else %}Unlimited{% endif %}</dd>
</dl>
</div>
<div class="full-dotted">
<h3>RESOURCES</h3>
<p>The following ~okeanos resources will be granted to each member of this Project:</p>
<dl class="alt-style">
{% for p in policies %}
<dt>
Max {% if p.is_abbreviation %}{{ p.name|upper }}{% else %}{{ p.name }}{% endif %}{% if not p.unit %}s {% endif %} per user
</dt>
<dd>
{% if p.uplimit %}
{% if p.unit %}
{{ p.uplimit|sizeof_fmt }}
{% else %}
{{ p.uplimit }}
{% endif %}
{% else %}
Unlimited
{% endif %}
</dd>
{% empty %}
No resources
{% endfor %}
</dl>
</div>
<div class="full-dotted">
</div>
<div class="form-row submit">
<input type="submit" value="SUBMIT" class="submit altcol" autocomplete="off">
</div>
</form>
</div>
{% endwith %}
{% endblock %}
...@@ -8,20 +8,13 @@ ...@@ -8,20 +8,13 @@
<h2>PROJECTS</h2> <h2>PROJECTS</h2>
{% if form %} {% if form %}
<p>Search for existing Projects and join the ones you like. Please search by Project name. </p> <p>Search for existing Projects and join the ones you like. Please search by Project name. </p>
<form action="{% url group_search %}" method="post" class="withlabels signup submit-inline">{% csrf_token %} <form action="{% url project_search %}" method="post" class="withlabels signup submit-inline">{% csrf_token %}
{% include "im/form_render.html" %} {% include "im/form_render.html" %}
<div class="form-row submit"> <div class="form-row submit">
<input type="submit" class="submit altcol" value="SEARCH" /> <input type="submit" class="submit altcol" value="SEARCH" />
{% if q %}<a href="{% url group_all %}">clear</a>{% endif %} {% if q %}<a href="{% url project_all %}">clear</a>{% endif %}
</div> </div>
</form> </form>
<!--<form action="{% url group_all %}" method="post" class="link-like alone">{% csrf_token %}
<div class="form-row submit">
<input type="submit" class="submit altcol" value="clear" />
</div>
</form>
<-->
{% else %} {% else %}
<div class="two-cols clearfix"> <div class="two-cols clearfix">
<div class="rt"> <div class="rt">
...@@ -41,20 +34,19 @@ ...@@ -41,20 +34,19 @@
<div> <div>
<div class="wrap"> <div class="wrap">
<p class="centered"><a href="{% url group_add 'project' %}"><img alt="THINK ABOUT IT" src="/static/im/images/create.png"></a></p> <p class="centered"><a href="{% url project_add %}"><img alt="THINK ABOUT IT" src="/static/im/images/create.png"></a></p>
<p class="txt">Create a new Project in seconds. Specify how many members it will have, which and how many virtual resources it will provide to its members. Describe its purpose. Submit your request and if accepted, you and your colleagues are ready to deploy!<br><br> </p> <p class="txt">Create a new Project in seconds. Specify how many members it will have, which and how many virtual resources it will provide to its members. Describe its purpose. Submit your request and if accepted, you and your colleagues are ready to deploy!<br><br> </p>
<p><a href="{% url group_add 'project' %}">create a project ></a></p> <p><a href="{% url project_add %}">create a project ></a></p>
<!--<p class="btn"><a href="{% url group_create_list %}" class="submit">CREATE</a></p>-->
</div> </div>
</div> </div>
</li> </li>
<li class="join"> <li class="join">
<div> <div>
<div class="wrap"> <div class="wrap">
<p class="centered"><a href="{% url group_all %}"><img alt="THINK ABOUT IT" src="/static/im/images/join.png"></a></p> <p class="centered"><a href="{% url project_all %}"><img alt="THINK ABOUT IT" src="/static/im/images/join.png"></a></p>
<p class="txt">Become a member of an existing Project and instantly gain access to the resources it has to offer you. Search for open Projects and join for free. Contact the closed Projects administrators, if you think they will accept you. In two words: try to Join now. </p> <p class="txt">Become a member of an existing Project and instantly gain access to the resources it has to offer you. Search for open Projects and join for free. Contact the closed Projects administrators, if you think they will accept you. In two words: try to Join now. </p>
<p><a href="{% url group_all %}">join a project ></a></p> <p><a href="{% url project_all %}">join a project ></a></p>
</div> </div>
</div> </div>
</li> </li>
...@@ -69,11 +61,12 @@ ...@@ -69,11 +61,12 @@
<form method="GET" class="minimal" action="#searchResults"> <form method="GET" class="minimal" action="#searchResults">
<div class="form-row"> <div class="form-row">
<select name="sorting" onchange="this.form.submit();" class="dropkicked" tabindex="1"> <select name="sorting" onchange="this.form.submit();" class="dropkicked" tabindex="1">
<option value="groupname">Sort by Name</option> <option value="definition__name">Sort by Name</option>
<option value="issue_date" {% if sorting == 'issue_date' %}selected{% endif %}>Sort by Issue date</option> <option value="issue_date" {% if sorting == 'issue_date' %}selected{% endif %}>Sort by Issue date</option>
<option value="expiration_date" {% if sorting == 'expiration_date' %}selected{% endif %}>Sort by Expiration Date</option> <option value="definition__start_date" {% if sorting == 'definition__start_date' %}selected{% endif %}>Sort by Start Date</option>
<option value="approved_members_num" {% if sorting == 'approved_members_num' %}selected{% endif %}>Sort by Participants</option> <option value="definition__end_date" {% if sorting == 'definition__end_date' %}selected{% endif %}>Sort by End Date</option>
<option value="moderation_enabled" {% if sorting == 'moderation_enabled' %}selected{% endif %}>Sort by Moderation</option> <!-- <option value="approved_members_num" {% if sorting == 'approved_members_num' %}selected{% endif %}>Sort by Participants</option> -->
<option value="definition__member_accept_policy" {% if sorting == 'definition__member_accept_policy' %}selected{% endif %}>Sort by Moderation</option>
</select> </select>
<input type="hidden" name="q" value="{{q}}"/> <input type="hidden" name="q" value="{{q}}"/>
</div> </div>
...@@ -87,6 +80,7 @@ ...@@ -87,6 +80,7 @@
<th>Name</th> <th>Name</th>
<!--<th>Type</th>--> <!--<th>Type</th>-->
<th>Issued</th> <th>Issued</th>
<th>Starts</th>
<th>Expires</th> <th>Expires</th>
<th>Enrolled</th> <th>Enrolled</th>
...@@ -100,22 +94,25 @@ ...@@ -100,22 +94,25 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for o in object_list %} {% for o in object_list %}
{% with o.project.members as members %}
{% with o.project.approved_members as approved_members%}
<tr class="{% cycle 'tr1' 'tr2' %}"> <tr class="{% cycle 'tr1' 'tr2' %}">
<td style="width:22%"><a href="{% url group_detail o.id %}" title="visit group page">{{o.groupname|truncatename}}</a></td> <td style="width:22%"><a href="{% url project_detail o.serial %}" title="visit group page">{{o.definition.name|truncatename}}</a></td>
<!--td>{{o.kindname|capfirst}}</td--> <!--td>{{o.kindname|capfirst}}</td-->
<td style="width:13%">{{o.issue_date|date:"d/m/Y"}}</td> <td style="width:13%">{{o.issue_date|date:"d/m/Y"}}</td>
<td style="width:13%">{{o.expiration_date|date:"d/m/Y"}}</td> <td style="width:13%">{{o.definition.start_date|date:"d/m/Y"}}</td>
<td style="width:11%">{{o.approved_members_num}}</td> <td style="width:13%">{{o.definition.end_date|date:"d/m/Y"}}</td>
<td style="width:11%">{{approved_members|length}}</td>
<td style="width:17%"> <td style="width:17%">
<div class="msg-wrap"> <div class="msg-wrap">
{% if o.is_member %} {% if user in members %}
{% if o.membership_approval_date %} {% if user in approved_members %}
{% if not o.is_owner %} {% if not user == o.owner %}
Registered Registered
{% else %} {% else %}
...@@ -137,19 +134,19 @@ ...@@ -137,19 +134,19 @@
<td style="width:15%"> <td style="width:15%">
<div class="msg-wrap"> <div class="msg-wrap">
{% if o.is_member %} {% if user in members %}
{% if o.membership_approval_date %} {% if user in approved_members %}
{% if not o.is_owner %} {% if not user == o.owner %}
<form action="{% url group_leave o.id %}" method="post" class="link-like">{% csrf_token %} <form action="{% url project_leave o.serial %}" method="post" class="link-like">{% csrf_token %}
<input type="submit" value="x leave group" class="leave"/> <input type="submit" value="x leave group" class="leave"/>
</form> </form>
<div class="dialog"> <div class="dialog">
Are you sure you what to leave this group?<br> Are you sure you what to leave this group?<br>
Name: <a href="{% url group_detail o.id %}" title="visit group page">{{o.groupname}}</a><br> Name: <a href="{% url project_detail o.serial %}" title="visit group page">{{o.groupname}}</a><br>
{% if o.desc %}Description:{{o.desc|truncatewords:30}}{% endif %}<br><br> {% if o.definition.description %}Description:{{o.definition.description|truncatewords:30}}{% endif %}<br><br>
<a href="#" class="yes submit">Yes</a>&nbsp;&nbsp;&nbsp;<a href="#" class="no submit">No</a> <a href="#" class="yes submit">Yes</a>&nbsp;&nbsp;&nbsp;<a href="#" class="no submit">No</a>
</div> </div>
...@@ -164,13 +161,13 @@ ...@@ -164,13 +161,13 @@
{% endif %} {% endif %}
{% else %} {% else %}
<form action="{% url group_join o.id %}" method="post" class="link-like">{% csrf_token %} <form action="{% url project_join o.serial %}" method="post" class="link-like">{% csrf_token %}
<input type="submit" value="+ join group" class="join_group join" /> <input type="submit" value="+ join group" class="join_group join" />
</form> </form>
<div class="dialog"> <div class="dialog">
Are you sure you what to join this group?<br> Are you sure you what to join this group?<br>
Name: <a href="{% url group_detail o.id %}" title="visit group page">{{o.groupname}}</a><br> Name: <a href="{% url project_detail o.serial %}" title="visit group page">{{o.groupname}}</a><br>
{% if o.desc %}Description:{{o.desc|truncatewords:30}}{% endif %}<br><br> {% if o.definition.description %}Description:{{o.definition.description|truncatewords:30}}{% endif %}<br><br>
<a href="#" class="yes submit">Yes</a>&nbsp;&nbsp;&nbsp;<a href="#" class="no submit">No</a> <a href="#" class="yes submit">Yes</a>&nbsp;&nbsp;&nbsp;<a href="#" class="no submit">No</a>
</div> </div>
...@@ -185,14 +182,16 @@ ...@@ -185,14 +182,16 @@
<td colspan="7" class="info-td"> <td colspan="7" class="info-td">
<div> <div>
<p>{{o.desc}}</p> <p>{{o.desc}}</p>
<p>{% if o.homepage%} <p>{% if o.definition.homepage%}
Group's home page: <a target="_blank" href="{{ o.homepage }}">{{ o.homepage }}</a> Project's home page: <a target="_blank" href="{{ o.homepage }}">{{ o.definition.homepage }}</a>
{% endif %} {% endif %}
</p> </p>
</div> </div>
</td> </td>
</tr> </tr>
{% endwith %}
{% endwith %}
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
...@@ -221,16 +220,19 @@ ...@@ -221,16 +220,19 @@
{% with page|concat:sorting as args %} {% with page|concat:sorting as args %}
{% with q|paginate:args as page_obj %} {% with q|paginate:args as page_obj %}
{% if page_obj.object_list %} {% if page_obj.object_list %}
{% with o.project.members as members %}
{% with o.project.approved_members as approved_members %}
<div> <div>
<form method="GET" class="minimal" action="#allGroups" id="mygroups"> <form method="GET" class="minimal" action="#allGroups" id="mygroups">
<div class="form-row"> <div class="form-row">
<select name="sorting" class="dropkicked" tabindex="1"> <select name="sorting" class="dropkicked" tabindex="1">
<option value="groupname">Sort by Name</option> <option value="definition__name">Sort by Name</option>
<!--<option value="kindname" {% if sorting == 'kindname' %}selected{% endif %}>Type</option>--> <!--<option value="kindname" {% if sorting == 'kindname' %}selected{% endif %}>Type</option>-->
<option value="issue_date" {% if sorting == 'issue_date' %}selected{% endif %}>Sort by Issue date</option> <option value="definition__start_date" {% if sorting == 'definition__start_date' %}selected{% endif %}>Sort by Start Date</option>
<option value="expiration_date" {% if sorting == 'expiration_date' %}selected{% endif %}>Sort by Expiration Date</option> <option value="definition__issue_date" {% if sorting == 'definition__issue_date' %}selected{% endif %}>Sort by Issue date</option>
<option value="approved_members_num" {% if sorting == 'approved_members_num' %}selected{% endif %}>Sort by Participants</option> <option value="definition__expiration_date" {% if sorting == 'definition__expiration_date' %}selected{% endif %}>Sort by Expiration Date</option>
<option value="moderation_enabled" {% if sorting == 'moderation_enabled' %}selected{% endif %}>Sort by Moderation</option> <!-- <option value="approved_members_num" {% if sorting == 'approved_members_num' %}selected{% endif %}>Sort by Participants</option> -->
<option value="definition__moderation_enabled" {% if sorting == 'definition__moderation_enabled' %}selected{% endif %}>Sort by Moderation</option>
</select> </select>
</div> </div>
</form> </form>
...@@ -241,6 +243,7 @@ ...@@ -241,6 +243,7 @@
<th>Name</th> <th>Name</th>
<!--th>Type</th--> <!--th>Type</th-->
<th>Issued</th> <th>Issued</th>
<th>Starts</th>
<th>Expires</th> <th>Expires</th>
<th>Enrolled</th> <th>Enrolled</th>
<th>Status</th> <th>Status</th>
...@@ -253,22 +256,23 @@ ...@@ -253,22 +256,23 @@
<tbody> <tbody>
{% for o in page_obj.object_list %} {% for o in page_obj.object_list %}
<tr class="{% cycle 'tr1' 'tr2' %}"> <tr class="{% cycle 'tr1' 'tr2' %}">
<td style="width:22%"><a href="{% url group_detail o.id %}" title="visit group page">{{o.groupname|truncatename }}</a></td> <td style="width:22%"><a href="{% url project_detail o.serial %}" title="visit group page">{{o.definition.name|truncatename }}</a></td>
<!--td>{{o.kindname|capfirst}}</td--> <!--td>{{o.kindname|capfirst}}</td-->
<td style="width:13%">{{o.issue_date|date:"d/m/Y"}}</td> <td style="width:13%">{{o.issue_date|date:"d/m/Y"}}</td>
<td style="width:13%">{{o.expiration_date|date:"d/m/Y"}}</td> <td style="width:13%">{{o.definition.start_date|date:"d/m/Y"}}</td>
<td style="width:11%">{{ o.approved_members_num }}</td> <td style="width:13%">{{o.definition.end_date|date:"d/m/Y"}}</td>
<td style="width:11%">{{approved_members|length}}</td>
<td style="width:17%"> <td style="width:17%">
<div class="msg-wrap"> <div class="msg-wrap">
{% if user.email = o.groupowner %} {% if user == o.owner %}
{% if o.is_enabled %} {% if o.is_active %}
Active (Owner) Active (Owner)
{% else %} {% else %}
Pending Pending
{% endif %} {% endif %}
{% else %} {% else %}
{% if o.is_enabled %} {% if o.is_active %}
{% if o.membership_status %} {% if user in members %}
Registered Registered
{% else %} {% else %}
...@@ -283,23 +287,23 @@ ...@@ -283,23 +287,23 @@
</td> </td>
<td style="width:15%"> <td style="width:15%">
<div class="msg-wrap"> <div class="msg-wrap">
{% if user.email = o.groupowner %} {% if user == o.owner %}
{% if o.is_enabled %} {% if o.is_active %}
&nbsp; &nbsp;
{% else %} {% else %}
&nbsp; &nbsp;
{% endif %} {% endif %}
{% else %} {% else %}
{% if o.is_enabled %} {% if o.is_active %}
{% if o.membership_status %} {% if user in approved_members %}
<form action="{% url group_leave o.id %}" method="post" class="link-like">{% csrf_token %} <form action="{% url project_leave o.serial %}" method="post" class="link-like">{% csrf_token %}
<input type="submit" value="x leave" class="leave" /> <input type="submit" value="x leave" class="leave" />
</form> </form>
<div class="dialog"> <div class="dialog">
Are you sure you what to leave this group?<br> Are you sure you want to leave this group?<br>
Name: <a href="{% url group_detail o.id %}" title="visit group page">{{o.groupname}}</a><br> Name: <a href="{% url project_detail o.serial %}" title="visit group page">{{o.groupname}}</a><br>
{% if o.desc %}Description:{{o.desc|truncatewords:30}}{% endif %}<br><br> {% if o.definition.description %}Description:{{o.definition.description|truncatewords:30}}{% endif %}<br><br>
<a href="#" class="yes submit">Yes</a>&nbsp;&nbsp;&nbsp;<a href="#" class="no submit">No</a> <a href="#" class="yes submit">Yes</a>&nbsp;&nbsp;&nbsp;<a href="#" class="no submit">No</a>
</div> </div>
...@@ -313,15 +317,14 @@ ...@@ -313,15 +317,14 @@
</div> </div>
</td> </td>
<td class="centered" style="width:9%">{% if o.moderation_enabled%}Yes{% else %}No{% endif %}</td>
<!-- <td><a href="#" class="more-info" title="more info">+ more info </a></td>--> <!-- <td><a href="#" class="more-info" title="more info">+ more info </a></td>-->
</tr> </tr>
<tr class="{% cycle 'tmore1' 'tmore2' %}" style="display:none"> <tr class="{% cycle 'tmore1' 'tmore2' %}" style="display:none">
<td colspan="8" class="info-td"> <td colspan="8" class="info-td">
<div> <div>
<p>{{o.desc}}</p> <p>{{o.definition.description}}</p>
<p>{% if o.homepage%} <p>{% if o.definition.homepage%}
Group's home page: <a href="{{ o.homepage }}">{{ o.homepage }}</a> Project's home page: <a href="{{ o.definition.homepage }}">{{ o.definition.homepage }}</a>
{% endif %} {% endif %}
</p> </p>
</div> </div>
...@@ -346,6 +349,8 @@ ...@@ -346,6 +349,8 @@
</span> </span>
</p> </p>
</div> </div>
{% endwith %}
{% endwith %}
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% endwith %} {% endwith %}
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
{% include "im/form_render.html" %} {% include "im/form_render.html" %}
</fieldset> </fieldset>
<fieldset id="icons"> <fieldset id="icons">
<legend> <legend>
......
{% extends "im/account_base.html" %}
{% load filters %}
{% block page.body %}
<div class="maincol {% block innerpage.class %}{% endblock %}">
<div class="projects">
<h2>PROJECTS</h2>
{% with page_obj.object_list as object_list %}
{% for o in object_list%}
{{o.definition.name}} - {{o.issue_date}}
{% endfor %}
{% endwith %}
</div>
</div>
{% endblock %}
...@@ -68,8 +68,6 @@ urlpatterns = patterns('astakos.im.views', ...@@ -68,8 +68,6 @@ urlpatterns = patterns('astakos.im.views',
url(r'^group/how_it_works/?$', 'how_it_works', {}, name='how_it_works'), url(r'^group/how_it_works/?$', 'how_it_works', {}, name='how_it_works'),
url(r'^project/add/?$', 'project_add', {}, name='project_add'), url(r'^project/add/?$', 'project_add', {}, name='project_add'),
url(r'^project/application/list/?$', 'project_application_list', {}, name='project_application_list'),
url(r'^project/application/(?P<serial>\w+)/?$', 'project_application_detail', {}, name='project_application_detail'),
url(r'^project/list/?$', 'project_list', {}, name='project_list'), url(r'^project/list/?$', 'project_list', {}, name='project_list'),
url(r'^project/search/?$', 'project_search', {}, name='project_search'), url(r'^project/search/?$', 'project_search', {}, name='project_search'),
url(r'^project/all/?$', 'project_all', {}, name='project_all'), url(r'^project/all/?$', 'project_all', {}, name='project_all'),
......
...@@ -1479,10 +1479,15 @@ def project_add(request): ...@@ -1479,10 +1479,15 @@ def project_add(request):
def project_list(request): def project_list(request):
return object_list( return object_list(
request, request,
Project.objects.all(), ProjectApplication.objects.all(),
paginate_by=PAGINATE_BY_ALL, paginate_by=PAGINATE_BY_ALL,
page=request.GET.get('page') or 1, page=request.GET.get('page') or 1,
template_name='im/projects/project_list.html') template_name='im/projects/project_list.html',
extra_context={
'is_search':False,
'sorting':request.GET.get('sorting'),
}
)
@require_http_methods(["GET", "POST"]) @require_http_methods(["GET", "POST"])
...@@ -1503,10 +1508,13 @@ def project_application_detail(request, serial): ...@@ -1503,10 +1508,13 @@ def project_application_detail(request, serial):
def project_detail(request, serial): def project_detail(request, serial):
return object_detail( return object_detail(
request, request,
queryset=Project.objects.select_related(), queryset=ProjectApplication.objects.select_related(),
slug=serial, slug=serial,
slug_field='serial', slug_field='serial',
template_name='im/projects/project_detail.html' template_name='im/projects/project_detail.html',
extra_context={
'sorting':request.GET.get('sorting', request.POST.get('sorting')),
}
) )
@require_http_methods(["GET", "POST"]) @require_http_methods(["GET", "POST"])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment