project_view.tpl 15.2 KB
Newer Older
Penom Nom's avatar
Penom Nom committed
1
2
{*
Copyright (C) 2009 INRA
cnoirot's avatar
cnoirot committed
3

Penom Nom's avatar
Penom Nom committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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="envelope_sender_address" value="{$envelope_sender_address}" />
24
<input type="hidden" id="user_id" value="{$user_id}" />
Jerome Mariette's avatar
Jerome Mariette committed
25
<input type="hidden" id="user_login" value="{$user_login}" />
Jerome Mariette's avatar
Jerome Mariette committed
26
<input type="hidden" id="pid" value="{$pid}" />
Penom Nom's avatar
Penom Nom committed
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}" />
Jerome Mariette's avatar
Jerome Mariette committed
30
<input type="hidden" id="login_user" value="{$login_user}" />
Jerome Mariette's avatar
Jerome Mariette committed
31
<input type="hidden" id="server_url" value="{$server_url}" />
Penom Nom's avatar
Penom Nom committed
32
33

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

Penom Nom's avatar
Penom Nom committed
40
{* If a single project has to be displayed *}
41
{elseif $single_project_display}
philippe's avatar
philippe committed
42
43
	<div class="sub-content sc-top">
		<input type="hidden" id="is_project_admin" value="{$projects[key($projects)].is_admin}" />
cnoirot's avatar
cnoirot committed
44

philippe's avatar
philippe committed
45
46
		<div class="ng6-content-header-left project">
			<h2>Projet <small>{$projects[key($projects)].name}</small></h2>
47
			<div><p>Current space: <b><span id="current_space_id">{$projects[key($projects)].space_id}</span></b></p></div>
48
			<div><p>{$space_purge_msg}</p></div>
49
			{if $projects[key($projects)].is_admin}
cnoirot's avatar
cnoirot committed
50
                                <div id="migration_form"></div>
51
			{/if}
Jerome Mariette's avatar
Jerome Mariette committed
52
53
		</div>
		<div class="ng6-content-header-right">
54
55
56
			{assign var="manag_values" value="{$managment_purged_data[$projects[key($projects)].id]}"}
                        {$projects[key($projects)].description} <br /> <br />
			<strong>{$manag_values.nb_runs}</strong> run(s) and
cnoirot's avatar
cnoirot committed
57
			<strong>{$manag_values.nb_analyses}</strong> analyse(s) have been done on the project {$projects[key($projects)].name}.
philippe's avatar
philippe committed
58
59
			<br />
			{assign var="project_size" value="<span id='size' class='tx-nG6-mini-wait'></span>"}
60
			Raw data and analysis results use <strong>{$project_size}</strong> on the hard drive for the whole project.<br />
61
			<!-- New data added to this project will be kept<b>{$retention_policy}</b>. <br /> -->
Celine Noirot's avatar
Celine Noirot committed
62
			<br><label>Data overview</label><br>
cnoirot's avatar
cnoirot committed
63

64
65
66
67
68
69
70
71
72
73
74
75
			<table class="table table-striped table-bordered dataTable" id="manag_purged_data_table">
				<thead>
					<tr>
						<th rowspan="1">Data</th>
						<th rowspan="1">Purged</th>
						<th rowspan="1">Stored</th>
						<th rowspan="1">Extended</th>
						<th rowspan="1">All</th>
					</tr>
				</thead>
				<tbody>
					<tr>
Celine Noirot's avatar
Celine Noirot committed
76
						<th rowspan="1"># Runs</th>
77
78
79
80
81
82
						<th rowspan="1">{if $manag_values.state.purged.nb_run}{$manag_values.state.purged.nb_run} ({$tx_nG6_utils->get_octet_string_representation($manag_values.state.purged.size_run)}){else}-{/if}</th>
						<th rowspan="1">{if $manag_values.state.stored.nb_run}{$manag_values.state.stored.nb_run} ({$tx_nG6_utils->get_octet_string_representation($manag_values.state.stored.size_run)}){else}-{/if}</th>
						<th rowspan="1">{if $manag_values.state.extended.nb_run}{$manag_values.state.extended.nb_run} ({$tx_nG6_utils->get_octet_string_representation($manag_values.state.extended.size_run)}){else}-{/if}</th>
						<th rowspan="1">{$manag_values.nb_runs}</th>
					</tr>
					<tr>
Celine Noirot's avatar
Celine Noirot committed
83
						<th rowspan="1"># Analysis</th>
84
85
86
87
88
89
90
						<th rowspan="1">{if $manag_values.state.purged.nb_analyze}{$manag_values.state.purged.nb_analyze} ({$tx_nG6_utils->get_octet_string_representation($manag_values.state.purged.size_analyze)}){else}-{/if}</th>
						<th rowspan="1">{if $manag_values.state.stored.nb_analyze}{$manag_values.state.stored.nb_analyze} ({$tx_nG6_utils->get_octet_string_representation($manag_values.state.stored.size_analyze)}){else}-{/if}</th>
						<th rowspan="1">{if $manag_values.state.extended.nb_analyze}{$manag_values.state.extended.nb_analyze} ({$tx_nG6_utils->get_octet_string_representation($manag_values.state.extended.size_analyze)}){else}-{/if}</th>
						<th rowspan="1">{$manag_values.nb_analyses}</th>
					</tr>
				</tbody>
			</table>
Audrey Gibert's avatar
Audrey Gibert committed
91
92
			<br />
				<div class="alert alert-info" name="Adding_user">
gsalin's avatar
gsalin committed
93
					<p style="text-align: center;">Your role is defined on the <strong>Users tab</strong> below. If you are manager or owner, you can add a collaborator yourself. Please visit the <a href="https://ng6.toulouse.inra.fr/faq" target="_blank"><strong>FAQ</strong></a> > "<strong>What about user management</strong>" & "<strong>How to add a user to my project</strong>" to know more.</p>
Audrey Gibert's avatar
Audrey Gibert committed
94
				</div>
95

cnoirot's avatar
cnoirot committed
96

Jerome Mariette's avatar
Jerome Mariette committed
97
		</div>
philippe's avatar
philippe committed
98
99
100
101
102
103
104
105
106
107
		<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}
108
109
	 		{assign var="comment_tab" value="project_comments"}
 		    <li><a href="#{$comment_tab}" data-toggle="tab">Comments</a></li>
philippe's avatar
philippe committed
110
		</ul>
cnoirot's avatar
cnoirot committed
111

philippe's avatar
philippe committed
112
113
114
115
116
117
118
119
120
	 	<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
121
				{/if}
philippe's avatar
philippe committed
122
				{assign var="runs" value=$project_runs}
123
				{assign var="is_project_admin" value=$projects[key($projects)].is_admin}
philippe's avatar
philippe committed
124
125
				{include file='run_table.tpl'}
			</div>
cnoirot's avatar
cnoirot committed
126

philippe's avatar
philippe committed
127
128
129
			<div class="tab-pane fade" id="analyses">
				{* Find out if an analysis table should be displayed *}
				{assign var="display_analysis_result" value=false}
130
				{foreach from=$h_analysis key=analysis_id item=analysis_values}
philippe's avatar
philippe committed
131
132
133
134
135
136
					{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}
137
138
				{assign var="is_admin" value=$projects[key($projects)].is_admin}
				{include file='analysis_table.tpl'}
philippe's avatar
philippe committed
139
			</div>
cnoirot's avatar
cnoirot committed
140

philippe's avatar
philippe committed
141
142
143
			{if $login_user}
			<div class="tab-pane fade" id="users">
				<input type="hidden" id="current_project_id" value="{$projects[key($projects)].id}" />
Penom Nom's avatar
Penom Nom committed
144
				<input type="hidden" id="current_project_name" value="{$projects[key($projects)].name}" />
philippe's avatar
philippe committed
145
146
147
148
149
150
151
				<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
152
				{/if}
philippe's avatar
philippe committed
153
154
155
156
				</p>
				<table class="table table-striped table-bordered dataTable" id="users_data_table">
					<thead>
						<tr>
Penom Nom's avatar
Penom Nom committed
157
							<th><center><input type="checkbox" id="chk_all_user"></center></th>
philippe's avatar
philippe committed
158
159
160
161
162
163
164
165
166
							<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>
167
					{assign var=current_user_values value=""}
cnoirot's avatar
cnoirot committed
168
					<tbody>
philippe's avatar
philippe committed
169
						{foreach from=$project_users key=c_user_id item=user_values}
cnoirot's avatar
cnoirot committed
170

philippe's avatar
philippe committed
171
172
173
							{* highlight user personnal line *}
							{assign var="emphasis" value=""}
							{if $user_values.id==$user_id}
174
							    {assign var=current_user_values value=$user_values}
philippe's avatar
philippe committed
175
								{assign var="emphasis" value="tx-nG6-pi1-line-emphasis"}
Jerome Mariette's avatar
Jerome Mariette committed
176
							{/if}
cnoirot's avatar
cnoirot committed
177

philippe's avatar
philippe committed
178
							<tr id="tr_user_{$user_values.id}" class="{$emphasis}">
cnoirot's avatar
cnoirot committed
179

Penom Nom's avatar
Penom Nom committed
180
								{if ($user_values.cruser_id==$user_id)
181
182
								    || $projects[key($projects)].is_admin
								    || $projects[key($projects)].is_manager
cnoirot's avatar
cnoirot committed
183
								    || ($user_values.id == $user_id )
Romain Therville's avatar
Romain Therville committed
184
								    || $is_ng6_admin }
185
									<td><center><input type="checkbox" id="chk_user_{$user_values.id}" value="user_{$user_values.id}" /></center>
Romain Therville's avatar
Romain Therville committed
186
187
188
189
190
191
192
193
									{* If the current user is superadmin, it is allowed to update anyone's password. *}
									{if $is_ng6_superadmin}
										<input type="hidden" id="chk_cruser_{$user_values.id}" value="{$user_id}"/></td>
										<input type="hidden" id="chk_updatablepwd_{$user_values.id}" value="1"/></td>
									{else}
										<input type="hidden" id="chk_cruser_{$user_values.id}" value="{$user_values.cruser_id}"/></td>
										<input type="hidden" id="chk_updatablepwd_{$user_values.id}" value="{$user_values.updatable_password}"/></td>
									{/if}
Penom Nom's avatar
Penom Nom committed
194
								{else}
philippe's avatar
philippe committed
195
196
									<td></td>
								{/if}
cnoirot's avatar
cnoirot committed
197

philippe's avatar
philippe committed
198
199
200
								<td>{$user_values.username}</td>
								<td>{$user_values.lastlogin}</td>
								<td>{$user_values.cruser_name}</td>
cnoirot's avatar
cnoirot committed
201

philippe's avatar
philippe committed
202
								{if $user_values.id==$user_id || $user_values.cruser_id==$user_id }
cnoirot's avatar
cnoirot committed
203
									<td class="editable">
philippe's avatar
philippe committed
204
205
										<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>
cnoirot's avatar
cnoirot committed
206
									<td class="editable">
philippe's avatar
philippe committed
207
208
										<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>
cnoirot's avatar
cnoirot committed
209
									<td class="editable">
philippe's avatar
philippe committed
210
211
										<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
212
								{else}
philippe's avatar
philippe committed
213
214
215
216
									<td>{$user_values.last_name}</td>
									<td>{$user_values.first_name}</td>
									<td>{$user_values.email}</td>
								{/if}
cnoirot's avatar
cnoirot committed
217

philippe's avatar
philippe committed
218
219
								<td>
									{if $user_values.right_id=='2' && !$projects[key($projects)].is_admin}
Penom Nom's avatar
Penom Nom committed
220
										<select class="form-control" id="cbb_right_level_{$user_values.id}" name="right_level" disabled>
Jerome Mariette's avatar
Jerome Mariette committed
221
											<option value="2" selected="selected">Administrator</option>
philippe's avatar
philippe committed
222
223
										</select>
									{else}
cnoirot's avatar
cnoirot committed
224
										{if ($projects[key($projects)].is_admin && $user_values.id!=$user_id)
philippe's avatar
philippe committed
225
226
227
228
											|| ($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
229
										{/if}
Penom Nom's avatar
Penom Nom committed
230
										<select  class="form-control" id="cbb_right_level_{$user_values.id}" name="right_level" {$disabled}>
philippe's avatar
philippe committed
231
232
233
											{if $projects[key($projects)].is_admin}
												<option value="2" selected="selected">Administrator</option>
											{/if}
cnoirot's avatar
cnoirot committed
234

philippe's avatar
philippe committed
235
236
237
238
239
											{if $user_values.right_id=='1'}
										    	<option value="1" selected="selected">Manager</option>
										    {else}
										    	<option value="1">Manager</option>
										    {/if}
cnoirot's avatar
cnoirot committed
240

philippe's avatar
philippe committed
241
242
243
244
245
246
										    {if $user_values.right_id=='0'}
										    	<option value="0" selected="selected">Member</option>
										    {else}
										    	<option value="0">Member</option>
										    {/if}
										</select>
cnoirot's avatar
cnoirot committed
247
									{/if}
philippe's avatar
philippe committed
248
								</td>
cnoirot's avatar
cnoirot committed
249
250

							</tr>
philippe's avatar
philippe committed
251
252
						{/foreach}
					</tbody>
Penom Nom's avatar
Penom Nom committed
253
254
255
256
257
					{assign var="disabled" value=""}
                    {assign var="nou_selection_btn" value="nou-selection-btn"}
                    {assign var="multipleu_selection_btn" value="multipleu-selection-btn"}
                    {if $projects[key($projects)].is_admin || $projects[key($projects)].is_manager}

258
                    {elseif $current_user_values.id==$user_id}
Penom Nom's avatar
Penom Nom committed
259
	                    {assign var="disabled" value="disabled"}
cnoirot's avatar
cnoirot committed
260

261
262
263
	                    {if $current_user_values.right_id == '0'}
	                        {assign var="nou_selection_btn" value=""}
	                    {/if}
cnoirot's avatar
cnoirot committed
264

Penom Nom's avatar
Penom Nom committed
265
266
267
268
269
	                    {assign var="multipleu_selection_btn" value=""}
	                {/if}
					<tfoot>
						<tr>
							<th align="left" colspan="8">
cnoirot's avatar
cnoirot committed
270
								With selection :
Penom Nom's avatar
Penom Nom committed
271
								<div  class="btn-group">
Penom Nom's avatar
Penom Nom committed
272
273
274
									<button id="add_user" type="button" class="btn {$nou_selection_btn} btn-sm btn-default" {$disabled}><i class="glyphicon glyphicon-plus"></i> add user</button>
									<button id="del_user" type="button" class="btn {$multipleu_selection_btn} btn-sm btn-default" {$disabled}><i class="glyphicon glyphicon-minus"></i> delete user</button>
									<button id="update_user" type="button" class="btn singleu-selection-btn btn-sm btn-default"><i class="glyphicon glyphicon-refresh"></i> update user</button>
Penom Nom's avatar
Penom Nom committed
275
276
277
278
								</div>
							</th>
						</tr>
					</tfoot>
philippe's avatar
philippe committed
279
280
281
				</table>
			</div>
			{/if}
cnoirot's avatar
cnoirot committed
282

283
			{include file='comments.tpl' comments=$comments  tab_id=$comment_tab  add_new_comment=$projects[key($projects)].is_admin user_id=$user_id }
cnoirot's avatar
cnoirot committed
284

Jerome Mariette's avatar
Jerome Mariette committed
285
286
		</div>
	</div>
cnoirot's avatar
cnoirot committed
287

Penom Nom's avatar
Penom Nom committed
288
289
290
{* 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
291
	{assign var="is_at_least_admin_of_1_project" value=false}
Penom Nom's avatar
Penom Nom committed
292
	{foreach from=$projects key=project_id item=project_values}
Jerome Mariette's avatar
Jerome Mariette committed
293
294
295
296
		{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
297
298
299
		{/if}
	{/foreach}
	{* Then display the table *}
philippe's avatar
philippe committed
300
301
302
	<div class="sub-content sc-top">
		<div class="ng6-content-header-left project">
			<h2>Projects list <small> you can access </small></h2>
cnoirot's avatar
cnoirot committed
303

Jerome Mariette's avatar
Jerome Mariette committed
304
305
		</div>
		<div class="ng6-content-header-right">
Romain Therville's avatar
Romain Therville committed
306
307
308
309
310
311
			{if $is_ng6_superadmin}
				You have access to <strong>{$projects|@count}</strong> projects.
			{else}
				You have access to <strong>{$visible_projects|@count}</strong> projects.
			{/if}

philippe's avatar
philippe committed
312
313
314
315
316
317
			<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 style="clear:both"></div>
	</div>
318
319
	<div id="projects" class="sub-content sc-bottom">
		{include file='project_table.tpl'}
Penom Nom's avatar
Penom Nom committed
320
	</div>
philippe's avatar
philippe committed
321
{/if}
322
{include file='../template/modals.tpl'}