Revision 71a38edf

b/snf-astakos-app/astakos/im/models.py
65 65
from astakos.im.settings import (
66 66
    DEFAULT_USER_LEVEL, INVITATIONS_PER_LEVEL,
67 67
    AUTH_TOKEN_DURATION, BILLING_FIELDS,
68
    EMAILCHANGE_ACTIVATION_DAYS, LOGGING_LEVEL
68
    EMAILCHANGE_ACTIVATION_DAYS, LOGGING_LEVEL,
69
    GROUP_CREATION_SUBJECT
69 70
)
70 71
from astakos.im.endpoints.qh import (
71 72
    register_users, send_quota, register_resources
......
1178 1179
    
1179 1180
    @property
1180 1181
    def approved_members(self):
1181
        return self.members.filter(is_accepted=True)
1182
        return [m.person for m in self.members.filter(is_accepted=True)]
1182 1183
    
1183 1184
    def suspend(self):
1184 1185
        self.last_approval_date = None
......
1269 1270
        application.save()
1270 1271
        notification = build_notification(
1271 1272
        settings.SERVER_EMAIL,
1272
        [settings.ADMINS],
1273
        _(GROUP_CREATION_SUBJECT) % {'group':app.definition.name},
1274
        _('An new project application identified by %(serial)s has been submitted.') % app.serial
1273
        [i[1] for i in settings.ADMINS],
1274
        _(GROUP_CREATION_SUBJECT) % {'group':application.definition.name},
1275
        _('An new project application identified by %(serial)s has been submitted.') % application.__dict__
1275 1276
    )
1276 1277
    notification.send()
1277 1278
    return application
b/snf-astakos-app/astakos/im/notifications.py
36 36

  
37 37
from django.conf import settings
38 38
from django.core.mail import send_mail
39
from django.utils.translation import ugettext as _
39 40

  
40 41
import astakos.im.messages as astakos_messages
41 42

  
42 43
logger = logging.getLogger(__name__)
43 44

  
44
def build_notification():
45
def build_notification(sender, recipients, subject, message):
45 46
    return EmailNotification(sender, recipients, subject, message)
46 47

  
47 48
class Notification(object):
......
58 59
    def send(self):
59 60
        try:
60 61
            send_mail(
61
                subject,
62
                message,
63
                sender,
64
                recipients
62
                self.subject,
63
                self.message,
64
                self.sender,
65
                self.recipients
65 66
            )
66
        except:
67
        except BaseException, e:
68
            logger.exception(e)
67 69
            raise SendNotificationError()
68 70

  
69 71
class SendMailError(Exception):
b/snf-astakos-app/astakos/im/templates/im/projects/project_detail.html
3 3
{% load filters %}
4 4

  
5 5
{% block page.body %}
6
{% with object.owners as owners %}
7
 
6
{% with object.project.members as members %}
7
{% with object.project.approved_members as approved_members %}
8

  
8 9
<div class="projects">
9 10
	
10 11

  
11 12
	<h2>
12
	 	{% if object.is_member %}
13
	 	{% if user in members %}
13 14
			<em>
14
				{% if object.is_owner %}
15
					{% if object.is_enabled %}
15
				{% if user == object.owner %}
16
					{% if object.is_active %}
16 17
						[ ADMINISTRATOR - ACTIVE ]
17 18
					{% else %}
18 19
						[ ADMINISTRATOR - PENDING ]
19 20
					{% endif %}
20 21
				{%  else %}
21
					{% if  object.is_active_member %}
22
					{% if  user in approve_members %}
22 23
						[ ENROLLED - ACTIVE ]
23 24
					{% else %}
24 25
						[ ENROLLED - PENDING ]
......
26 27
				{% endif %}
27 28
			</em>		
28 29
		{% endif %}
29
	 	<span>{{ object.name|upper }}</span>
30
	 	<span>{{ object.definition.name|upper }}</span>
30 31
	 </h2>
31 32
	 
32 33
	 <div class="details">
33 34
	 	<h3>
34 35
	 		GENERAL INFO
35
		 	{% if object.is_owner %}
36
		 	{% if user == object.owner %}
36 37
		 		<a href="#" class="edit">EDIT</a>
37 38
		 	{% endif %}
38 39
	 	</h3>
39 40
	 	
40 41
	 	<div class="data">
41
		 	<p class="restricted">{{ object.desc|safe }}</p>
42
		 	<p class="restricted">{{ object.definition.description|safe }}</p>
42 43
		 	<dl class="alt-style">
43 44
			 	<dt>Homepage url</dt>
44 45
			 	<dd>
45
			 		{% if object.homepage%}
46
			 			<a href="{{ object.homepage }}">{{ object.homepage }}</a>
46
			 		{% if object.definition.homepage%}
47
			 			<a href="{{ object.definition.homepage }}">{{ object.definition.homepage }}</a>
47 48
			 		{% else %}
48 49
			 			Not set yet
49 50
			 		{% endif %}
50 51
			 	</dd>
51 52
			 	<dt>Moderation</dt>
52 53
			 	<dd>
53
			 		{{ object.moderation_enabled|yesno:"Yes, No" }}
54
			 		{{ object.definition.member_accept_policy.description }}
54 55
			 	</dd>
55 56
			 </dl>
56 57
		</div>
57 58
		<div class="editable" style="display:none;">
58
		<form action="{% url astakos.im.views.group_detail object.id %}" method="post"
59
		<form action="{% url project_detail object.serial %}" method="post"
59 60
	            class="withlabels">{% csrf_token %}
60 61
	            {% with update_form as form %}
61 62
                    {% include "im/form_render.html" %}
......
70 71
		 <h3>DETAILS</h3>
71 72
		 <dl class="alt-style">
72 73
		 	<dt>Name</dt>
73
		 	<dd>{{ object.name }}&nbsp;</dd>
74
		 	<!--<dt>Type</dt>
75
		 	<dd>{{object.kindname|capfirst}}&nbsp;</dd>-->
74
		 	<dd>{{ object.definition.name }}&nbsp;</dd>
76 75
		 	<dt>Issue date:</dt>
77 76
		 	<dd>{{object.issue_date|date:"d/m/Y"}}&nbsp;</dd>
78
		 	<dt>Expiration Date</dt>
79
		 	<dd>{{object.expiration_date|date:"d/m/Y"}}&nbsp;</dd>
77
		 	<dt>Start date:</dt>
78
		 	<dd>{{object.definition.start_date|date:"d/m/Y"}}&nbsp;</dd>
79
		 	<dt>End Date</dt>
80
		 	<dd>{{object.definition.end_date|date:"d/m/Y"}}&nbsp;</dd>
80 81
<!--
81 82
		 	<dt>Moderation</dt>
82 83
		 	<dd>{% if object.moderation_enabled%}Yes{% else %}No{% endif %}</dd>
83 84
 -->
84 85
		 	<dt>Activated</dt>
85
		 	<dd>{% if object.is_enabled %}Yes{% else %}No{% endif %}</dd>
86
		 	<dd>{% if object.is_active %}Yes{% else %}No{% endif %}</dd>
86 87
		 	<dt>Owner</dt>
87
		 	{{ o.owners }}
88
		 	<dd>{% for o in owners %}
89
                    {% if object.is_owner %}
88
		 	{{ o.owner }}
89
		 	<dd>{% if user == o.owner %}
90 90
                        Me
91
                    {% else%}
92
                        {{o.realname}} ({{o.email}})
93
                    
94
                    {% endif %}
95
                {% endfor %}&nbsp;
91
                {% else%}
92
                    {{o.owner.realname}} ({{o.owner.email}})
93
                
94
                {% endif %}
95
                &nbsp;
96 96
            </dd>
97 97
            <dt>Max participants</dt>
98
		 	<dd>{% if object.max_participants%}{{object.max_participants}}{% else %}&nbsp;{% endif %}</dd>
98
		 	<dd>{% if object.definition.limit_on_members_number%}{{object.definition.limit_on_members_number}}{% else %}&nbsp;{% endif %}</dd>
99 99
		 </dl>
100 100
	 </div>
101 101
	 <div class="full-dotted">
102 102
		 <h3>RESOURCES</h3>		 
103
		 {% if quota %}
103
		 {% if object.definition.projectresourcegrant_set.all %}
104 104
		 <dl class="alt-style">	
105
	 		{% for q in quota %}
106
		 		 
105
	 		{% for q in object.definition.projectresourcegrant_set.all %}
106
		 		 q.resource
107 107
		 		<dt>
108 108
       				Max {% if q.is_abbreviation %}{{ q.verbose_name|upper }}{% else %}{{ q.verbose_name }}{% endif %}{% if not q.unit %}s {% endif  %}  per user
109 109
       			</dt>
110 110
		 		<dd>
111
       			{% if q.value %}
111
       			{% if q.member_limit %}
112 112
       				 {% if q.unit %}
113
       				 	{{ q.value|sizeof_fmt }}
113
       				 	{{ q.member_limit|sizeof_fmt }}
114 114
       				 {% else %}
115
       				 	{{ q.value|isinf }}
115
       				 	{{ q.member_limit|isinf }}
116 116
       				 {% endif %}
117 117
       			{% else %}
118 118
       				Unlimited
......
128 128
            <p>No resources</p>
129 129
        {% endif %} 
130 130
	 </div>
131
     {% if object.is_owner %}
131
     {% if user == object.owner %}
132 132
	 <div class="full-dotted">
133 133
	    {% with page|concat:sorting as args %}
134
	    {% with object.membership_set.select_related.all|paginate:args as membership %}
134
	    {% with object.project.projectmembership_set.select_related.all|paginate:args as membership %}
135 135
            {% if membership %}
136 136
            <form method="GET" class="minimal" action="#members-table">
137 137
                <div class="form-row">
......
156 156
                  <tr>
157 157
                    <td>{{m.person.email}}</td>
158 158
                    <td>{{m.person.realname}}</td>
159
                    {% if m.person in owners %}
159
                    {% if m.person == o.owner %}
160 160
                    <td>Owner</td>
161 161
                    {% else %}
162
                        {% if m.is_approved %}
162
                        {% if m.is_accepted %}
163 163
                        <td>Approved
164
                            {% if object.is_owner %}
165
                                <a href="{% url disapprove_member object.id m.person.id  %}?{% if page %}page={{ page }}{% endif %}{% if sorting %}&sorting={{sorting}}{% endif %}">Remove</a>
164
                            {% if user == object.owner %}
165
                                <a href="{% url project_disapprove_member object.serial m.person.id  %}?{% if page %}page={{ page }}{% endif %}{% if sorting %}&sorting={{sorting}}{% endif %}">Remove</a>
166 166
                            {% endif %}
167 167
                        </td>
168 168
                        {% else %}
169 169
                        <td>Pending
170
                            {% if object.is_owner %}
171
                                <a href="{% url approve_member object.id m.person.id %}?{% if page %}page={{ page }}{% endif %}{% if sorting %}&sorting={{sorting}}{% endif %}">Accept</a>
172
                                <a href="{% url disapprove_member object.id m.person.id  %}?{% if page %}page={{ page }}{% endif %}{% if sorting %}&sorting={{sorting}}{% endif %}">Remove</a>
170
                            {% if user == object.owner %}
171
                                <a href="{% url project_approve_member object.serial m.person.id %}?{% if page %}page={{ page }}{% endif %}{% if sorting %}&sorting={{sorting}}{% endif %}">Accept</a>
172
                                <a href="{% url project_disapprove_member object.serial m.person.id  %}?{% if page %}page={{ page }}{% endif %}{% if sorting %}&sorting={{sorting}}{% endif %}">Remove</a>
173 173
                            {% endif %}
174 174
                        </td>    
175 175
                        {% endif %}
......
203 203
     
204 204
    
205 205
    <div class="full-dotted">
206
        <form action="{% url astakos.im.views.group_detail object.id %}#members-table" method="post" class="withlabels" >{% csrf_token %}
206
        <form action="{% url project_detail object.serial %}#members-table" method="post" class="withlabels" >{% csrf_token %}
207 207
            <h2>Enroll more members</h2>
208 208
                {% with addmembers_form as form %}
209 209
                    {% include "im/form_render.html" %}
......
228 228
</div>
229 229
 
230 230
{% endwith %}
231
{% endwith %}
231 232
{% endblock %}
/dev/null
1
{% extends "im/account_base.html" %}
2

  
3
{% load filters %}
4

  
5
{% block page.body %}
6
 
7
{% with form.data as data %}	 	
8
<div class="projects summary">
9
	<form action="{% url group_add_complete %}" method="post" class="quotas-form">{% csrf_token %}
10
		<legend>CONFIRMATION REQUEST</legend>
11
		<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>
12
<!-- 
13
 		{% for k,v in data.iteritems %}
14
 			<input type="hidden" name="{{ k }}" value="{{ v }}">
15
 		{% endfor %}
16
 -->
17
        {% include "im/form_render.html" %}
18
		<div class="full-dotted">
19
			<h3>GENERAL INFO</h3>
20
			<p class="restricted">{{ data.desc|safe }}</p>
21
			<dl class="alt-style">			    
22
				<dt>Homepage Url</dt>
23
				<dd>{{ data.homepage }}&nbsp;</dd>
24
				<dt>Modaration</dt>
25
			 	<dd>{{ data.moderation_enabled|yesno:"Yes, No" }}</dd>
26
			</dl>
27
		</div>
28
		<div class="full-dotted">
29
			 <h3>DETAILS</h3>
30
			 <dl class="alt-style">			    
31
			    <dt>Name</dt>
32
			 	<dd>{{ data.name }}&nbsp;</dd>
33
			 	<!--<dt>Type</dt>
34
			 	<dd>Course&nbsp;</dd>-->
35
			 	<dt>Issue date:</dt>
36
			 	<dd>{{ data.issue_date|date:"d/m/Y"}}&nbsp;</dd>
37
			 	<dt>Expiration Date</dt>
38
			 	<dd>{{ data.expiration_date|date:"d/m/Y"}}&nbsp;</dd>
39
			 	<dt>Max members per group</dt>
40
			 	<dd>{% if  data.max_participants %}{{ data.max_participants }}{% else %}Unlimited{% endif %}</dd>
41
			 </dl>
42
		 </div>
43
		 
44
		 
45
		 <div class="full-dotted">
46
			<h3>RESOURCES</h3>
47
			<p>The following ~okeanos resources will be granted to each member of this Project:</p>
48
		 	<dl class="alt-style">	
49
		 		{% for p in policies %}
50
			 		 
51
			 		<dt>
52
           				Max {% if p.is_abbreviation %}{{ p.name|upper }}{% else %}{{ p.name }}{% endif %}{% if not p.unit %}s {% endif  %}  per user
53
           			</dt>
54
			 		<dd>
55
           			{% if p.uplimit %}
56
           				 {% if p.unit %}
57
           				 	{{ p.uplimit|sizeof_fmt }}
58
           				 {% else %}
59
           				 	{{ p.uplimit }}
60
           				 {% endif %}
61
           			{% else %}
62
           				Unlimited
63
           			{% endif %}
64
           			</dd>
65
           		{% empty %}
66
           			No resources
67
		 		{% endfor %}
68
		 	</dl>      
69
		 </div>
70
		 
71
		 <div class="full-dotted">
72
		 	 
73
		 </div>
74
		
75
		 
76
		 <div class="form-row submit">
77
	   		<input type="submit" value="SUBMIT" class="submit altcol" autocomplete="off">
78
		 </div>
79
	</form>
80
    
81
</div>
82
{% endwith %}
83
 
84
{% endblock %}
b/snf-astakos-app/astakos/im/templates/im/projects/project_list.html
8 8
	    <h2>PROJECTS</h2>
9 9
	    {% if form %}
10 10
		    <p>Search for existing Projects and join the ones you like. Please search by Project name. </p>
11
		    <form action="{% url group_search %}" method="post" class="withlabels signup submit-inline">{% csrf_token %}
11
		    <form action="{% url project_search %}" method="post" class="withlabels signup submit-inline">{% csrf_token %}
12 12
		            {% include "im/form_render.html" %}
13 13
		        <div class="form-row submit">
14 14
		                <input type="submit" class="submit altcol" value="SEARCH" />
15
		                {% if q %}<a href="{% url group_all %}">clear</a>{% endif %}
15
		                {% if q %}<a href="{% url project_all %}">clear</a>{% endif %}
16 16
		        </div>
17 17
		    </form>
18
		    
19
		    <!--<form action="{% url group_all %}" method="post" class="link-like alone">{% csrf_token %}
20
		        <div class="form-row submit">
21
		            <input type="submit" class="submit altcol" value="clear" />
22
		        </div>
23
		    </form>
24
		   <-->
25 18
	    {% else %}
26 19
    	<div class="two-cols clearfix">
27 20
			<div class="rt">
......
41 34
					<div>
42 35
						<div class="wrap">
43 36

  
44
							<p class="centered"><a href="{% url group_add 'project' %}"><img alt="THINK ABOUT IT" src="/static/im/images/create.png"></a></p>
37
							<p class="centered"><a href="{% url project_add %}"><img alt="THINK ABOUT IT" src="/static/im/images/create.png"></a></p>
45 38
							<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>
46
							<p><a href="{% url group_add 'project' %}">create a project ></a></p>
47
							<!--<p class="btn"><a href="{% url group_create_list %}" class="submit">CREATE</a></p>-->
39
							<p><a href="{% url project_add %}">create a project ></a></p>
48 40
						</div>
49 41
					</div>
50 42
				</li>
51 43
				<li class="join">
52 44
					<div>
53 45
						<div class="wrap">
54
							<p class="centered"><a href="{% url group_all %}"><img alt="THINK ABOUT IT" src="/static/im/images/join.png"></a></p>
46
							<p class="centered"><a href="{% url project_all %}"><img alt="THINK ABOUT IT" src="/static/im/images/join.png"></a></p>
55 47
							<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>
56 48
							
57
							<p><a href="{% url group_all %}">join a project ></a></p>
49
							<p><a href="{% url project_all %}">join a project ></a></p>
58 50
						</div>
59 51
					</div>
60 52
				</li>
......
69 61
        	<form method="GET" class="minimal" action="#searchResults"> 
70 62
				<div class="form-row">
71 63
					<select name="sorting" onchange="this.form.submit();" class="dropkicked" tabindex="1">
72
					    <option value="groupname">Sort by Name</option>
64
					    <option value="definition__name">Sort by Name</option>
73 65
			            <option value="issue_date" {% if sorting == 'issue_date' %}selected{% endif %}>Sort by Issue date</option>			
74
			            <option value="expiration_date" {% if sorting == 'expiration_date' %}selected{% endif %}>Sort by Expiration Date</option>
75
			            <option value="approved_members_num" {% if sorting == 'approved_members_num' %}selected{% endif %}>Sort by Participants</option> 
76
			            <option value="moderation_enabled" {% if sorting == 'moderation_enabled' %}selected{% endif %}>Sort by Moderation</option> 
66
			            <option value="definition__start_date" {% if sorting == 'definition__start_date' %}selected{% endif %}>Sort by Start Date</option>
67
			            <option value="definition__end_date" {% if sorting == 'definition__end_date' %}selected{% endif %}>Sort by End Date</option>
68
			            <!-- <option value="approved_members_num" {% if sorting == 'approved_members_num' %}selected{% endif %}>Sort by Participants</option> --> 
69
			            <option value="definition__member_accept_policy" {% if sorting == 'definition__member_accept_policy' %}selected{% endif %}>Sort by Moderation</option> 
77 70
					</select>
78 71
					<input type="hidden" name="q" value="{{q}}"/>
79 72
				</div>
......
87 80
                    <th>Name</th>
88 81
                    <!--<th>Type</th>-->
89 82
                    <th>Issued</th>
83
                    <th>Starts</th>
90 84
                    <th>Expires</th>
91 85
                     
92 86
                    <th>Enrolled</th>
......
100 94
                  </tr>
101 95
                </thead>
102 96
                <tbody>
103
                  {% for o in object_list %}
97
                  {% for o in object_list %} 
98
                  {% with o.project.members as members %}
99
                  {% with o.project.approved_members as approved_members%}
104 100
                   <tr class="{% cycle 'tr1' 'tr2' %}">
105
	                    <td style="width:22%"><a href="{% url group_detail o.id %}" title="visit group page">{{o.groupname|truncatename}}</a></td>
101
	                    <td style="width:22%"><a href="{% url project_detail o.serial %}" title="visit group page">{{o.definition.name|truncatename}}</a></td>
106 102
	                    <!--td>{{o.kindname|capfirst}}</td-->
107 103
	                    <td style="width:13%">{{o.issue_date|date:"d/m/Y"}}</td>
108
	                    <td style="width:13%">{{o.expiration_date|date:"d/m/Y"}}</td>
109
	                    <td style="width:11%">{{o.approved_members_num}}</td>
104
	                    <td style="width:13%">{{o.definition.start_date|date:"d/m/Y"}}</td>
105
	                    <td style="width:13%">{{o.definition.end_date|date:"d/m/Y"}}</td>
106
	                    <td style="width:11%">{{approved_members|length}}</td>
110 107
	                    
111 108
	                    <td style="width:17%">
112 109
	                    	<div class="msg-wrap">
113 110
	                    		 
114
		                    {% if o.is_member %}
115
		                        {% if o.membership_approval_date %}
111
		                    {% if user in members %}
112
		                        {% if user in approved_members %}
116 113
		    
117 114
		                        
118
			                       	{% if not o.is_owner %}
115
			                       	{% if not user == o.owner %}
119 116
			                            Registered
120 117
			                             
121 118
			                        {% else %}
......
137 134
	                    <td style="width:15%">
138 135
	                    	<div class="msg-wrap">
139 136
	                    		 
140
		                    {% if o.is_member %}
141
		                        {% if o.membership_approval_date %}
137
		                    {% if user in members %}
138
		                        {% if user in approved_members %}
142 139
		    
143 140
		                        
144
			                       	{% if not o.is_owner %}
141
			                       	{% if not user == o.owner %}
145 142
			                             
146
			                            <form action="{% url group_leave o.id %}" method="post" class="link-like">{% csrf_token %}
143
			                            <form action="{% url project_leave o.serial %}" method="post" class="link-like">{% csrf_token %}
147 144
			                                 <input type="submit"  value="x leave group" class="leave"/>
148 145
			                            </form>
149 146
			                            <div class="dialog">
150 147
					                		Are you sure you what to leave this group?<br>
151
					                		Name: <a  href="{% url group_detail o.id %}" title="visit group page">{{o.groupname}}</a><br>
152
					                		{% if o.desc %}Description:{{o.desc|truncatewords:30}}{% endif %}<br><br>
148
					                		Name: <a  href="{% url project_detail o.serial %}" title="visit group page">{{o.groupname}}</a><br>
149
					                		{% if o.definition.description %}Description:{{o.definition.description|truncatewords:30}}{% endif %}<br><br>
153 150
					                		
154 151
					                		<a href="#" class="yes submit">Yes</a>&nbsp;&nbsp;&nbsp;<a href="#" class="no submit">No</a>
155 152
					                	</div>
......
164 161
		                        {% endif %}
165 162
		                    {% else %}
166 163
		                             
167
		                                <form action="{% url group_join o.id %}" method="post" class="link-like">{% csrf_token %}
164
		                                <form action="{% url project_join o.serial %}" method="post" class="link-like">{% csrf_token %}
168 165
		                                    <input type="submit"   value="+ join group" class="join_group join" />
169 166
		                                </form>
170 167
		                                <div class="dialog">
171 168
					                		Are you sure you what to join this group?<br>
172
					                		Name: <a  href="{% url group_detail o.id %}" title="visit group page">{{o.groupname}}</a><br>
173
					                		{% if o.desc %}Description:{{o.desc|truncatewords:30}}{% endif %}<br><br>
169
					                		Name: <a  href="{% url project_detail o.serial %}" title="visit group page">{{o.groupname}}</a><br>
170
					                		{% if o.definition.description %}Description:{{o.definition.description|truncatewords:30}}{% endif %}<br><br>
174 171
					                		
175 172
					                		<a href="#" class="yes submit">Yes</a>&nbsp;&nbsp;&nbsp;<a href="#" class="no submit">No</a>
176 173
					                	</div>
......
185 182
                    <td colspan="7" class="info-td">
186 183
                        <div>
187 184
                            <p>{{o.desc}}</p>
188
                            <p>{% if o.homepage%}
189
                                Group's home page: <a target="_blank" href="{{ o.homepage }}">{{ o.homepage }}</a>
185
                            <p>{% if o.definition.homepage%}
186
                                Project's home page: <a target="_blank" href="{{ o.homepage }}">{{ o.definition.homepage }}</a>
190 187
                            
191 188
                            {% endif %}
192 189
                            </p>
193 190
                        </div>	
194 191
                    </td>
195 192
                  </tr>
193
                  {% endwith %}
194
                  {% endwith %}
196 195
                  {% endfor %}
197 196
                </tbody>
198 197
            </table>
......
221 220
            {% with page|concat:sorting as args %}
222 221
            {% with q|paginate:args as page_obj %}
223 222
        	 	{% if page_obj.object_list  %}
223
        	 	{% with o.project.members as members %}
224
                {% with o.project.approved_members as approved_members %}  
224 225
	      	    <div>
225 226
					<form method="GET" class="minimal" action="#allGroups" id="mygroups">
226 227
						<div class="form-row">
227 228
						    <select name="sorting"  class="dropkicked"  tabindex="1">
228
							    <option value="groupname">Sort by Name</option>
229
							    <option value="definition__name">Sort by Name</option>
229 230
					            <!--<option value="kindname" {% if sorting == 'kindname' %}selected{% endif %}>Type</option>-->			
230
					            <option value="issue_date" {% if sorting == 'issue_date' %}selected{% endif %}>Sort by Issue date</option>			
231
					            <option value="expiration_date" {% if sorting == 'expiration_date' %}selected{% endif %}>Sort by Expiration Date</option>
232
					            <option value="approved_members_num" {% if sorting == 'approved_members_num' %}selected{% endif %}>Sort by Participants</option>
233
					            <option value="moderation_enabled" {% if sorting == 'moderation_enabled' %}selected{% endif %}>Sort by Moderation</option>		
231
					            <option value="definition__start_date" {% if sorting == 'definition__start_date' %}selected{% endif %}>Sort by Start Date</option>
232
			                    <option value="definition__issue_date" {% if sorting == 'definition__issue_date' %}selected{% endif %}>Sort by Issue date</option>			
233
					            <option value="definition__expiration_date" {% if sorting == 'definition__expiration_date' %}selected{% endif %}>Sort by Expiration Date</option>
234
					            <!-- <option value="approved_members_num" {% if sorting == 'approved_members_num' %}selected{% endif %}>Sort by Participants</option> -->
235
					            <option value="definition__moderation_enabled" {% if sorting == 'definition__moderation_enabled' %}selected{% endif %}>Sort by Moderation</option>		
234 236
							</select>
235 237
						</div>
236 238
					</form>
......
241 243
			                <th>Name</th>
242 244
			                <!--th>Type</th-->
243 245
			                <th>Issued</th>
246
			                <th>Starts</th>
244 247
			                <th>Expires</th>
245 248
			                <th>Enrolled</th>
246 249
			                <th>Status</th>
......
253 256
			            <tbody>
254 257
			              {% for o in page_obj.object_list %}
255 258
			              <tr class="{% cycle 'tr1' 'tr2' %}">
256
			                <td style="width:22%"><a  href="{% url group_detail o.id %}" title="visit group page">{{o.groupname|truncatename }}</a></td>
259
			                <td style="width:22%"><a  href="{% url project_detail o.serial %}" title="visit group page">{{o.definition.name|truncatename }}</a></td>
257 260
			                <!--td>{{o.kindname|capfirst}}</td-->
258 261
			                <td style="width:13%">{{o.issue_date|date:"d/m/Y"}}</td>
259
			                <td style="width:13%">{{o.expiration_date|date:"d/m/Y"}}</td>
260
			                <td style="width:11%">{{ o.approved_members_num }}</td>
262
			                <td style="width:13%">{{o.definition.start_date|date:"d/m/Y"}}</td>
263
			                <td style="width:13%">{{o.definition.end_date|date:"d/m/Y"}}</td>
264
			                <td style="width:11%">{{approved_members|length}}</td>
261 265
			                <td style="width:17%">
262 266
			                	<div class="msg-wrap">
263
			                	{% if user.email = o.groupowner %}
264
			                		{% if o.is_enabled %}
267
			                	{% if user == o.owner %}
268
			                		{% if o.is_active %}
265 269
			                			Active (Owner)
266 270
			                		{% else %}
267 271
			                			Pending
268 272
			                		{% endif %}
269 273
			                	{% else %}
270
			                		{% if o.is_enabled %}
271
			                			{% if o.membership_status %}
274
			                		{% if o.is_active %}
275
			                			{% if user in members %}
272 276
						                    Registered
273 277
					                    	 
274 278
						                {% else %}
......
283 287
			                </td>
284 288
			                <td style="width:15%">
285 289
			                	<div class="msg-wrap">
286
			                 	{% if user.email = o.groupowner %}
287
			                		{% if o.is_enabled %}
290
			                 	{% if user == o.owner %}
291
			                		{% if o.is_active %}
288 292
			                			&nbsp;
289 293
			                		{% else %}
290 294
			                			&nbsp;
291 295
			                		{% endif %}
292 296
			                	{% else %}
293
			                		{% if o.is_enabled %}
294
			                			{% if o.membership_status %}
297
			                		{% if o.is_active %}
298
			                			{% if user in approved_members %}
295 299
						                    
296
					                    	<form action="{% url group_leave o.id %}" method="post" class="link-like">{% csrf_token %}
300
					                    	<form action="{% url project_leave o.serial %}" method="post" class="link-like">{% csrf_token %}
297 301
					                             <input type="submit"  value="x leave" class="leave" />
298 302
					                        </form>	
299 303
					                        <div class="dialog">
300
						                		Are you sure you what to leave this group?<br>
301
						                		Name: <a  href="{% url group_detail o.id %}" title="visit group page">{{o.groupname}}</a><br>
302
						                		{% if o.desc %}Description:{{o.desc|truncatewords:30}}{% endif %}<br><br>
304
						                		Are you sure you want to leave this group?<br>
305
						                		Name: <a  href="{% url project_detail o.serial %}" title="visit group page">{{o.groupname}}</a><br>
306
						                		{% if o.definition.description %}Description:{{o.definition.description|truncatewords:30}}{% endif %}<br><br>
303 307
						                		
304 308
						                		<a href="#" class="yes submit">Yes</a>&nbsp;&nbsp;&nbsp;<a href="#" class="no submit">No</a>
305 309
						                	</div>
......
313 317
			                	
314 318
			                	</div>
315 319
			                </td>
316
			                <td class="centered" style="width:9%">{% if o.moderation_enabled%}Yes{% else %}No{% endif %}</td>
317 320
			               <!-- <td><a href="#" class="more-info" title="more info">+ more info </a></td>-->
318 321
			              </tr>
319 322
			              <tr class="{% cycle 'tmore1' 'tmore2' %}" style="display:none">
320 323
			                <td colspan="8" class="info-td">
321 324
			                	<div>
322
			                		<p>{{o.desc}}</p>
323
					                <p>{% if o.homepage%}
324
							 			Group's home page: <a href="{{ o.homepage }}">{{ o.homepage }}</a>
325
			                		<p>{{o.definition.description}}</p>
326
					                <p>{% if o.definition.homepage%}
327
							 			Project's home page: <a href="{{ o.definition.homepage }}">{{ o.definition.homepage }}</a>
325 328
							 		{% endif %}
326 329
							 		</p>
327 330
			                	</div>	
......
346 349
                        </span>
347 350
					</p>
348 351
			   </div>
352
			    {% endwith %} 
353
	      	    {% endwith %} 
349 354
		 	{% endif %}
350 355
        	{% endwith %} 
351 356
	      	{% endwith %} 
b/snf-astakos-app/astakos/im/templates/im/projects/projectapplication_form.html
19 19
        
20 20
        {% include "im/form_render.html" %}
21 21

  
22
    </fieldset>     
22
    </fieldset>
23 23
    
24 24
    <fieldset id="icons">
25 25
    	<legend>
/dev/null
1
{% extends "im/account_base.html" %}
2

  
3
{% load filters %}
4

  
5
{% block page.body %}
6
<div class="maincol {% block innerpage.class %}{% endblock %}">
7
    <div class="projects">
8
	    <h2>PROJECTS</h2>
9
    {% with page_obj.object_list as object_list %}
10
        {% for o in object_list%}
11
            {{o.definition.name}} - {{o.issue_date}}
12
        {% endfor %}
13
    {% endwith %}
14
    </div>
15
</div>  
16
{% endblock %}
b/snf-astakos-app/astakos/im/urls.py
68 68
    url(r'^group/how_it_works/?$', 'how_it_works', {}, name='how_it_works'),
69 69
    
70 70
    url(r'^project/add/?$', 'project_add', {}, name='project_add'),
71
    url(r'^project/application/list/?$', 'project_application_list', {}, name='project_application_list'),
72
    url(r'^project/application/(?P<serial>\w+)/?$', 'project_application_detail', {}, name='project_application_detail'),
73 71
    url(r'^project/list/?$', 'project_list', {}, name='project_list'),
74 72
    url(r'^project/search/?$', 'project_search', {}, name='project_search'),
75 73
    url(r'^project/all/?$', 'project_all', {}, name='project_all'),
b/snf-astakos-app/astakos/im/views.py
1479 1479
def project_list(request):
1480 1480
    return object_list(
1481 1481
        request,
1482
        Project.objects.all(),
1482
        ProjectApplication.objects.all(),
1483 1483
        paginate_by=PAGINATE_BY_ALL,
1484 1484
        page=request.GET.get('page') or 1,
1485
        template_name='im/projects/project_list.html')
1485
        template_name='im/projects/project_list.html',
1486
        extra_context={
1487
            'is_search':False,
1488
            'sorting':request.GET.get('sorting'),
1489
        }
1490
    )
1486 1491

  
1487 1492

  
1488 1493
@require_http_methods(["GET", "POST"])
......
1503 1508
def project_detail(request, serial):
1504 1509
    return object_detail(
1505 1510
        request,
1506
        queryset=Project.objects.select_related(), 
1511
        queryset=ProjectApplication.objects.select_related(),
1507 1512
        slug=serial,
1508 1513
        slug_field='serial',
1509
        template_name='im/projects/project_detail.html'
1514
        template_name='im/projects/project_detail.html',
1515
        extra_context={
1516
            'sorting':request.GET.get('sorting', request.POST.get('sorting')),
1517
        }
1510 1518
    )
1511 1519

  
1512 1520
@require_http_methods(["GET", "POST"])

Also available in: Unified diff