project_view.tpl 15.2 KB
Newer Older
Penom Nom's avatar
Penom Nom committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{*
Copyright (C) 2009 INRA
 
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*}

<div id="user_information_dialog" title=""></div>
<div id="error_dialog" title=""></div>
Jerome Mariette's avatar
Jerome Mariette committed
20

Jerome Mariette's avatar
Jerome Mariette committed
21
<input type="hidden" id="server_name" value="{$server_name}" />
Jerome Mariette's avatar
Jerome Mariette committed
22
<input type="hidden" id="from_email" value="{$from_email}" />
23
<input type="hidden" id="user_id" value="{$user_id}" />
Jerome Mariette's avatar
Jerome Mariette committed
24
<input type="hidden" id="pid" value="{$pid}" />
Penom Nom's avatar
Penom Nom committed
25
26
27
28
29
<input type="hidden" id="data_folder" value="{$data_folder}" />
<input type="hidden" id="view" value="project" />
<input type="hidden" id="ids" value="{$project_ids}" />

{* If no project can be displayed *}
Jerome Mariette's avatar
Jerome Mariette committed
30
{if $projects|@count == 0 || ($projects|@count == 1 && $projects[key($projects)].hidden == 1 && !$projects[key($projects)].is_admin)}
Jerome Mariette's avatar
Jerome Mariette committed
31
	Sorry no results to display
Jerome Mariette's avatar
Jerome Mariette committed
32

Penom Nom's avatar
Penom Nom committed
33
34
{* If a single project has to be displayed *}
{elseif $projects|@count == 1}
Jerome Mariette's avatar
Jerome Mariette committed
35
36
37
	
	<input type="hidden" id="is_project_admin" value="{$projects[key($projects)].is_admin}" />
	
Penom Nom's avatar
Penom Nom committed
38
	<div class="project">
philippe's avatar
philippe committed
39
		<h2> {$projects[key($projects)].name}<small> Project </small></h2>
Jerome Mariette's avatar
Jerome Mariette committed
40
		<p><strong>{$projects[key($projects)].description}</strong> <br />
Jerome Mariette's avatar
Jerome Mariette committed
41
		{$project_runs|@count} run(s) and {$project_analysis|@count} analyse(s) have been done on the run {$projects[key($projects)].name}.		
Penom Nom's avatar
Penom Nom committed
42
43
		<br />
		{assign var="project_size" value="<span id='size' class='tx-nG6-mini-wait'></span>"}
Jerome Mariette's avatar
Jerome Mariette committed
44
		Raw data and analysis results use <strong>{$project_size}</strong> on the hard drive for the whole project.		
Penom Nom's avatar
Penom Nom committed
45
46
47
		</p>
	</div>
	<br />
Jerome Mariette's avatar
Jerome Mariette committed
48
		
Jerome Mariette's avatar
Jerome Mariette committed
49
	<ul id="myTab" class="nav nav-tabs">
Jerome Mariette's avatar
Jerome Mariette committed
50
51
		<li class="active"><a href="#runs" data-toggle="tab">Runs</a></li>
 		<li><a href="#analyses" data-toggle="tab">Analyses</a></li>
Jerome Mariette's avatar
Jerome Mariette committed
52
 		{if $login_user}
Jerome Mariette's avatar
Jerome Mariette committed
53
 			<li><a href="#users" data-toggle="tab">Users</a></li>
Jerome Mariette's avatar
Jerome Mariette committed
54
55
 		{/if}
	</ul>
Jerome Mariette's avatar
Jerome Mariette committed
56
	
Jerome Mariette's avatar
Jerome Mariette committed
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
 	<div id="myTabContent" class="tab-content">
 		<div class="tab-pane fade in active" id="runs">
 			{* Find out if the current user is super user of a run *}
			{if $projects[key($projects)].is_admin}
				{assign var="is_at_least_admin_of_1_run" value=true}
			{else}
				{assign var="is_at_least_admin_of_1_run" value=false}
			{/if}
			
			{assign var="runs" value=$project_runs}
			{include file='run_table.tpl'}
		</div>
		
		<div class="tab-pane fade" id="analyses">
			{* Find out if an analysis table should be displayed *}
			{assign var="display_analysis_result" value=false}
			{foreach from=$h_project_analysis key=analysis_id item=analysis_values}
				{if $analysis_values.is_admin && $analysis_values.hidden == 1}
					{assign var="display_analysis_result" value=true}
				{elseif $analysis_values.hidden == 0}
					{assign var="display_analysis_result" value=true}
				{/if}
			{/foreach}
philippe's avatar
philippe committed
80
			<table class="table table-striped table-bordered dataTable" id="analysis_data_table">
Jerome Mariette's avatar
Jerome Mariette committed
81
82
83
84
85
				<thead>
					<tr>
						{if $projects[key($projects)].is_admin && $login_user && $display_analysis_result}
						<th><center><input type="checkbox" id="chk_all_analysis"></center></th>
						{/if}
Jerome Mariette's avatar
Jerome Mariette committed
86
87
88
89
						<th nowrap>Name</th>
						<th>Description</th>
						<th>Sofware</th>
						<th>Version</th>
Jerome Mariette's avatar
Jerome Mariette committed
90
91
92
93
94
					</tr>
				</thead>
				<tbody>
					{include file="recursive_list_analysis_display.tpl" element=$h_project_analysis prof=0}
				</tbody>
Jerome Mariette's avatar
Jerome Mariette committed
95
				{if $projects[key($projects)].is_admin && $login_user && $display_analysis_result}
Jerome Mariette's avatar
Jerome Mariette committed
96
97
98
					<tfoot>
						<tr>
							<th align="left" colspan="5">
Jerome Mariette's avatar
Jerome Mariette committed
99
								With selection :
philippe's avatar
philippe committed
100
101
102
103
104
								<div  class="btn-group">
									<button id="hide_analysis" type="button" class="btn btn-small"><i class=" icon-eye-close"></i> hide</button>
									<button id="unhide_analysis" type="button" class="btn btn-small"><i class="icon-eye-open"></i> unhide</button>
								</div>
								<button id="delete_analysis" type="button" class="btn btn-small"><i class="icon-remove"></i> delete</button>
Jerome Mariette's avatar
Jerome Mariette committed
105
106
107
							</th>
						</tr>
					</tfoot>
Jerome Mariette's avatar
Jerome Mariette committed
108
				{/if}
Jerome Mariette's avatar
Jerome Mariette committed
109
110
			</table>
		</div>
Jerome Mariette's avatar
Jerome Mariette committed
111
		
Jerome Mariette's avatar
Jerome Mariette committed
112
113
114
115
116
117
118
119
120
121
122
123
		{if $login_user}
		<div class="tab-pane fade" id="users">
			{* Find out if the current user needs comboboxes *}
			{assign var="needs_action" value=false}
			{foreach from=$project_users key=c_user_id item=user_values}
				{if $projects[key($projects)].is_admin && $user_values.id!=$user_id}
					{assign var="needs_action" value=true}
				{elseif $projects[key($projects)].is_manager && $user_values.id!=$user_id && $user_values.right_id!='2'}
					{assign var="needs_action" value=true}
				{/if}
			{/foreach}
			<input type="hidden" id="current_project_id" value="{$projects[key($projects)].id}" />
Jerome Mariette's avatar
Jerome Mariette committed
124
125
			<p>
			{if $projects[key($projects)].is_admin}
Jerome Mariette's avatar
Jerome Mariette committed
126
				In the table below are listed all users with an access to the project.
Jerome Mariette's avatar
Jerome Mariette committed
127
			{elseif $projects[key($projects)].is_manager}
Jerome Mariette's avatar
Jerome Mariette committed
128
				In the table below are listed all users with an access to the project, the administrator is the user who had run the pipeline. As a manager, you are in charge of managing access to the project. To manage users access, you can use the add and the delete buttons on the bottom of the table. The add button will display a form so you can seek for a user or add a brand new one. 2 access levels are available: the manager who has the right to create new users and to modify users' information he had created, and member who has only the right to browse the project.
Jerome Mariette's avatar
Jerome Mariette committed
129
			{elseif $projects[key($projects)].is_member}
Jerome Mariette's avatar
Jerome Mariette committed
130
				In the table below are listed all users with an access to the project, the administrator is the user who had run the pipeline and the manager is the user in charge of managing access to the project. As a project member you can browse all the data related to the project. For further information, send an email to the project manager(s).
Jerome Mariette's avatar
Jerome Mariette committed
131
132
			{/if}
			</p>
philippe's avatar
philippe committed
133
			<table class="table table-striped table-bordered dataTable" id="users_data_table">
Jerome Mariette's avatar
Jerome Mariette committed
134
135
136
137
				<thead>
					<tr>
						{if $needs_action}
							<th><center><input type="checkbox" id="chk_all_user"></center></th>
Jerome Mariette's avatar
Jerome Mariette committed
138
						{/if}
Jerome Mariette's avatar
Jerome Mariette committed
139
140
141
142
143
144
145
						<th nowrap>Login</th>
						<th>Last login</th>
						<th>Creator</th>
						<th>Last name</th>
						<th>First name</th>
						<th>Email</th>
						<th>Right</th>
Jerome Mariette's avatar
Jerome Mariette committed
146
147
148
149
150
151
152
153
154
					</tr>
				</thead>
				<tbody> 
					{foreach from=$project_users key=c_user_id item=user_values}
		
						{* highlight user personnal line *}
						{assign var="emphasis" value=""}
						{if $user_values.id==$user_id}
							{assign var="emphasis" value="tx-nG6-pi1-line-emphasis"}
Jerome Mariette's avatar
Jerome Mariette committed
155
						{/if}
Jerome Mariette's avatar
Jerome Mariette committed
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
					
						<tr id="tr_user_{$user_values.id}" class="{$emphasis}">
							
							{if ($projects[key($projects)].is_admin && $user_values.id!=$user_id) 
								|| ($projects[key($projects)].is_manager && $user_values.id!=$user_id && $user_values.right_id!='2')}
								<td><center><input type="checkbox" id="chk_user_{$user_values.id}" value="user_{$user_values.id}" /></center></td>
							{elseif $needs_action}
								<td></td>
							{/if}
							
							<td>{$user_values.username}</td>
							<td>{$user_values.lastlogin}</td>
							<td>{$user_values.cruser_name}</td>
							
							{if $user_values.id==$user_id || $user_values.cruser_id==$user_id }
171
172
173
174
175
176
177
178
179
								<td class="editable"> 
									<span class="editable" data-type="text" data-pk="{$user_id}" data-url="index.php?eID=tx_nG6&type=update_db_field&table=fe_users&field=last_name" data-original-title="Last name">{$user_values.last_name}</span>
								</td>
								<td class="editable"> 
									<span class="editable" data-type="text" data-pk="{$user_id}" data-url="index.php?eID=tx_nG6&type=update_db_field&table=fe_users&field=first_name" data-original-title="First name">{$user_values.first_name}</span>
								</td>
								<td class="editable"> 
									<span class="editable" data-type="text" data-pk="{$user_id}" data-url="index.php?eID=tx_nG6&type=update_db_field&table=fe_users&field=email" data-original-title="Email">{$user_values.email}</span>
								</td>
Jerome Mariette's avatar
Jerome Mariette committed
180
							{else}
Jerome Mariette's avatar
Jerome Mariette committed
181
182
183
184
185
186
								<td>{$user_values.last_name}</td>
								<td>{$user_values.first_name}</td>
								<td>{$user_values.email}</td>
							{/if}
							
							<td>
Jerome Mariette's avatar
Jerome Mariette committed
187
								{if $user_values.right_id=='2' && !$projects[key($projects)].is_admin}
Jerome Mariette's avatar
Jerome Mariette committed
188
									<select id="cbb_right_level_{$user_values.id}" name="right_level" disabled>
Jerome Mariette's avatar
Jerome Mariette committed
189
										<option value="2" selected="selected">Administrator</option>
Jerome Mariette's avatar
Jerome Mariette committed
190
									</select>
Jerome Mariette's avatar
Jerome Mariette committed
191
								{else}
Jerome Mariette's avatar
Jerome Mariette committed
192
193
									{if ($projects[key($projects)].is_admin && $user_values.id!=$user_id) 
										|| ($projects[key($projects)].is_manager && $user_values.id!=$user_id && $user_values.right_id!='2')}
Jerome Mariette's avatar
Jerome Mariette committed
194
195
196
197
198
										{assign var="disabled" value=""}
									{else}
										{assign var="disabled" value="disabled"}
									{/if}
									<select id="cbb_right_level_{$user_values.id}" name="right_level" {$disabled}>
Jerome Mariette's avatar
Jerome Mariette committed
199
										{if $projects[key($projects)].is_admin}
Jerome Mariette's avatar
Jerome Mariette committed
200
											<option value="2" selected="selected">Administrator</option>
Jerome Mariette's avatar
Jerome Mariette committed
201
202
										{/if}
									
Jerome Mariette's avatar
Jerome Mariette committed
203
										{if $user_values.right_id=='1'}
Jerome Mariette's avatar
Jerome Mariette committed
204
									    	<option value="1" selected="selected">Manager</option>
Jerome Mariette's avatar
Jerome Mariette committed
205
									    {else}
Jerome Mariette's avatar
Jerome Mariette committed
206
									    	<option value="1">Manager</option>
Jerome Mariette's avatar
Jerome Mariette committed
207
208
209
									    {/if}
							    
									    {if $user_values.right_id=='0'}
Jerome Mariette's avatar
Jerome Mariette committed
210
									    	<option value="0" selected="selected">Member</option>
Jerome Mariette's avatar
Jerome Mariette committed
211
									    {else}
Jerome Mariette's avatar
Jerome Mariette committed
212
									    	<option value="0">Member</option>
Jerome Mariette's avatar
Jerome Mariette committed
213
214
215
216
217
218
219
220
221
222
223
224
									    {/if}
									</select>
								{/if}    
							</td>
							
						</tr>									
					{/foreach}
				</tbody>
				{if $projects[key($projects)].is_admin || $projects[key($projects)].is_manager}
					<tfoot>
						<tr>
							<th align="left" colspan="7">
Jerome Mariette's avatar
Jerome Mariette committed
225
								With selection :
philippe's avatar
philippe committed
226
227
228
229
								<div  class="btn-group">
									<button id="add_user" type="button" class="btn btn-small"><i class="icon-plus"></i> add user</button>
									<button id="del_user" type="button" class="btn btn-small"><i class="icon-minus"></i> delete user</button>
								</div>
Jerome Mariette's avatar
Jerome Mariette committed
230
231
232
233
234
235
236
237
238
							</th>
						</tr>
					</tfoot>
				{/if}
			</table>
		</div>
		{/if}
		
	</div>
Jerome Mariette's avatar
Jerome Mariette committed
239

Penom Nom's avatar
Penom Nom committed
240
241
242
{* If multiple projects have to be displayed *}
{else}
	{* Find out if the current user is super user of a project *}
Jerome Mariette's avatar
Jerome Mariette committed
243
	{assign var="is_at_least_admin_of_1_project" value=false}
Penom Nom's avatar
Penom Nom committed
244
	{foreach from=$projects key=project_id item=project_values}
Jerome Mariette's avatar
Jerome Mariette committed
245
246
247
248
		{if $project_values.is_admin && !$is_at_least_admin_of_1_project}
			{assign var="is_at_least_admin_of_1_project" value=true}
		{elseif !$is_at_least_admin_of_1_project}
			{assign var="is_at_least_admin_of_1_project" value=false}
Penom Nom's avatar
Penom Nom committed
249
250
251
252
		{/if}
	{/foreach}
	{* Then display the table *}
	<div class="project">
philippe's avatar
philippe committed
253
254
255
256
257
258
		<h2>Projects list <small> you can access </small></h2>
		<blockquote>
    		<p>You have access to <strong>{$projects|@count}</strong> projects.</p>
    		{assign var="project_size" value="<span id='size' class='tx-nG6-mini-wait'></span>"}
			<p>Raw data and analysis results use <strong>{$project_size}</strong> on the hard drive for all projects.</p>
    	</blockquote>
Penom Nom's avatar
Penom Nom committed
259
260
	</div>
	<br />
philippe's avatar
philippe committed
261
	<table class="table table-striped table-bordered dataTable" id="project_data_table">
Penom Nom's avatar
Penom Nom committed
262
263
		<thead>
			<tr>
Jerome Mariette's avatar
Jerome Mariette committed
264
				{if $is_at_least_admin_of_1_project && $login_user}
Jerome Mariette's avatar
Jerome Mariette committed
265
					<th><center><input type="checkbox" id="chk_all_project"></center></th>
Penom Nom's avatar
Penom Nom committed
266
				{/if}
Jerome Mariette's avatar
Jerome Mariette committed
267
268
269
				<th>Project Name</th>
				<th>Date</th>
				<th>Description</th>
Penom Nom's avatar
Penom Nom committed
270
271
272
273
			</tr>
		</thead>
		<tbody>
			{foreach from=$projects key=project_id item=project_values}
274
				{assign var="classes" value=""}
Jerome Mariette's avatar
Jerome Mariette committed
275
				{if $login_user && $project_values.public == 0 && $project_values.is_admin}
276
					{$classes = $classes|cat:"<span class='label label-warning'>Public</span> "}
277
278
				{/if}
				{if $project_values.hidden == 1}
279
					{$classes = $classes|cat:" <span class='label label-info'>Hidden</span> "}
Penom Nom's avatar
Penom Nom committed
280
				{/if}
Jerome Mariette's avatar
Jerome Mariette committed
281
				{if ($project_values.hidden == 1 && $project_values.is_admin) || $project_values.hidden == 0}
282
					<tr id="tr_project_{$project_values.id}">
Jerome Mariette's avatar
Jerome Mariette committed
283
284
285
286
287
						{if $project_values.is_admin}
							<td><center><input type="checkbox" id="chk_project_{$project_values.id}" value="project_{$project_values.id}"></center></td>
						{elseif $is_at_least_admin_of_1_project}
							<td></td>
						{/if}
288
289
						{if $project_values.is_admin}
							<td class="editable"> 
290
								{$classes} <span class="editable" data-type="text" data-pk="{$project_values.id}" data-url="index.php?eID=tx_nG6&type=update_db_field&table=tx_nG6_project&field=name" data-original-title="Enter project name">{$project_values.href}</span>
291
292
293
294
295
296
297
298
299
300
301
302
							</td>
						{else}
							<td> 
								{$project_values.href}
							</td>
						{/if}
						{if $project_values.is_admin}
							<td class="editable"> 
								<span class="editable-date" data-type="date" data-pk="{$project_values.id}" data-url="index.php?eID=tx_nG6&type=update_db_field&table=tx_nG6_project&field=crdate" data-original-title="Select date">{$project_values.date|date_format:"%d/%m/%Y"}</span>
							</td>
						{else}
							<td>
Jerome Mariette's avatar
Jerome Mariette committed
303
								{$project_values.date|date_format:"%d/%m/%Y"}
304
305
306
307
308
309
310
311
							</td>
						{/if}
						{if $project_values.is_admin}
							<td class="editable"> 
								<span class="editable" data-type="textarea" data-pk="{$project_values.id}" data-url="index.php?eID=tx_nG6&type=update_db_field&table=tx_nG6_project&field=description" data-original-title="Enter description"> {$project_values.description}</span>
							</td>
						{else}
							<td> 
philippe's avatar
philippe committed
312
								{$project_values.description}
313
314
							</td>
						{/if}
Jerome Mariette's avatar
Jerome Mariette committed
315
316
					</tr>
				{/if}
Penom Nom's avatar
Penom Nom committed
317
318
			{/foreach}
		</tbody>
Jerome Mariette's avatar
Jerome Mariette committed
319
		{if $is_at_least_admin_of_1_project && $login_user}
Penom Nom's avatar
Penom Nom committed
320
321
		<tfoot>
			<tr>
philippe's avatar
philippe committed
322
323
324
325
326
327
328
329
330
331
332
				<th align="left" colspan="4">
					With selection :
					<div  class="btn-group">
						<button id="hide_project" type="button" class="btn btn-small"><i class=" icon-eye-close"></i> hide</button>
						<button id="unhide_project" type="button" class="btn btn-small"><i class="icon-eye-open"></i> unhide</button>
					</div>
					<button id="delete_project" type="button" class="btn btn-small"><i class="icon-trash"></i> delete</button>
					<div class="btn-group">
						<button id="publish_project" type="button" class="btn btn-small"><i class="icon-thumbs-up"></i> publish</button>
						<button id="unpublish_project" type="button" class="btn btn-small"><i class="icon-thumbs-down"></i> unpublish</button>
					</div>
Penom Nom's avatar
Penom Nom committed
333
334
335
336
337
				</th>
			</tr>
		</tfoot>
		{/if}
	</table>
philippe's avatar
philippe committed
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
{/if}

{* Modal initialization *}
{* Global tmpl *}
<div id="ng6modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="modal-label-tmpl" aria-hidden="true">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h3 id="modal-label-tmpl">Modal header</h3>
	</div>
	<div id="modal-body-tmpl" class="modal-body"></div>
	<div id="modal-foot-tmpl" class="modal-footer"></div>
</div>

{* Error No raw selected modal *}
<div id="ng6modal-DTnoraw" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="modalLabel-DTnoraw" aria-hidden="true">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h3>Error</h3>
	</div>
	<div class="modal-body">
		<div class='tx-nG6-pi1-error'>No raw selected, please select a raw to access this fonctionality.</div>
	</div>
	<div class="modal-footer">
		<button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i> Close</button>
	</div>
</div>