Commit d16c5cf1 authored by Celine Noirot's avatar Celine Noirot
Browse files

Merge branch 'master' into 'dev'

Merge branch Master with dev

See merge request !105
parents 88acab04 384a7de2
......@@ -53,8 +53,8 @@
<!-- ###LOGIN_FORM### -->
<form action="###ACTION_URI###" target="_top" method="post" onsubmit="###ON_SUBMIT###" class="form-horizontal">
<fieldset>
<legend>###LEGEND###</legend>
<p>###STATUS_MESSAGE###</p>
<div class="form-group">
<label class="col-sm-offset-1 col-sm-4 control-label" for="user">###USERNAME_LABEL###</label>
<div class="col-sm-6">
......
{*
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
......@@ -40,30 +40,26 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{elseif $single_project_display}
<div class="sub-content sc-top">
<input type="hidden" id="is_project_admin" value="{$projects[key($projects)].is_admin}" />
<div class="ng6-content-header-left project">
<h2>Projet <small>{$projects[key($projects)].name}</small></h2>
<div><p>Current space: <b><span id="current_space_id">{$projects[key($projects)].space_id}</span></b></p></div>
<div><p>{$space_purge_msg}</p></div>
{if $projects[key($projects)].is_admin}
<div id="change_space_id_warning"><p><i>Warning, migrating a project from one space to another will update both the files location and the retention limits.</i></p></div>
<div id="change_space_id_form"></div>
<div id="wf_id"></div>
<div id="change_space_id_status"></div>
<div id="change_space_id_footer" align="right"></div>
<div id="migration_form"></div>
{/if}
</div>
<div class="ng6-content-header-right">
{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
<strong>{$manag_values.nb_analyses}</strong> analyse(s) have been done on the project {$projects[key($projects)].name}.
<strong>{$manag_values.nb_analyses}</strong> analyse(s) have been done on the project {$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.<br />
<!-- New data added to this project will be kept<b>{$retention_policy}</b>. <br /> -->
<br><label>Data overview</label><br>
<table class="table table-striped table-bordered dataTable" id="manag_purged_data_table">
<thead>
<tr>
......@@ -92,7 +88,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</tbody>
</table>
</div>
<div style="clear:both"></div>
</div>
......@@ -107,7 +103,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{assign var="comment_tab" value="project_comments"}
<li><a href="#{$comment_tab}" data-toggle="tab">Comments</a></li>
</ul>
<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 *}
......@@ -122,7 +118,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{assign var="is_project_admin" value=$projects[key($projects)].is_admin}
{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}
......@@ -136,7 +132,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{assign var="is_admin" value=$projects[key($projects)].is_admin}
{include file='analysis_table.tpl'}
</div>
{if $login_user}
<div class="tab-pane fade" id="users">
<input type="hidden" id="current_project_id" value="{$projects[key($projects)].id}" />
......@@ -164,22 +160,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</tr>
</thead>
{assign var=current_user_values value=""}
<tbody>
<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=current_user_values value=$user_values}
{assign var="emphasis" value="tx-nG6-pi1-line-emphasis"}
{/if}
<tr id="tr_user_{$user_values.id}" class="{$emphasis}">
{if ($user_values.cruser_id==$user_id)
|| $projects[key($projects)].is_admin
|| $projects[key($projects)].is_manager
|| ($user_values.id == $user_id )
|| ($user_values.id == $user_id )
|| $is_ng6_admin }
<td><center><input type="checkbox" id="chk_user_{$user_values.id}" value="user_{$user_values.id}" /></center>
{* If the current user is superadmin, it is allowed to update anyone's password. *}
......@@ -193,19 +189,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{else}
<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">
<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">
<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">
<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>
{else}
......@@ -213,14 +209,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<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 class="form-control" id="cbb_right_level_{$user_values.id}" name="right_level" disabled>
<option value="2" selected="selected">Administrator</option>
</select>
{else}
{if ($projects[key($projects)].is_admin && $user_values.id!=$user_id)
{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}
......@@ -230,23 +226,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{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}
{/if}
</td>
</tr>
</tr>
{/foreach}
</tbody>
{assign var="disabled" value=""}
......@@ -256,17 +252,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{elseif $current_user_values.id==$user_id}
{assign var="disabled" value="disabled"}
{if $current_user_values.right_id == '0'}
{assign var="nou_selection_btn" value=""}
{/if}
{assign var="multipleu_selection_btn" value=""}
{/if}
<tfoot>
<tr>
<th align="left" colspan="8">
With selection :
With selection :
<div class="btn-group">
<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>
......@@ -278,12 +274,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</table>
</div>
{/if}
{include file='comments.tpl' comments=$comments tab_id=$comment_tab add_new_comment=$projects[key($projects)].is_admin user_id=$user_id }
</div>
</div>
{* If multiple projects have to be displayed *}
{else}
{* Find out if the current user is super user of a project *}
......@@ -299,7 +295,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div class="sub-content sc-top">
<div class="ng6-content-header-left project">
<h2>Projects list <small> you can access </small></h2>
</div>
<div class="ng6-content-header-right">
{if $is_ng6_superadmin}
......@@ -319,4 +315,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div>
{/if}
{include file='../template/modals.tpl'}
......@@ -51,7 +51,7 @@ $.validator.setDefaults({
}
$element.removeClass(errorClass).addClass(validClass);
// remove the bootstrap error class
if ($element.parents("div.form-group").find("." + errorClass).length == 0) {
if ($element.parents("div.form-group").find("." + errorClass).length == 0) {
// Only remove the class if there are no other errors
$element.parents("div.form-group").removeClass(errorClass).addClass(validClass);
}
......@@ -71,7 +71,7 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, {
} else {
date = date.replace(" ", "");
}
if (date.indexOf('.') > 0) {
/*date a, format dd.mn.(yyyy) ; (year is optional)*/
var eu_date = date.split('.');
......@@ -79,33 +79,33 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, {
/*date a, format dd/mn/(yyyy) ; (year is optional)*/
var eu_date = date.split('/');
}
/*year (optional)*/
if (eu_date[2]) {
var year = eu_date[2];
} else {
var year = 0;
}
/*month*/
var month = eu_date[1];
if (month.length == 1) {
month = 0+month;
}
/*day*/
var day = eu_date[0];
if (day.length == 1) {
day = 0+day;
}
return (year + month + day) * 1;
},
"date-eu-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"date-eu-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
......@@ -116,11 +116,11 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, {
a = (a === "-" || a === "") ? 0 : a.replace( /[^\d\-\.]/g, "" );
return parseFloat( a );
},
"formatted-num-asc": function ( a, b ) {
return a - b;
},
"formatted-num-desc": function ( a, b ) {
return b - a;
}
......@@ -135,15 +135,15 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, {
a = $html.children("span.editable").children("a").html();
} else if (($html.children("span.label").length > 0) || ($html.children("a").length > 0)) {
a = $html.children("a").html();
}
}
// alert(a)
return a;
},
"anti-label-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"anti-label-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
......@@ -153,7 +153,7 @@ $(function () {
initEditableFields();
initCheckboxes();
initChangeSpaceForm();
updateProjectButtonStatus();
$("[id^=chk_project_]").change(function() {
updateProjectButtonStatus();
......@@ -161,7 +161,7 @@ $(function () {
$("#chk_all_project").change(function() {
updateProjectButtonStatus();
});
updateRunButtonStatus();
$("[id^=chk_run_]").change(function() {
updateRunButtonStatus();
......@@ -169,7 +169,7 @@ $(function () {
$("#chk_all_run").change(function() {
updateRunButtonStatus();
});
updateAnalysisButtonStatus();
$("[id^=chk_analysis_]").change(function() {
updateAnalysisButtonStatus();
......@@ -185,16 +185,16 @@ $(function () {
$("#chk_all_user").change(function() {
updateUsersButtonStatus();
});
addWorkflowsStatusOnRun();
addWorkflowsStatusOnSingleRun();
// Init tables
var projectTable = initProjectTable(),
runTable = initRunTable(),
analysisTable = initAnalysisTable(),
usersTable = initUsersTable();
// Grab relevant info from URL fragment
var params = simpleQueryParams(location.href),
active_tab = params["active_tab"];
......@@ -204,7 +204,7 @@ $(function () {
} else {
$('#myTab').tab();
}
$('a[data-toggle="tab"]').on('shown.bs.tab', function () {
if ($(this).attr("href") == "#analyses") {
analysisTable.fnDraw();
......@@ -214,7 +214,7 @@ $(function () {
usersTable.fnAdjustColumnSizing();
}
});
$('a[data-toggle="tab"]').each(function() {
if ($(this).parent("li").hasClass("active")) {
if ($(this).attr("href") == "#analyses") {
......@@ -226,7 +226,7 @@ $(function () {
}
}
});
var size_url = "index.php?eID=tx_nG6&type=get_size";
size_url += "&user_id="+$("#user_id").val();
size_url += "&view="+$("#view").val();
......@@ -238,8 +238,8 @@ $(function () {
$("#size").removeClass("tx-nG6-mini-wait");
$("#size").html(val);
}
});
});
/* Delete toolbar option */
$('[id^="delete_"]').on('click', deletePRAHandler);
/* Hide toolbar option */
......@@ -250,7 +250,7 @@ $(function () {
$("[id=unpublish_project]").on('click', unpublishHandler);
/* Publish toolbar option */
$("[id=publish_project]").on('click', publishHandler);
/* change user right on project option */
function change_right(select){
// launch the delete request on server
......@@ -258,7 +258,7 @@ $(function () {
val_url += "&project_id=" + $("#current_project_id").val();
val_url += "&c_user_id="+$(select).attr("id").split("_")[3];
val_url += "&right_id="+$(select).val();
$.ajax({
url: val_url,
success: function(val, status, xhr) {
......@@ -273,39 +273,39 @@ $(function () {
$("div#users_data_table_wrapper").find("select[name=users_data_table_length]").change(function(){
$("table#users_data_table > tbody > tr > td > select").change(function(){
change_right(this);
change_right(this);
});
});
$("table#users_data_table > tbody > tr > td > select").change(function(){
change_right(this);
});
/* add a brand new project option */
$(":button[id=add_project]").on('click', addProjectHandler);
/* add a brand new run option */
$(":button[id=add_run]").on('click', addRunHandler);
/* add a result file to an existing run or analysis*/
$(":button[id=add_file]").on('click', addFileHandler);
/* add a brand new analysis option */
$(":button[id=add_analysis]").on('click', addAnalysisHandler);
/* delete user from project option */
$(":button[id=del_user]").click(function(){
if ($(':checked[id^=chk_user]').size() != 0) {
$("#modal-label-tmpl").html("Delete user");
$("#modal-body-tmpl").html("Are you sure you want to delete the selected elements ?");
$("#modal-foot-tmpl").html('<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">No</button>' +
'<button id="modal-btn-yes" class="btn btn-primary">Yes</button>');
$("#ng6modal").modal();
// Define dialog buttons actions
$("#modal-btn-yes").click( function() {
$("#modal-btn-yes").click( function() {
// launch the delete request on server
var val_url = "index.php?eID=tx_nG6&type=delete_users";
val_url += "&project_id=" + $("#current_project_id").val();
......@@ -313,18 +313,18 @@ $(function () {
$(':checked[id^=chk_user]').each(function(i){
val_url += $(this).val().split("_",2)[1]+";";
});
$("#modal-body-tmpl").html('<div class="tx-nG6-wait">Deleting, please wait...</div>');
$("#modal-foot-tmpl").html('<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">No</button>' +
'<button id="modal-btn-yes" class="btn btn-primary disabled">Yes</button>');
$("#ng6modal").modal();
val_url = val_url.substr(0, val_url.length-1);
$.ajax({
url: val_url,
success: function(val, status, xhr) {
// Uncheck all checkboxes
$(':checked').each(function(i){
$(this).attr('checked',false);
......@@ -337,7 +337,7 @@ $(function () {
} else {
location.assign(location.href);
}
// user can't access anymore to any project. Delete him from DB ?
}else{
if(val.search(";") != -1 && val.split(";").length > 1){
......@@ -347,13 +347,13 @@ $(function () {
}
$("#modal-foot-tmpl").html('<button id="modal-btn-no" class="btn btn-default" aria-hidden="true">No</button>' +
'<button id="modal-btn-yes" class="btn btn-primary">Yes</button>');
$("#modal-btn-yes").click( function() { // delete users (and groups if users are alone in their group)
var val_url = "index.php?eID=tx_nG6&type=delete_users";
val_url += "&user_id="+$("#user_id").val();
val_url += "&ids="+val;
$.ajax({
url: val_url,
success: function(val_p, status_p, xhr_p) {
......@@ -366,7 +366,7 @@ $(function () {
}
});
});
$("#modal-btn-no").click( function() { // delete users (and groups if users are alone in their group)
location.assign(location.href+"&active_tab=users");
});
......@@ -376,12 +376,12 @@ $(function () {
});
}
});
//update user properties
//update user properties
$(":button[id=update_user]").click(function(){
//only one user can be updated at a time
if ($(':checked[id^=chk_user]').size() == 1){
var user_id = $.trim($(':checked[id^=chk_user]').val().split("_",2)[1]),
user_login = $.trim( $('#tr_user_' + user_id + ' td:eq(1)').text()),
first_name = $.trim( $('#tr_user_' + user_id + ' td:eq(5)').text()),
......@@ -404,7 +404,7 @@ $(function () {
update_user_call_back({'title' : 'Laboratory', 'organism' : 'Organism', 'location' : "Location",'first_name':first_name});
}
});
function update_user_call_back (user_group_json) {
var title = user_group_json.title,
organism = user_group_json.organism,
......@@ -415,7 +415,7 @@ $(function () {
'<div id="error_message" class="alert alert-danger">',
' <button class="close" data-dismiss="alert" type="button">x</button>',
'</div>',
'<div class="tx-nG6-pi1-update-user" >Update user information. For the laboratory you can use autocomplete to seek for an already existing one or create a new one using the formular<br /> <br />' ,
'<div class="tx-nG6-pi1-update-user" >Update user information. For the laboratory you can use autocomplete to seek for an already existing one or create a new one using the formular<br /> <br />' ,
' <form class="form-horizontal" id="update_user_form">',
' <div class="form-group">',
' <label class="col-sm-offset-2 col-sm-2 control-label">First name</label>',
......@@ -426,7 +426,7 @@ $(function () {
' <div class="form-group">',
' <label class="col-sm-offset-2 col-sm-2 control-label">Last name</label>',
' <div class="col-sm-8">',
' <input type="text" id="last_name_val" class="form-control" name="last_name_val" value="' + last_name + '"/> ',
' <input type="text" id="last_name_val" class="form-control" name="last_name_val" value="' + last_name + '"/> ',
' </div>',
' </div>',
' <div class="form-group">',
......@@ -472,11 +472,11 @@ $(function () {
' </form>',
'</div>'
].join('');
$("#modal-body-tmpl").html(update_user_html);
$("#modal-foot-tmpl").html('<button class="btn btn-default" id="raz_form"><i class="icon-repeat"></i> Clear form</a>' +
'<button id="modal-btn-updateuser" class="btn btn-primary"><i class="icon-ok icon-white"></i> Save</button>');
// show modal box
$("#ng6modal").modal().ready(function() {
$("#error_message").hide();
......@@ -497,7 +497,7 @@ $(function () {
$("#location_val").val(item.location);
}
});
$this.typeahead({
minLength: 2,
autoselect: true
......@@ -519,9 +519,9 @@ $(function () {
});
}
})
});
// lock/unlock fields when autocomplete
function lock_group_fields(order){
// lock fields
......@@ -536,7 +536,7 @@ $(function () {
$("#location_val").removeAttr('disabled');
}
}
// generate key button
$("#key_gen_btn").click(function(){
$("#user_password_pwd_val").val(key_gen(10));
......@@ -544,8 +544,8 @@ $(function () {
$(".icon-wrench").removeClass("icon-white");
$(this).parent().parent().parent().removeClass("error");
});
$("#raz_form").click(function(){
$("#last_name_val").val("");
$("#first_name_val").val("");
......@@ -557,8 +557,8 @@ $(function () {
lock_group_fields(0); // unlock fields