project_view.tpl 13.1 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="user_login" value="{$user_login}" />
Jerome Mariette's avatar
Jerome Mariette committed
25
<input type="hidden" id="pid" value="{$pid}" />
Penom Nom's avatar
Penom Nom committed
26
27
28
<input type="hidden" id="data_folder" value="{$data_folder}" />
<input type="hidden" id="view" value="project" />
<input type="hidden" id="ids" value="{$project_ids}" />
Jerome Mariette's avatar
Jerome Mariette committed
29
<input type="hidden" id="login_user" value="{$login_user}" />
Penom Nom's avatar
Penom Nom committed
30
31

{* If no project can be displayed *}
Jerome Mariette's avatar
Jerome Mariette committed
32
{if $projects|@count == 0 || ($projects|@count == 1 && $projects[key($projects)].hidden == 1 && !$projects[key($projects)].is_admin)}
philippe's avatar
philippe committed
33
	<div class="alert alert-info">Sorry no results to display</div>
Jerome Mariette's avatar
Jerome Mariette committed
34

Penom Nom's avatar
Penom Nom committed
35
36
{* If a single project has to be displayed *}
{elseif $projects|@count == 1}
philippe's avatar
philippe committed
37
38
	<div class="sub-content sc-top">
		<input type="hidden" id="is_project_admin" value="{$projects[key($projects)].is_admin}" />
Jerome Mariette's avatar
Jerome Mariette committed
39
		
philippe's avatar
philippe committed
40
41
42
43
44
45
46
47
48
49
50
51
		<div class="ng6-content-header-left project">
			<h2>Projet <small>{$projects[key($projects)].name}</small></h2>
			{$projects[key($projects)].description}
			<br />
			<strong>{$project_runs|@count}</strong> run(s) and
			<strong>{$project_analysis|@count}</strong> analyse(s) have been done on the run {$projects[key($projects)].name}.		
			<br />
			{assign var="project_size" value="<span id='size' class='tx-nG6-mini-wait'></span>"}
			Raw data and analysis results use <strong>{$project_size}</strong> on the hard drive for the whole project.		
		</div>
		<div class="ng6-content-header-right">
			&nbsp;
Jerome Mariette's avatar
Jerome Mariette committed
52
		</div>
philippe's avatar
philippe committed
53
54
55
56
57
58
59
60
61
62
63
		<div style="clear:both"></div>
	</div>

	<div class="sub-content sc-bottom">
		<ul id="myTab" class="nav nav-tabs">
			<li class="active"><a href="#runs" data-toggle="tab">Runs</a></li>
	 		<li><a href="#analyses" data-toggle="tab">Analyses</a></li>
	 		{if $login_user}
	 			<li><a href="#users" data-toggle="tab">Users</a></li>
	 		{/if}
		</ul>
Jerome Mariette's avatar
Jerome Mariette committed
64
		
philippe's avatar
philippe committed
65
66
67
68
69
70
71
72
73
	 	<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 $project_runs|@count == 0}
	 				{assign var="is_at_least_admin_of_1_run" value=false}
				{elseif $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}
Jerome Mariette's avatar
Jerome Mariette committed
74
				{/if}
philippe's avatar
philippe committed
75
				{assign var="runs" value=$project_runs}
76
				{assign var="is_project_admin" value=$projects[key($projects)].is_admin}
philippe's avatar
philippe committed
77
78
79
80
81
82
				{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}
83
				{foreach from=$h_analysis key=analysis_id item=analysis_values}
philippe's avatar
philippe committed
84
85
86
87
88
89
					{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}
90
91
				{assign var="is_admin" value=$projects[key($projects)].is_admin}
				{include file='analysis_table.tpl'}
philippe's avatar
philippe committed
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
			</div>
			
			{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}" />
				<p>
				{if $projects[key($projects)].is_admin}
					In the table below are listed all users with an access to the project.
				{elseif $projects[key($projects)].is_manager}
					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.
				{elseif $projects[key($projects)].is_member}
					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
113
				{/if}
philippe's avatar
philippe committed
114
115
116
117
118
119
				</p>
				<table class="table table-striped table-bordered dataTable" id="users_data_table">
					<thead>
						<tr>
							{if $needs_action}
								<th><center><input type="checkbox" id="chk_all_user"></center></th>
Jerome Mariette's avatar
Jerome Mariette committed
120
							{/if}
philippe's avatar
philippe committed
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
							<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>
						</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
137
							{/if}
philippe's avatar
philippe committed
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
						
							<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 }
									<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
162
								{else}
philippe's avatar
philippe committed
163
164
165
166
167
168
169
170
									<td>{$user_values.last_name}</td>
									<td>{$user_values.first_name}</td>
									<td>{$user_values.email}</td>
								{/if}
								
								<td>
									{if $user_values.right_id=='2' && !$projects[key($projects)].is_admin}
										<select id="cbb_right_level_{$user_values.id}" name="right_level" disabled>
Jerome Mariette's avatar
Jerome Mariette committed
171
											<option value="2" selected="selected">Administrator</option>
philippe's avatar
philippe committed
172
173
174
175
176
177
178
										</select>
									{else}
										{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')}
											{assign var="disabled" value=""}
										{else}
											{assign var="disabled" value="disabled"}
Jerome Mariette's avatar
Jerome Mariette committed
179
										{/if}
philippe's avatar
philippe committed
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
										<select id="cbb_right_level_{$user_values.id}" name="right_level" {$disabled}>
											{if $projects[key($projects)].is_admin}
												<option value="2" selected="selected">Administrator</option>
											{/if}
										
											{if $user_values.right_id=='1'}
										    	<option value="1" selected="selected">Manager</option>
										    {else}
										    	<option value="1">Manager</option>
										    {/if}
								    
										    {if $user_values.right_id=='0'}
										    	<option value="0" selected="selected">Member</option>
										    {else}
										    	<option value="0">Member</option>
										    {/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">
									With selection :
									<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>
								</th>
							</tr>
						</tfoot>
					{/if}
				</table>
			</div>
			{/if}
Jerome Mariette's avatar
Jerome Mariette committed
219
220
		</div>
	</div>
philippe's avatar
philippe committed
221
	
Penom Nom's avatar
Penom Nom committed
222
223
224
{* 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
225
	{assign var="is_at_least_admin_of_1_project" value=false}
Penom Nom's avatar
Penom Nom committed
226
	{foreach from=$projects key=project_id item=project_values}
Jerome Mariette's avatar
Jerome Mariette committed
227
228
229
230
		{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
231
232
233
		{/if}
	{/foreach}
	{* Then display the table *}
philippe's avatar
philippe committed
234
235
236
237
238
239
240
241
242
243
244
245
246
	<div class="sub-content sc-top">
		<div class="ng6-content-header-left project">
			<h2>Projects list <small> you can access </small></h2>
			You have access to <strong>{$projects|@count}</strong> projects.
			<br />
	    	{assign var="project_size" value="<span id='size' class='tx-nG6-mini-wait'></span>"}
			Raw data and analysis results use <strong>{$project_size}</strong> on the hard drive for all projects.
		</div>
		<div class="ng6-content-header-right">
			&nbsp;
		</div>
		<div style="clear:both"></div>
	</div>
247
248
	<div id="projects" class="sub-content sc-bottom">
		{include file='project_table.tpl'}
Penom Nom's avatar
Penom Nom committed
249
	</div>
philippe's avatar
philippe committed
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
{/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>
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
</div>

{* setAndRunModal *}
<div id="setAndRunModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="setAndRunModalLabel" aria-hidden="true">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h3 id="setAndRunModalLabel"></h3>
	</div>
	<div id="setAndRunModalBody" class="modal-body"></div>
	<div class="modal-footer">
		<button id="reset_workflow" class="btn"><i class="icon-refresh"></i> Reset</button>
		<button id="run_workflow" class="btn btn-primary"><i class="icon-cog icon-white"></i> Run</button>
	</div>
</div>

{* statusModal *}
<div id="statusModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="statusModalLabel" aria-hidden="true">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		<h3 id="statusModalLabel"></h3>
	</div>
	<div id="statusModalBody" class="modal-body"></div>
	<div class="modal-footer">
		<button id="refresh_workflow" class="btn"><i class="icon-refresh"></i> Refresh</button>
		<button id="rerun_workflow" class="btn btn-primary"><i class="icon-cog icon-white"></i> ReRun</button>
	</div>
</div>