Revision bdc1c103

b/snf-astakos-app/astakos/im/static/im/css/forms.css
72 72
form.withlabels .checkbox-widget			{ margin-top:20px; }
73 73
form.innerlabels .checkbox-widget +  label	{ position:static; line-height:36px; color:#808080; }
74 74
form.innerlabels .checkbox-widget +  label + a	{ border-bottom:1px solid #F89A1C; font-size: 1.1em; }
75
form span.info								{ position:absolute;z-index:101; bottom:32px;  }
75
form span.info								{ position:absolute;z-index:101; top:10px;  }
76 76
form.innerlabels span.info					{ left: 290px; }
77 77
form.withlabels span.info					{ left:485px;  }
78 78
form span.info em 							{ display:block; overflow:hidden;  position:absolute; left:0; text-indent:-100px; top:0; height:21px; width:21px; background:url(../images/symbols.png) no-repeat -4px -31px;cursor:pointer; }
......
150 150
.form-row .dk_option_current a					{ text-shadow:none; background-color: #E7E7E3; text-decoration:none;}
151 151

  
152 152
form.link-like									{ display:inline-block; margin:0 5px; float:right;}
153
form.link-like input[type="submit"]				{ margin:0; padding:0 5px; background:transparent; color:#F89A1C; cursor:pointer; height:auto;  }
153
form.link-like input[type="submit"]				{ margin:0; padding:0 5px; background:transparent; color:#F89A1C; cursor:pointer; height:auto; line-height:120%;  }
154 154
form.link-like input[type="submit"]:hover		{ text-decoration:underline;  }
155 155
form.link-like.alone							{ float:none; margin:0;}
156 156
form.link-like.alone .form-row					{ margin:0; }
b/snf-astakos-app/astakos/im/static/im/css/modules.css
364 364
table.alt-style tr.tmore2 td					{ background:#fff }
365 365
table.alt-style tr td.info-td					{ padding:5px; }
366 366
table.alt-style tr td.info-td div				{ padding:15px; border:1px dashed #000 }
367
table.alt-style tr td a.more-info				{ display:inline-block;  width:17px; height:16px; background:url(../images/plus-minus.png) no-repeat 0 0; margin-left:10px; }
368
table.alt-style tr td a.more-info:hover			{ background-image:url(../images/plus-minus-hover.png); text-decoration:none;}
369
table.alt-style tr td a.open					{ background-position:-16px 0} 
367
 
370 368

  
371 369
.projects .details a.edit						{ float:right; margin-left:20px;  }
372 370
.projects .details .data						{ overflow:hidden; }
......
376 374
/* quotas-form  */
377 375

  
378 376
.quotas-form fieldset							{ background:url(../images/dots.jpg) repeat-x scroll center bottom transparent; margin-bottom:3em; padding-bottom:3em; position:relative; }
379
.quotas-form fieldset legend					{ color:#55B577; font-size:1.154em; margin-bottom:3em; position:relative; }
380
.quotas-form fieldset legend span				{ color:#222; font-size:0.867em; }
377
.quotas-form legend								{ color:#55B577; font-size:1.154em; margin-bottom:3em; position:relative; }
378
.quotas-form legend span						{ color:#222; font-size:0.867em; }
379
form.quotas-form legend span.info				{ position:relative; display:inline-block; top:auto; left:auto;  margin-left:10px;}
380
form.quotas-form legend span.info em			{ position:static; }
381
form.quotas-form legend span.info span			{ width:395px; }
381 382
.quotas-form .with-checkbox .checkbox-widget	{ margin-top:12px; } 
382
.quotas-form .with-checkbox span.info 			{ bottom:22px; }
383
.quotas-form .with-checkbox span.info 			{ top:15px; }
383 384
.quotas-form .form-row.submit					{ text-align:center; }
384 385
.quotas-form input[type="submit"]				{ margin:15px 0; background-color:#B3B3B3 }
385 386
.quotas-form input[type="submit"]:hover			{ background:#55B577 }
......
407 408
.quotas-form .double-checks .with-checkbox input[type="text"]	{ width:60px; float:left; margin:9px 15px -9px; display:none; padding:6px; }
408 409
.quotas-form .double-checks .with-checkbox label{ width:auto; float:left; margin-left:35px; }
409 410
.quotas-form .double-checks .with-checkbox input[type="text"].hideshow	{ display:block; }
410
form.quotas-form legend span.info				{ top:1px; bottom:auto; left:225px; }
411
form.quotas-form legend span.info span			{ width:395px; }
412 411
.quotas-form .with-checkbox+.with-checkbox		{ width:196px; }
413 412
.summary dl.alt-style dt						{ color:#55B577; }
414 413
.quotas-form .with-info .double-checks p		{ clear:both; }
......
420 419
.quotas-form .quota input[type="text"]			{ width:150px;}
421 420
.quotas-form .quota .error-msg 					{ display:none; color:red; font-size:0.8em; margin:0; margin-left:224px; margin-bottom:5px; padding:5px; }
422 421
.quotas-form .quota .with-errors .error-msg		{ display:block;}	 
422
::-webkit-input-placeholder 					{ color: #D4D4D4; font-style:italic; }
423
:-moz-placeholder 								{ color: #D4D4D4;font-style:italic; }
424

  
423 425
/* stats */
424 426
.stats ul										{ margin:0; padding:0; list-style:none outside none; }
425 427
.stats ul li 									{ margin:0 0 1em 0; padding:0 0 1em 0; list-style:none outside none; background:url(../images/stats-line.jpg) repeat-x left bottom}
......
449 451

  
450 452
/* temp style to hide extra menu for groups */
451 453
.navigation ul+ul								{ display:none; }
454

  
455
table .msg-wrap									{ position:relative; }
456
table .msg-wrap .dialog							{ position:absolute; border:1px dashed #ccc;  padding:15px; width:200px; bottom:30px; left:0; background:#fff; display:none; }
457
table .msg-wrap .dialog .submit					{ min-width:30px; padding:5px 22px; }
458
table .msg-wrap .dialog .no.submit				{ float:right; }
b/snf-astakos-app/astakos/im/static/im/js/common.js
211 211
	$('table .more-info').click(function(e){
212 212
		e.preventDefault();
213 213
		$(this).toggleClass('open');
214
		if ($(this).hasClass('open')){
215
			$(this).html('- less info ')
216
		} else {
217
			$(this).html('+ more info ')
218
		}
214 219
		$(this).parents('tr').next('tr').toggle();
215 220
		 
216 221
	});
......
220 225
		$(this).parents('.details').children('.data').hide();
221 226
		$(this).parents('.details').children('.editable').show();
222 227
		$(this).hide();
223
	})
228
	});
224 229
	
225 230
	
226 231
	$('.widjet-x').click(function(e){
......
228 233
		$(this).siblings('ul').hide('slow');
229 234
		$(this).hide();
230 235
	})
236

  
237
	// todo den doulevei
238
	$('#group_create_form').submit(function(){
239
		if ($('.quotas-form .group .form-row.with-errors').length>0 ){
240
			return false;
241
		}
242
		$('.quotas-form .group .form-row.with-errors')[0].focus();
243
 		
244
	});
231 245
	
232
 
233 246
	
234 247
	
248
	$("input.leave, input.join").click(function () {
249
		$(this).parents('.msg-wrap').find('.dialog').show();
250
		return false;      
251
    });
252
    
253
     $('.msg-wrap .no').click( function(e){
254
		e.preventDefault();
255
		$(this).parents('.dialog').hide();
256
	})
257
    
258
    $('.msg-wrap .yes').click( function(e){
259
		e.preventDefault();
260
		$(this).parents('.dialog').siblings('form').submit();
261
	})
262
    
263
    
235 264
});
236 265
	
237 266
$(window).resize(function() {
b/snf-astakos-app/astakos/im/static/im/js/quotas.js
1
function group_form_show_resources(el){
2
	
3
	el.addClass('selected');
4
	var id = el.attr('id');
5
	$('.quotas-form .group').each(function() {
6
		if( $(this).hasClass(id) ) {
7
			$(this).appendTo('.foo');
8
			$(this).show('slow');
9
			$(this).find('input')[0].focus()
10
		}
11
	});
12
	
13
}
14

  
15

  
16
function bytesToSize2(bytes) {
17
    var sizes = [ 'n/a', 'bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
18
    var i = +Math.floor(Math.log(bytes) / Math.log(1024));
19
    return  (bytes / Math.pow(1024, i)).toFixed( 0 ) + sizes[ isNaN( bytes ) ? 0 : i+1 ];
20
}
21

  
1 22
$(document).ready(function() {
2 23

  
24
	
25
	
26
	// ugly fix to transfer data easily 
27
	$('.with-info input[name^="is_selected_"]').each(function() {
28
		$(this).parents('.form-row').hide();
29
	});
30
    
3 31
	$('.quotas-form ul li a').click(function(e){
4
		$(this).siblings('input[type="hidden"]').val('1');
32
		
33
		// check the hidden input field
34
		$(this).siblings('input[type="hidden"]').attr('checked','checked');
35
		
36
		// get the hidden input field without the proxy
37
		// and check the python form field
38
	 	hidden_name = $(this).siblings('input[type="hidden"]').attr('name').replace("proxy_","");
39
	 	$("input[name='"+hidden_name+"']").attr('checked','checked');  
40
		
41
 		// prevent extra actions if it is checked		 
5 42
		if ( $(this).hasClass('selected')){
6 43
			e.preventDefault();
7
		}
8
		if ( !$(this).hasClass('selected')){
9
			$(this).addClass('selected');
10
			var id = $(this).attr('id');
11
			$('.quotas-form .group').each(function() {
12
				if( $(this).hasClass(id) ) {
13
					$(this).appendTo('.foo');
14
					$(this).show('slow');
15
					$(this).find('input')[0].focus()
16
				}
17
			});
44
		} else {
45
			
46
			// show the relevant fieldsets
47
			group_form_show_resources($(this));
18 48
		}   
19 49
	});
20 50
	
51
	 
52
	
53
	
54
	 
55
	
21 56
	$('.quotas-form .group .delete').click(function(e){
57
		
22 58
		e.preventDefault(); 
59
		
60
		// clear form fields
23 61
		$(this).siblings('fieldset').find('input').val('');
24 62
		
25
		$(this).siblings('fieldset').find('.checkbox-widget.unlimited').addClass('checked');
26
		$(this).siblings('fieldset').find('.checkbox-widget.limited').removeClass('checked');
27
		$(this).siblings('fieldset').find('input[type="checkbox"].limited').removeAttr('checked');  
28
		$(this).siblings('fieldset').find('input[type="checkbox"].unlimited').attr('checked','checked');  
29
		$(this).siblings('fieldset').find('.double-checks input[type="text"]').hide();
63
		// clear errors
64
		$(this).siblings('fieldset').find('.form-row').removeClass('with-errors');
65
		 
66
		// hide relevant fieldset 
30 67
		$(this).parents('.group').hide('slow', function() {
31 68
		    $(this).appendTo('.not-foo');	
32 69
		});
33
		groupClass = $(this).parents('.group').attr('class').replace('group ', '');
70
		
71
		group_class = $(this).parents('.group').attr('class').replace('group ', '');
72
		
73
		// unselect group icon
34 74
		$('.quotas-form ul li a').each(function() {
35
			if($(this).attr('id')==groupClass) {
75
			if($(this).attr('id')==group_class) {
36 76
				$(this).removeClass('selected');
37
				$(this).siblings('input[type="hidden"]').val('0');
77
				$(this).siblings('input[type="hidden"]').removeAttr('checked');
78
				
79
				// get the hidden input field without the proxy
80
				// and check the python form field
81
			 	hidden_name = $(this).siblings('input[type="hidden"]').attr('name').replace("proxy_","");
82
			 	$("input[name='"+hidden_name+"']").removeAttr('checked');  
83
				
38 84
			}
39 85
		}); 
40
		 
41
		 
42
	});
43
	 
44
		
45
	$('.quotas-form input.limited').bind("changed", function(e){
46
		console.log($(this).attr('checked'));
47
		if ($(this).attr('checked')){
48
			$(this).siblings('input[type="text"]').toggle();
49
			$(this).siblings('input[type="text"]').focus();
50
		 	parentdiv = $(this).parents('.form-row').prev('.form-row');
51
		 	parentdiv.find('input[type="checkbox"].unlimited').removeAttr('checked');  
52
		 	parentdiv.find('.checkbox-widget').removeClass('checked');
53
		}
54 86
		
87
		// clear hidden fields
88
		$(this).siblings('fieldset').find('input[type="text"]').each(function() {
89
			hidden_name = $(this).attr('name').replace("_proxy","");
90
	 		hidden_input = $("input[name='"+hidden_name+"']");
91
	 		hidden_input.val('');
92
		});
93
		 
55 94
		 
56 95
	});
57
	
58
	$('.quotas-form input.unlimited').bind("changed", function(e){
59
		parentdiv = $(this).parents('.form-row').next('.form-row');
60
		if (parentdiv.find('.checkbox-widget').hasClass('checked')){
61
			parentdiv.find('.checkbox-widget').removeClass('checked');
62
			parentdiv.find('input[type="checkbox"].limited').removeAttr('checked');  
63
			parentdiv.find('input[type="text"]').val('');	
64
			parentdiv.find('input[type="text"]').hide();	
65
		}
66
		
67
		
68
		
69
	});
70

  
71
    
72
	
73
	 
74
	 
96
	 	 
97
	// if you fill _proxy fields do stuff 
75 98
	$('.quotas-form .quota input[type="text"]').change(function () {
76 99
	 	
77 100
	 	
......
83 106
	 	hidden_name = $(this).attr('name').replace("_proxy","");
84 107
	 	var hidden_input = $("input[name='"+hidden_name+"']");
85 108
	 	
86
	 	
87
	 	if ($(this).hasClass('dehumanize')){
88
	 		
89
	 		var flag = 0;
90
	 		
91
	 		// replace , with .  and get number 
92
		 	value = value.replace(",",".");
93
		 	var num = parseFloat(value);
94
		 	
95
		 	if ( !num ) { flag = 1}
96
		 	
97
		 	var bytes = num;
98
	 		
99
	 		 // get suffix. 'i' renders it case insensitive
100
		 	var suf = value.match( new RegExp('GB|KB|MB|TB|bytes', 'i'));
101
		 	if (suf){
109
	 	if (value) {
110
		 	// actions for humanize fields
111
		 	if ($(this).hasClass('dehumanize')){
112
		 		
113
		 		var flag = 0;
114
		 		
115
		 		// replace , with .  and get number 
116
			 	value = value.replace(",",".");
117
			 	var num = parseFloat(value);
118
			 	
119
			 	if ( value && !num ) { flag = 1}
120
			 	
121
			 	var bytes = num;
102 122
		 		
103
		 		suf = suf[0].toLowerCase(); 
104
		 	
105
			 	// transform to bytes
106
			 	switch (suf){
107
			 		case 'bytes': 
108
			 		  bytes = num*Math.pow(1024,0);
109
			 		  break;
110
			 		case 'byte': 
111
			 		  bytes = num*Math.pow(1024,0);
112
			 		  break;
113
			 		case 'kb':
114
			 		  bytes = num*Math.pow(1024,1);
115
			 		  break;
116
			 		case 'mb':
117
			 		  bytes = num*Math.pow(1024,2);
118
			 		  break;
119
			 		case 'gb':
120
			 		  bytes = num*Math.pow(1024,3);
121
			 		  break;
122
			 		case 'tb':
123
			 		  bytes = num*Math.pow(1024,4);
124
			 		  break;    
125
			 		default:
126
			 		  bytes = num; 
127
		 		}
128
		 	} else {
129
		 		 flag = 1;
123
		 		 // get suffix. 'i' renders it case insensitive
124
			 	var suf = value.match( new RegExp('GB|KB|MB|TB|bytes|G|K|M|T|byte', 'i'));
125
			 	if (suf){
126
			 		
127
			 		suf = suf[0].toLowerCase(); 
128
			 		suf = suf.substr(0,1);
129
			 	
130
				 	// transform to bytes
131
				 	switch (suf){
132
				 		case 'b': 
133
				 		  bytes = num*Math.pow(1024,0);
134
				 		  break;
135
				 		case 'k':
136
				 		  bytes = num*Math.pow(1024,1);
137
				 		  break;
138
				 		case 'm':
139
				 		  bytes = num*Math.pow(1024,2);
140
				 		  break;
141
				 		case 'g':
142
				 		  bytes = num*Math.pow(1024,3);
143
				 		  break;
144
				 		case 't':
145
				 		  bytes = num*Math.pow(1024,4);
146
				 		  break;    
147
				 		default:
148
				 		  bytes = num; 
149
			 		}
150
			 	} else {
151
			 		if (value) {
152
			 		 flag = 1;
153
			 		}
154
			 		 
155
			 	}
156
			 	
157
			 	if ( flag == '1' ){ 
158
			 		$(this).parents('.form-row').addClass('with-errors');
159
			 		bytes = value;
160
			 		$(this).focus();
161
			 		
162
			 		 
163
			 	} else {
164
			 		$(this).parents('.form-row').removeClass('with-errors');
165
			 	}
166
			 	
167
			 	hidden_input.val(bytes);
168
			 	
130 169
		 	}
131
		 	
132
		 	if ( flag == '1' ){ 
133
		 		$(this).parents('.form-row').addClass('with-errors');
134
		 		return;
135
		 		 
136
		 	} else {
137
		 		$(this).parents('.form-row').removeClass('with-errors');
170
		 	 
171
		 	// actions for int fields
172
		 	else {
173
	
174
		 		var is_int = value.match (new RegExp('^[0-9]*$'));
175
		 		if ( !is_int ){ 
176
		 			$(this).parents('.form-row').find('.error-msg').html('Enter a whole number');
177
			 		$(this).parents('.form-row').addClass('with-errors');
178
			 		 
179
			 	} else {
180
			 		if ( value == '0'){
181
			 			$(this).parents('.form-row').find('.error-msg').html('Ensure this value is greater than or equal to 1');
182
			 			$(this).parents('.form-row').addClass('with-errors');
183
			 		}else {
184
			 			$(this).parents('.form-row').removeClass('with-errors');
185
			 		}
186
			 		
187
			 		
188
			 	}
189
			 	hidden_input.val(value);
190
	
138 191
		 	}
139
		 	
140
		 	machine_value = bytes;
141
		 	hidden_input.val(bytes);
142
		 	
192
	 	
143 193
	 	} else {
144

  
145
	 		var is_int = value.match (new RegExp('^[0-9]*$'));
146
	 		if ( !is_int ){ 
147
	 			$(this).parents('.form-row').find('.error-msg').html('Enter a whole number');
148
		 		$(this).parents('.form-row').addClass('with-errors');
149
		 		 
150
		 	} else {
151
		 		$(this).parents('.form-row').removeClass('with-errors');
152
		 		hidden_input.val(value);
153
		 	}
154

  
194
	 		hidden_input.removeAttr('value');
155 195
	 	}
156 196
	 	
157
	 	
158
	 	
159 197
	 });
198
	 
199
	
200
	// if hidden checkboxes are checked, the right group is selected 
201
	$('.with-info input[name^="is_selected_"]').each(function() {
202
		if ($(this).attr('checked')){
203
			
204
			// get hidden input name
205
			hidden_name = $(this).attr('name');
206
			$("input[name='proxy_"+hidden_name+"']").attr('checked','checked'); 
207
			
208
			// pretend to check the ul li a
209
			// show the relevant fieldsets
210
			var mock_a = $("input[name='proxy_"+hidden_name+"']").siblings('a');
211
			group_form_show_resources(mock_a);
212
			 
213
		}
214
	}); 
215
	
216
	
217
	
218
	// if input_uplimit fields are filled,
219
	// fill the _uplimit_proxy ones
220
	 
221
	$('.with-info input[name$="_uplimit"]').each(function() {
222
		if ($(this).val()){
223
			
224
			// get value from input
225
	 		var value = $(this).val();
226
			
227
			
228
			// get hidden input name
229
			hidden_name = $(this).attr('name');
230
			var field = $("input[name='"+hidden_name+"_proxy']"); 
231
			
232
			
233
			if ( (field.hasClass('dehumanize')) && !($(this).parents('.form-row').hasClass('with-errors'))) {
234
				// for dehumanize fields transform bytes to KB, MB, etc
235
				// unless there is an error
236
				field.val(bytesToSize2(value))
237
			} else {
238
				// else just return the value
239
				field.val(value);	
240
			}
241
			
242
			var group_class = field.parents('div[class^="group"]').attr('class').replace('group ', '');
243
			
244
			 
245
			 
246
			
247
			// select group icon
248
			$('.quotas-form ul li a').each(function() {
249
				
250
				if($(this).attr('id') == group_class) {
251
					$(this).addClass('selected');
252
					$(this).siblings('input[type="hidden"]').attr('checked', 'checked');
253
					
254
					// get the hidden input field without the proxy
255
					// and check the python form field
256
				 	hidden_name = $(this).siblings('input[type="hidden"]').attr('name').replace("proxy_","");
257
				 	$("input[name='"+hidden_name+"']").attr('checked', 'checked');  
258
				 	
259
				 	group_form_show_resources($(this));
260
					
261
				}
262
			}); 
263
			
264
		
265
			
266
			// if the field has class error, transfer error to the proxy fields
267
			if ( $(this).parents('.form-row').hasClass('with-errors') ) {
268
				field.parents('.form-row').addClass('with-errors');
269
			}
270
			
271
			 
272
		}
273
	}); 
160 274
	
161 275
});
b/snf-astakos-app/astakos/im/templates/im/astakosgroup_detail.html
53 53
		 <h3>DETAILS:</h3>
54 54
		 <dl class="alt-style">
55 55
		 	<dt>Name</dt>
56
		 	<dd>{{object.name}}&nbsp;</dd>
56
		 	<dd>{{ object.name|strip_http }}&nbsp;</dd>
57 57
		 	<!--<dt>Type</dt>
58 58
		 	<dd>{{object.kindname|capfirst}}&nbsp;</dd>-->
59 59
		 	<dt>Issue date:</dt>
......
81 81
	 </div>
82 82
	 
83 83
     <div class="full-dotted">
84
		 <h3>RESOURCES:</h3>
84
		 <h3>RESOURCES:</h3>		 
85 85
		 {% if quota %}
86 86
		 <dl class="alt-style">
87 87
		 	 
88 88
		 	{% for k in quota|dkeys %}
89
                
90
                <dt>{{ k }}</dt>
91
                <dd>{{ quota|lookup:k }}&nbsp;</dd>
92
                  
89
			 	{% with resource_catalog|lookup:'resources' as resources %}
90
			 		{% with resources|lookup_uni:k as info %}
91
			 		{% with resource_presentation|lookup_uni:k as resource_info %}
92
			 		 
93
						<dt>
94
	           				Max {% if resource_info.is_abbreviation %}{{ info.resource|upper }}{% else %}{{ r.resource }}{% endif %}{% if not info.unit %}s {% endif  %}  per user
95
	           			</dt>		                
96
						<dd>
97
						{% with quota|lookup:k as uplimit%}	
98
		           			 {% if uplimit == "inf" %}
99
		           			 	unlimited
100
		           			 {% else %}
101
		           			 	{{ uplimit }}
102
		           			 {% endif %}
103
		           			 
104
	           			{% endwith%}
105
	           			</dd>
106
	           		 
107
	                {% endwith%}
108
	                {% endwith %}
109
                {% endwith %}
93 110
            {% endfor %}
94 111
		</dl>
95 112
		{% else %}
b/snf-astakos-app/astakos/im/templates/im/astakosgroup_form.html
8 8
{% block page.body %}
9 9
 
10 10
	
11
<form action="" method="post" class="withlabels quotas-form">{% csrf_token %}
11
<form action="" method="post" class="withlabels quotas-form" id="group_create_form">{% csrf_token %}
12 12
	 
13 13
    <fieldset class="with-info">
14 14
    	<legend>
......
25 25
    
26 26
    <fieldset id="icons">
27 27
    	<legend>
28
    		2. CHOOSE RESOURCES
28
    		2. ADD RESOURCES
29 29
    		<span class="info"> 
30 30
		    	<em>more info</em>
31 31
		    	<span>Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text Help Text</span>
......
39 39
            {% with resource_presentation|lookup:g as group_info %} 		
40 40
    		<li>
41 41
    			<a href="#{{ g }}" id="{{'group_'|add:g}}"><img src="/static/im/images/create-{{ g }}.png" alt="vm"/></a>
42
    			<input type="hidden" name="{{ 'is_selected_'|add:g }}"  id="{{ 'id_is_selected_'|add:g }}" value="0">
42
    			<input type="hidden" name="proxy_{{ 'is_selected_'|add:g }}"  id="proxy_{{ 'id_is_selected_'|add:g }}">
43 43
    			<p class="msg">{{ group_info.help_text }}</p>
44 44
    		</li>
45 45
    		{% endwith %}
......
83 83
		    	
84 84
		    	<div class="form-row">
85 85
		    		<p class="clearfix">
86
		    			<label for="num_storage">
86
		    			<label for="{{'id_'|add:r|add:'_uplimit'}}_proxy" >
87 87
							Max {% if resource_info.is_abbreviation %}{{ r|get_value_after_dot|upper }}{% else %}{{ r|get_value_after_dot }}{% endif %}{% if not resource.unit %}s {% endif  %} per user
88 88
						</label>
89 89
		    			<input 	type="text" 
b/snf-astakos-app/astakos/im/templates/im/astakosgroup_form_summary.html
6 6
 
7 7
{% with form.data as data %}	 	
8 8
<div class="projects summary">
9
	<h2>CONFIRM YOUR REQUEST</h2>
10
	<p>Lorem ipsum</p>
9
	 
11 10
	<form action="{% url group_add_complete %}" method="post" class="quotas-form">{% csrf_token %}
11
		<legend>3. CONFIRM YOUR REQUEST</legend>
12 12
<!-- 
13 13
 		{% for k,v in data.iteritems %}
14 14
 			<input type="hidden" name="{{ k }}" value="{{ v }}">
......
16 16
 -->
17 17
        {% include "im/form_render.html" %}
18 18
		
19
		<p>{{ data.desc|safe }}</p>
20
		<dl class="alt-style">			    
21
			<dt>Homepage Url</dt>
22
			<dd>{{ data.homepage }}&nbsp;</dd>
23
		</dl>
24
		
19 25
		<div class="full-dotted">
20 26
			 <h3>DETAILS:</h3>
21 27
			 <dl class="alt-style">			    
22 28
			    <dt>Name</dt>
23 29
			 	<dd>{{ data.name|strip_http }}&nbsp;</dd>
24
			 	<dt>Homepage Url</dt>
25
			 	<dd>{{ data.homepage }}&nbsp;</dd>
26
			 	<dt>Description</dt>
27
			 	<dd>{{ data.desc }}</dd>
28 30
			 	<!--<dt>Type</dt>
29 31
			 	<dd>Course&nbsp;</dd>-->
30 32
			 	<dt>Issue date:</dt>
......
51 53
	           			
52 54
	           			<dd>
53 55
	           			{% if r.uplimit %}
54
	           				{{ r.uplimit|sizeof_fmt }} {% if info.unit %} ({{ info.unit}}){% endif %}
56
	           				 {% if info.unit %}
57
	           				 	{{ r.uplimit|sizeof_fmt }}
58
	           				 {% else %}
59
	           				 	{{ r.uplimit }}
60
	           				 {% endif %}
55 61
	           			{% else %}
56 62
	           				Unlimited
57 63
	           			{% endif %}
b/snf-astakos-app/astakos/im/templates/im/astakosgroup_list.html
24 24
    
25 25
		<p>Okeanos grants resources according to activities organized by groups.
26 26
		   Join or create a group to get access to more resources.
27
		   <br>
28 27
		   <a href="{% url group_search %}">Join an existing one</a>
29 28
		   or
30 29
		   <!--<a href="{% url group_create_list %}">Create a new group</a>-->
......
69 68
					<select name="sorting" onchange="this.form.submit();">
70 69
					    <option value="">Sort by</option>
71 70
					    <option value="groupname" {% if sorting == 'groupname' %}selected{% endif %}>Name</option>
72
			            <option value="kindname" {% if sorting == 'kindname' %}selected{% endif %}>Type</option>			
71
			            <!--option value="kindname" {% if sorting == 'kindname' %}selected{% endif %}>Type</option-->			
73 72
			            <option value="issue_date" {% if sorting == 'issue_date' %}selected{% endif %}>Issue date</option>			
74 73
			            <option value="expiration_date" {% if sorting == 'expiration_date' %}selected{% endif %}>Expiration Date</option>
75 74
			            <option value="approved_members_num" {% if sorting == 'approved_members_num' %}selected{% endif %}>Participants</option> 
......
84 83
                <thead>
85 84
                  <tr>
86 85
                    <th>Name</th>
87
                    <th>Type</th>
86
                    <!--<th>Type</th>-->
88 87
                    <th>Issued</th>
89 88
                    <th>Expires</th>
90 89
                     
91 90
                    <th>Enrolled</th>
92 91
                   
93 92
                     
94
                    <th>Enrollment status</th>
93
                    <th>Status</th>
95 94
                    <th>&nbsp;</th>
96 95
                  
97 96
                  </tr>
98 97
                </thead>
99 98
                <tbody>
100 99
                  {% for o in object_list %}
101
                    <tr class="{% cycle 'tr1' 'tr2' %}">
102
                    <td><a href="{% url group_detail o.id %}" title="visit group page">{{o.groupname|rcut:"/"}}</a></td>
103
                    <td>{{o.kindname|capfirst}}</td>
104
                    <td>{{o.issue_date|date:"d/m/Y"}}</td>
105
                    <td>{{o.expiration_date|date:"d/m/Y"}}</td>
106
                    <td>{{o.approved_members_num}}</td>
107
                    
108
                    <td>
109
                    {% if o.is_member %}
110
                        {% if o.membership_approval_date %}
111
    
112
                        Registered
113
                        {% if not o.is_owner %}
114
                            <form action="{% url group_leave o.id %}" method="post" class="link-like">{% csrf_token %}
115
                                 <input type="submit"  value="LEAVE GROUP" />
116
                            </form>
117
                        {% endif %}
118
                        
119
                            
120

  
121
                        {% else %}
122
                            Pending
123
                        {% endif %}
124
                    {% else %}
125
                            Not member 
126
                                <form action="{% url group_join o.id %}" method="post" class="link-like">{% csrf_token %}
127
                                    <input type="submit"   value="JOIN GROUP" class="join_group" />
128
                                </form>
129
                            
130
                    {% endif %}
131
                    </td>
132
                    <td><a href="#" class="more-info" title="more info">&nbsp;</a></td>
100
                   <tr class="{% cycle 'tr1' 'tr2' %}">
101
	                    <td><a href="{% url group_detail o.id %}" title="visit group page">{{o.groupname|rcut:"/"}}</a></td>
102
	                    <!--td>{{o.kindname|capfirst}}</td-->
103
	                    <td>{{o.issue_date|date:"d/m/Y"}}</td>
104
	                    <td>{{o.expiration_date|date:"d/m/Y"}}</td>
105
	                    <td>{{o.approved_members_num}}</td>
106
	                    
107
	                    <td>
108
	                    	<div class="msg-wrap">
109
	                    		 
110
		                    {% if o.is_member %}
111
		                        {% if o.membership_approval_date %}
112
		    
113
		                        
114
			                       	{% if not o.is_owner %}
115
			                            Registered
116
			                            <form action="{% url group_leave o.id %}" method="post" class="link-like">{% csrf_token %}
117
			                                 <input type="submit"  value="x leave group" class="leave"/>
118
			                            </form>
119
			                            <div class="dialog">
120
					                		Are you sure you what to leave this group?<br>
121
					                		Name: <a  href="{% url group_detail o.id %}" title="visit group page">{{o.groupname|rcut:"/" }}</a><br>
122
					                		{% if o.desc %}Description:{{o.desc|truncatewords:30}}{% endif %}<br><br>
123
					                		
124
					                		<a href="#" class="yes submit">Yes</a>&nbsp;&nbsp;&nbsp;<a href="#" class="no submit">No</a>
125
					                	</div>
126
			                        {% else %}
127
			                        	Owner
128
			                        {% endif %}
129
		                        
130
		                            
131
		
132
		                        {% else %}
133
		                            Pending
134
		                        {% endif %}
135
		                    {% else %}
136
		                            Not member 
137
		                                <form action="{% url group_join o.id %}" method="post" class="link-like">{% csrf_token %}
138
		                                    <input type="submit"   value="+ join group" class="join_group join" />
139
		                                </form>
140
		                                <div class="dialog">
141
					                		Are you sure you what to join this group?<br>
142
					                		Name: <a  href="{% url group_detail o.id %}" title="visit group page">{{o.groupname|rcut:"/" }}</a><br>
143
					                		{% if o.desc %}Description:{{o.desc|truncatewords:30}}{% endif %}<br><br>
144
					                		
145
					                		<a href="#" class="yes submit">Yes</a>&nbsp;&nbsp;&nbsp;<a href="#" class="no submit">No</a>
146
					                	</div>
147
		                            
148
		                    {% endif %}
149
	                    	</div>
150
	                    </td>
151
	                    <td><a href="#" class="more-info" title="more info">+ more info</a></td>
133 152
                  </tr>
134 153
                  <tr class="{% cycle 'tmore1' 'tmore2' %}" style="display:none">
135 154
                    <td colspan="7" class="info-td">
......
167 186
	   </div>
168 187
      <!-- Group listing -->
169 188
       {% else %}
170
            {{ q }}
189
       		{% if not form %}
171 190
            {% with page|concat:sorting as args %}
172 191
            {% with q|paginate:args as page_obj %}
173 192
        	 
174 193
	      	    <div >
175 194
					<form method="GET" class="minimal" action="#allGroups">
176 195
						<div class="form-row">
177
						    <select name="all_sorting" onchange="this.form.submit();">
196
						    <select name="sorting" onchange="this.form.submit();">
178 197
							    <option value="">Sort by</option>
179
							    <option value="groupname" {% if all_sorting == 'groupname' %}selected{% endif %}>Name</option>
180
					            <option value="kindname" {% if all_sorting == 'kindname' %}selected{% endif %}>Type</option>			
181
					            <option value="issue_date" {% if all_sorting == 'issue_date' %}selected{% endif %}>Issue date</option>			
182
					            <option value="expiration_date" {% if all_sorting == 'expiration_date' %}selected{% endif %}>Expiration Date</option>
183
					            <option value="approved_members_num" {% if all_sorting == 'approved_members_num' %}selected{% endif %}>Participants</option>
184
					            <option value="is_enabled" {% if all_sorting == 'is_enabled' %}selected{% endif %}>Status</option>
185
					            <option value="moderation_enabled" {% if all_sorting == 'moderation_enabled' %}selected{% endif %}>Moderation</option>		
198
							    <option value="groupname" {% if sorting == 'groupname' %}selected{% endif %}>Name</option>
199
					            <!--<option value="kindname" {% if sorting == 'kindname' %}selected{% endif %}>Type</option>-->			
200
					            <option value="issue_date" {% if sorting == 'issue_date' %}selected{% endif %}>Issue date</option>			
201
					            <option value="expiration_date" {% if sorting == 'expiration_date' %}selected{% endif %}>Expiration Date</option>
202
					            <option value="approved_members_num" {% if sorting == 'approved_members_num' %}selected{% endif %}>Participants</option>
203
					            <option value="is_enabled" {% if sorting == 'is_enabled' %}selected{% endif %}>Status</option>
204
					            <option value="moderation_enabled" {% if sorting == 'moderation_enabled' %}selected{% endif %}>Moderation</option>		
186 205
							</select>
187 206
						</div>
188 207
					</form>
......
191 210
			            <thead>
192 211
			              <tr>
193 212
			                <th>Name</th>
194
			                <th>Type</th>
213
			                <!--th>Type</th-->
195 214
			                <th>Issued</th>
196 215
			                <th>Expires</th>
197 216
			                <th>Enrolled</th>
......
205 224
			              {% for o in page_obj.object_list %}
206 225
			              <tr class="{% cycle 'tr1' 'tr2' %}">
207 226
			                <td><a  href="{% url group_detail o.id %}" title="visit group page">{{o.groupname|rcut:"/" }}</a></td>
208
			                <td>{{o.kindname|capfirst}}</td>
227
			                <!--td>{{o.kindname|capfirst}}</td-->
209 228
			                <td>{{o.issue_date|date:"d/m/Y"}}</td>
210 229
			                <td>{{o.expiration_date|date:"d/m/Y"}}</td>
211 230
			                <td>{{ o.approved_members_num }}</td>
212 231
			                <td>
213
			                	{% if o.is_enabled %}Active{% else %}Pending{% endif %}
232
			                	<div class="msg-wrap">
233
			                 	{% if user.email = o.groupowner %}
234
			                		{% if o.is_enabled %}
235
			                			Owner
236
			                		{% else %}
237
			                			Pending
238
			                		{% endif %}
239
			                	{% else %}
240
			                		{% if o.is_enabled %}
241
			                			{% if o.membership_status %}
242
						                    Registered
243
					                    	<form action="{% url group_leave o.id %}" method="post" class="link-like">{% csrf_token %}
244
					                             <input type="submit"  value="x leave" class="leave" />
245
					                        </form>	
246
					                        <div class="dialog">
247
						                		Are you sure you what to leave this group?<br>
248
						                		Name: <a  href="{% url group_detail o.id %}" title="visit group page">{{o.groupname|rcut:"/" }}</a><br>
249
						                		{% if o.desc %}Description:{{o.desc|truncatewords:30}}{% endif %}<br><br>
250
						                		
251
						                		<a href="#" class="yes submit">Yes</a>&nbsp;&nbsp;&nbsp;<a href="#" class="no submit">No</a>
252
						                	</div>
253
						                {% else %}
254
						                    Pending
255
						                {% endif %}
256
			                		{% else %}
257
			                			-
258
			                		{% endif %}
259
			                	{% endif %}
260
			                	
261
			                	</div>
214 262
			                </td>
215 263
			                <td>{% if o.moderation_enabled%}Yes{% else %}No{% endif %}</td>
216
			                <td><a href="#" class="more-info" title="more info">+ more</a></td>
264
			                <td><a href="#" class="more-info" title="more info">+ more info </a></td>
217 265
			              </tr>
218 266
			              <tr class="{% cycle 'tmore1' 'tmore2' %}" style="display:none">
219 267
			                <td colspan="8" class="info-td">
......
248 296
		 
249 297
        	{% endwith %} 
250 298
	      	{% endwith %} 
251
	      	
252
            {% if q %}
253
                <h2>No groups found!</h2>
254
            {% endif %}
299
	      	{% endif %}
300
	      	{% if form %}
301
	            {% if q %}
302
	                <h2>No groups found!</h2>
303
	            {% endif %}
304
	        {% endif %}
255 305
      {% endif %}
256 306
    {% endwith %}
257 307
</div>
258
</div>
308
</div>  
259 309
{% endblock %}
b/snf-astakos-app/astakos/im/templates/im/resource_list.html
5 5
{% block page.body %}
6 6
<div class="maincol {% block innerpage.class %}{% endblock %}">
7 7
    <div class="stats clearfix">
8

  
9 8
		<ul>
10 9
			{% for r in data %}
11 10
			{% with resource_presentation|lookup:r.name as resource_info %}
b/snf-astakos-app/astakos/im/templatetags/filters.py
78 78
def lookup(d, key):
79 79
    return d.get(key)
80 80

  
81
@register.filter
82
def lookup_uni(d, key):
83
    return d.get(unicode(key))
84

  
81 85

  
82 86
@register.filter
83 87
def dkeys(d):
......
102 106

  
103 107
@register.filter
104 108
def paginate(l, args):
109
   l = l or []
105 110
   page, delim, sorting = args.partition(DELIM)
106 111
   if sorting:
107 112
       if isinstance(l, QuerySet):
......
156 161

  
157 162

  
158 163
from math import log
159
unit_list = zip(['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'], [0, 0, 1, 2, 2, 2])
164
unit_list = zip(['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'], [0, 0, 0, 0, 0, 0])
160 165

  
161 166
@register.filter
162 167
def sizeof_fmt(num):
b/snf-astakos-app/astakos/im/views.py
696 696
            'help_text':'resource cyclades.disksize help text',
697 697
            'is_abbreviation':False,
698 698
            'report_desc':'Disksize',
699
            'placeholder':'eg. 5GB'
699
            'placeholder':'eg. 5GB, 2GB etc'
700 700
        },
701 701
        'cyclades.disk': {
702 702
            'help_text':'resource cyclades.disk help text',
703 703
            'is_abbreviation':False,
704 704
            'report_desc':'Disk',
705
            'placeholder':'eg. 5GB'    
705
            'placeholder':'eg. 5GB, 2GB etc'
706 706
        },
707 707
        'cyclades.ram': {
708 708
            'help_text':'resource cyclades.ram help text',
......
958 958
        if form.is_valid():
959 959
            sorting = form.cleaned_data.get('sort_by')
960 960

  
961
    result = callpoint.list_resources()
962
    resource_catalog = {'resources':defaultdict(defaultdict),
963
                        'groups':defaultdict(list)}
964
    if result.is_success:
965
        for r in result.data:
966
            service = r.get('service', '')
967
            name = r.get('name', '')
968
            group = r.get('group', '')
969
            unit = r.get('unit', '')
970
            fullname = '%s%s%s' % (service, RESOURCE_SEPARATOR, name)
971
            resource_catalog['resources'][fullname] = dict(unit=unit)
972
            resource_catalog['groups'][group].append(fullname)
973
        
974
        resource_catalog = dict(resource_catalog)
975
        for k, v in resource_catalog.iteritems():
976
            resource_catalog[k] = dict(v)
977
    
978
    print '####', resource_catalog, obj.quota
961 979
    extra_context = {'update_form': update_form,
962 980
                     'addmembers_form': addmembers_form,
963 981
                     'page': request.GET.get('page', 1),
964
                     'sorting': sorting}
982
                     'sorting': sorting,
983
                     'resource_catalog':resource_catalog,
984
                     'resource_presentation':resource_presentation,}
965 985
    for key, value in extra_context.items():
966 986
        if callable(value):
967 987
            c[key] = value()
......
977 997
@signed_terms_required
978 998
@login_required
979 999
def group_search(request, extra_context=None, **kwargs):
1000
    print '###', request
980 1001
    q = request.GET.get('q')
981 1002
    sorting = request.GET.get('sorting')
982 1003
    if request.method == 'GET':
......
1011 1032
                    SELECT id FROM im_astakosuser_owner
1012 1033
                    WHERE astakosgroup_id = im_astakosgroup.group_ptr_id
1013 1034
                    AND astakosuser_id = %s)
1014
                    THEN 1 ELSE 0 END""" % request.user.id})
1035
                    THEN 1 ELSE 0 END""" % request.user.id,
1036
                    'is_owner': """SELECT CASE WHEN EXISTS(
1037
                        SELECT id FROM im_astakosuser_owner
1038
                        WHERE astakosgroup_id = im_astakosgroup.group_ptr_id
1039
                        AND astakosuser_id = %s)
1040
                        THEN 1 ELSE 0 END""" % request.user.id, 
1041
                    })
1015 1042
        if sorting:
1016 1043
            # TODO check sorting value
1017 1044
            queryset = queryset.order_by(sorting)
......
1051 1078
                    SELECT date_joined FROM im_membership
1052 1079
                    WHERE group_id = im_astakosgroup.group_ptr_id
1053 1080
                    AND person_id = %s)
1054
                    THEN 1 ELSE 0 END""" % request.user.id})
1081
                    THEN 1 ELSE 0 END""" % request.user.id,
1082
                 'is_owner': """SELECT CASE WHEN EXISTS(
1083
                        SELECT id FROM im_astakosuser_owner
1084
                        WHERE astakosgroup_id = im_astakosgroup.group_ptr_id
1085
                        AND astakosuser_id = %s)
1086
                        THEN 1 ELSE 0 END""" % request.user.id,   })
1055 1087
    sorting = request.GET.get('sorting')
1056 1088
    if sorting:
1057 1089
        # TODO check sorting value

Also available in: Unified diff