Revision e1dc6dec

b/snf-astakos-app/astakos/im/static/im/js/common.js
316 316
      	$('input#id_password').siblings('label').css('opacity','0');
317 317
      }
318 318
	}, 100);
319
    
320
    
319
	    
321 320
});
322 321
	
323 322
$(window).resize(function() {
b/snf-astakos-app/astakos/im/target/shibboleth.py
85 85

  
86 86
    try:
87 87
        eppn = tokens.get(Tokens.SHIB_EPPN)
88

  
88
        eppn = "1234"
89
        tokens[Tokens.SHIB_DISPLAYNAME] = 'Olga Brani'
89 90
        if not eppn:
90 91
            raise KeyError(_(astakos_messages.SHIBBOLETH_MISSING_EPPN))
91 92
        if Tokens.SHIB_DISPLAYNAME in tokens:
b/snf-astakos-app/astakos/im/templates/im/astakosgroup_list.html
1 1
{% extends "im/account_base.html" %}
2

  
2
{% load astakos_tags %}
3 3
{% load filters %}
4 4

  
5 5
{% block page.body %}
......
66 66
    <!-- Search group -->
67 67
    {% if object_list %}
68 68
        <div class="full-dotted">
69
        	{% comment %}
69 70
        	<form method="GET" class="minimal" action="#searchResults"> 
70 71
				<div class="form-row">
71 72
					<select name="sorting" onchange="this.form.submit();" class="dropkicked" tabindex="1">
......
78 79
					<input type="hidden" name="q" value="{{q}}"/>
79 80
				</div>
80 81
			</form>
82
			{% endcomment %}
81 83
            <table class="alt-style complex" id="searchResults">
82 84
                <caption>
83 85
                    {% if q %}SEARCH RESULTS{% else %}ALL PROJECTS{% endif %}
84 86
                </caption>
85 87
                <thead>
86
                  <tr>
87
                    <th>Name</th>
88
                    <!--<th>Type</th>-->
89
                    <th>Start date</th>
90
                    <th>End date</th>
91
                     
92
                    <th>Members</th>
93
                   
94
                     
95
                    <th>Status</th>
96
                    <th>&nbsp;</th>
97
			        <th>Moderated</th>
98
                   <!-- <th>&nbsp;</th>-->
99
                  
100
                  </tr>
101
                </thead>
88
                      <tr>
89
                        <th><a href="?{% if q %}q={{q}}&{% endif %}sorting=groupname&ordering={% if ordering == 'ASC' and sorting == 'groupname' %}DESC{% else %}ASC{% endif %}#allGroups">Name</a></th>
90
                        <!--th>Type</th-->
91
                        <th><a href="?{% if q %}q={{q}}&{% endif %}sorting=issue_date&ordering={% if ordering == 'ASC' and sorting == 'issue_date' %}DESC{% else %}ASC{% endif %}#allGroups">Start date</a></th>
92
                        <th><a href="?{% if q %}q={{q}}&{% endif %}sorting=expiration_date&ordering={% if ordering == 'ASC' %}DESC{% else %}ASC{% endif %}#allGroups">End date</a></th>
93
                        <th><a href="?{% if q %}q={{q}}&{% endif %}sorting=approved_members_num&ordering={% if ordering == 'ASC' %}DESC{% else %}ASC{% endif %}#allGroups">Members</a></th>
94
                        <th><a href="javascript:void(0)">Status</a></th>
95
                        <th>&nbsp;</th>
96
                        <th class="centered"><a href="?{% if q %}q={{q}}&{% endif %}sorting=moderation_enabled&ordering={% if ordering == 'ASC' %}DESC{% else %}ASC{% endif %}#allGroups">Moderated</a></th>
97
                       <!-- <th>&nbsp;</th>-->
98
                        
99
                      </tr>
100
			            </thead>
102 101
                <tbody>
103 102
                  {% for o in object_list %}
104 103
                   <tr class="{% cycle 'tr1' 'tr2' %}">
......
226 225
            {% with q|paginate:args as page_obj %}
227 226
        	 	{% if page_obj.object_list  %}
228 227
	      	    <div>
228
                    {% comment %}
229 229
					<form method="GET" class="minimal" action="#allGroups" id="mygroups">
230 230
						<div class="form-row">
231 231
						    <select name="sorting"  class="dropkicked"  tabindex="1">
......
238 238
							</select>
239 239
						</div>
240 240
					</form>
241
                    {% endcomment %}
241 242
					<table class="alt-style complex" id="allGroups">
242 243
			            <caption>MY PROJECTS</caption>
243 244
			            <thead>
244 245
			              <tr>
245
			                <th>Name</th>
246
			                <th><a href="{% url group_list %}?sorting=groupname&ordering={% if ordering == 'ASC' and sorting == 'groupname' %}DESC{% else %}ASC{% endif %}#allGroups">Name</a></th>
246 247
			                <!--th>Type</th-->
247
			                <th>Start date</th>
248
			                <th>End date</th>
249
			                <th>Members</th>
250
			                <th>Status</th>
248
			                <th><a href="{% url group_list %}?sorting=issue_date&ordering={% if ordering == 'ASC' and sorting == 'issue_date' %}DESC{% else %}ASC{% endif %}#allGroups">Start date</a></th>
249
			                <th><a href="{% url group_list %}?sorting=expiration_date&ordering={% if ordering == 'ASC' %}DESC{% else %}ASC{% endif %}#allGroups">End date</a></th>
250
			                <th><a href="{% url group_list %}?sorting=approved_members_num&ordering={% if ordering == 'ASC' %}DESC{% else %}ASC{% endif %}#allGroups">Members</a></th>
251
			                <th><a href="javascript:void(0)">Status</a></th>
251 252
			                <th>&nbsp;</th>
252
			                <th class="centered">Moderated</th>
253
			                <th class="centered"><a href="{% url group_list %}?sorting=moderation_enabled&ordering={% if ordering == 'ASC' %}DESC{% else %}ASC{% endif %}#allGroups">Moderated</a></th>
253 254
			               <!-- <th>&nbsp;</th>-->
254 255
			                
255 256
			              </tr>
b/snf-astakos-app/astakos/im/views.py
971 971

  
972 972
    # validate sorting
973 973
    sorting = 'groupname'
974
    ordering = ''
974 975
    sort_form = AstakosGroupSortForm(request.GET)
975 976
    if sort_form.is_valid():
976 977
        sorting = sort_form.cleaned_data.get('sorting')
977
    query = query+" ORDER BY %s ASC" %sorting
978
        ordering = request.GET.get('ordering', 'ASC' )
979
        
980
    query = query+" ORDER BY %s %s" %(sorting, ordering)
978 981

  
979 982
    q = AstakosGroup.objects.raw(query)
980 983

  
......
983 986
        q.model._meta.app_label,
984 987
        q.model._meta.object_name.lower()
985 988
    )
989
    
986 990
    extra_context = dict(
987 991
        is_search=False,
988 992
        q=q,
989 993
        sorting=sorting,
990
        page=request.GET.get('page', 1)
994
        page=request.GET.get('page', 1),
995
        ordering=ordering,
991 996
    )
992 997
    return render_response(template_name,
993 998
                           context_instance=get_context(request, extra_context)
......
1103 1108
        form = AstakosGroupSearchForm(get_query(request))
1104 1109
        if form.is_valid():
1105 1110
            q = form.cleaned_data['q'].strip()
1106

  
1111
            
1107 1112
    sorting = 'groupname'
1113
    order_dict = {'ASC':'', 'DESC':'-'  }
1114
    ordering = ''
1115
    sort_order = 'groupname' 
1108 1116
    if q:
1109 1117
        queryset = AstakosGroup.objects.select_related()
1110 1118
        queryset = queryset.filter(~Q(kind__name='default'))
......
1141 1149
                    })
1142 1150

  
1143 1151
        # validate sorting
1152
        
1153
        
1144 1154
        sort_form = AstakosGroupSortForm(request.GET)
1145 1155
        if sort_form.is_valid():
1146 1156
            sorting = sort_form.cleaned_data.get('sorting')
1147
        queryset = queryset.order_by(sorting)
1157
            ordering = request.GET.get('ordering','ASC')
1158
            sort_order = order_dict[ordering]+sorting
1159
        queryset = queryset.order_by(sort_order)
1148 1160

  
1149 1161
    else:
1150 1162
        queryset = AstakosGroup.objects.none()
......
1157 1169
        extra_context=dict(form=form,
1158 1170
                           is_search=True,
1159 1171
                           q=q,
1160
                           sorting=sorting))
1172
                           sorting=sorting,
1173
                           ordering=ordering))
1161 1174

  
1162 1175

  
1163 1176
@require_http_methods(["GET", "POST"])
......
1192 1205

  
1193 1206
    # validate sorting
1194 1207
    sorting = 'groupname'
1208
    order_dict = {'ASC':'', 'DESC':'-'  }
1209
    ordering = ''
1210
    sort_order = 'groupname'
1195 1211
    sort_form = AstakosGroupSortForm(request.GET)
1212
    
1196 1213
    if sort_form.is_valid():
1197 1214
        sorting = sort_form.cleaned_data.get('sorting')
1198
    q = q.order_by(sorting)
1199

  
1215
        ordering = request.GET.get('ordering','ASC')
1216
        sort_order = order_dict[ordering]+sorting
1217
    q = q.order_by(sort_order)
1218
    
1200 1219
    return object_list(
1201 1220
        request,
1202 1221
        q,
......
1205 1224
        template_name='im/astakosgroup_list.html',
1206 1225
        extra_context=dict(form=AstakosGroupSearchForm(),
1207 1226
                           is_search=True,
1208
                           sorting=sorting))
1227
                           sorting=sorting,
1228
                           ordering=ordering))
1209 1229

  
1210 1230

  
1211 1231
#@require_http_methods(["POST"])
......
1471 1491
        template='im/how_it_works.html',
1472 1492
        context_instance=get_context(request),)
1473 1493

  
1494
def test(v):
1495
    res = 'foo'
1496
    return res

Also available in: Unified diff