Commit 12139447 authored by Romain Therville's avatar Romain Therville 🐭

Merge branch 'dev' into 'master'

Merge branch Dev with Master

See merge request !101
parents 8645bb68 fff55d69
......@@ -914,13 +914,22 @@ class tx_nG6_eid {
} elseif ($type == 'purge_managment_mail') {
$all_projects = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('project'));
print json_encode(tx_nG6_pi6::send_purge_demand_mail($all_projects));
$with_extension = 1;
print json_encode(tx_nG6_pi6::send_purge_demand_mail($all_projects,$with_extension));
} elseif ($type == 'purge_managment_mail_without_extension') {
$all_projects = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('project'));
$with_extension = 0;
print json_encode(tx_nG6_pi6::send_purge_demand_mail($all_projects,$with_extension));
} elseif ($type == 'purge_managment_resend_mail') {
$purge_ids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_demand'));
$purge_ids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_demand'));
print json_encode(tx_nG6_pi6::resend_purge_demand_mail($purge_ids));
} elseif ($type == 'refresh_purge_demand') {
$purge_delay = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_delay'));
print json_encode(tx_nG6_db::get_purge_demand_list($purge_delay));
$purge_demand_filter_space = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_demand_filter_space'));
$purge_demand_filter_delay_exceeded = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_demand_filter_delay_exceeded'));
print json_encode(tx_nG6_db::get_purge_demand_list($purge_delay,$purge_demand_filter_space,$purge_demand_filter_delay_exceeded));
} elseif ($type == 'refresh_purge_list') {
$max_retention_date = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('max_retention_date'));
$filter_space = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('filter_space'));
......@@ -939,6 +948,7 @@ class tx_nG6_eid {
$user_pwd = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('user_pwd'));
$res = tx_nG6_db::delete_purge_demand($purge_ids,$user_login, $user_pwd, $data_folder);
//print $res;
print $res;
} elseif ($type == 'extend_retention_date_from_demand') {
//Extend the retention date for the
......
......@@ -419,23 +419,38 @@ class tx_nG6_db {
}
static function get_purge_demand_list($delay_in_days){
static function get_purge_demand_list($delay_in_days,$space_filter,$delay_exceeded_filter){
#We first build the WHERE conditions from the given parameters
if ($space_filter != "") {
$conditions[] = "space_id = '$space_filter'";
}
//For an unknown reason, we can't use the alias 'delay_excedeed' in the WHERE clause...
if ($delay_exceeded_filter == 'yes') {
$conditions[] = "DATEDIFF( now( ), FROM_UNIXTIME( tx_nG6_purge_demand.mail_sent_date ) ) >".$delay_in_days;
}elseif($delay_exceeded_filter == 'no'){
$conditions[] = "DATEDIFF( now( ), FROM_UNIXTIME( tx_nG6_purge_demand.mail_sent_date ) ) <".$delay_in_days;
}
$conditions[] = '`tx_nG6_purge_demand`.processed_date IS NULL';
$where = join(' AND ', $conditions);
#select all demand id not processed
$queryParts=array(
'SELECT' => 'tx_nG6_purge_demand.uid AS demand_id, `tx_nG6_purge_demand`.project_id AS project_id, tx_nG6_project.name as project_name,
`tx_nG6_purge_demand`.purge_size AS purge_size, `tx_nG6_purge_demand`.mail_sent_date, `tx_nG6_purge_demand`.demand_state,
`fe_users`.username, `fe_groups`.title AS user_group_title,
`fe_users`.username, `fe_groups`.title AS user_group_title, `tx_nG6_project`.space_id AS space_id,
DATEDIFF( now( ), FROM_UNIXTIME( `tx_nG6_purge_demand`.mail_sent_date ) ) >'.$delay_in_days.' AS delay_excedeed',
'FROM' => '`tx_nG6_purge_demand`
INNER JOIN tx_nG6_project ON tx_nG6_project.uid = tx_nG6_purge_demand.project_id
INNER JOIN `tx_nG6_purge_demand_fe_users` ON `tx_nG6_purge_demand_fe_users`.`purge_demand_id` = tx_nG6_purge_demand.uid
INNER JOIN fe_users ON fe_users.uid = `tx_nG6_purge_demand_fe_users`.`fe_users_id`
INNER JOIN fe_groups ON fe_groups.uid = fe_users.usergroup',
'WHERE' => '`tx_nG6_purge_demand`.processed_date IS NULL',
'WHERE' => $where,
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
$results=array();
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
while($res_row= $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
......@@ -449,6 +464,7 @@ INNER JOIN fe_groups ON fe_groups.uid = fe_users.usergroup',
"project_name"=>$res_row["project_name"],
"demand_state"=>$res_row["demand_state"],
"delay_excedeed"=>$res_row["delay_excedeed"],
"space_id"=>$res_row["space_id"],
"users"=>array(array("username"=>$res_row["username"], "user_group_title"=>$res_row["user_group_title"]))
);
}
......
......@@ -201,9 +201,9 @@ class tx_nG6_utils {
static function get_purge_mail($project_name, $project_id, $nb_run_purgeable,$nb_analyse_purgeable, $demand_id,
$purgeable_size, $project_size, $purge_delay, $url_price, $min_extention_duration,
$min_extention_size, $emails, $runs_list, $analyse_list) {
$min_extention_size, $emails, $runs_list, $analyse_list, $with_extension) {
$template_mail= '
$template_mail='
<html>
<head>
<title>Data Purge on nG6</title>
......@@ -211,22 +211,28 @@ class tx_nG6_utils {
<body>
<p>Dear user,</p>
<p>The two years data storage period of part or whole ###PROJECT_NAME### project (###nb_run### run(s) and ###nb_analyse### analyse(s)) is ended.</p>
<p>The data storage period of part or whole ###PROJECT_NAME### project (###nb_run### run(s) and ###nb_analyse### analyse(s)) is ended.</p>
<p>This purge alert No ###DEMAND_ID### corresponds to ###SIZE_STR### see list of impacted files below.</p>
<p>In ###PURGE_DELAY### days, your data will be deleted. Keep us informed if you wish to extend the storage period,
please have a look at our storage fees (<a href="###URL_PRICE###">###URL_PRICE###</a>) and reply to this email with the following information:</p>
<p>----------------------------------------------</p>
<ul><li>Demand number: ###DEMAND_ID###</li>
<li>Request for extension term: XXX (minimal unit: ###EXTENSION_DURATION###)</li>
<li>Request for extension size: XXX (mininal unit: ###EXTENSION_SIZE###)</li>
<li>Laboratory name/Institution: </li></ul>
<p>----------------------------------------------</p>
<p>In ###PURGE_DELAY### days, your data will be deleted.</p>';
<p>###EMAILS###We would appreciate if you could group your demands by laboratory.</p>
if($with_extension){
$template_mail .= '<p>Keep us informed if you wish to extend the storage period,
please have a look at our storage fees (<a href="###URL_PRICE###">###URL_PRICE###</a>) and reply to this email with the following information:</p>
<p>----------------------------------------------</p>
<ul><li>Demand number: ###DEMAND_ID###</li>
<li>Request for extension term: XXX (minimal unit: ###EXTENSION_DURATION###)</li>
<li>Request for extension size: XXX (mininal unit: ###EXTENSION_SIZE###)</li>
<li>Laboratory name/Institution: </li></ul>
<p>----------------------------------------------</p>
<p>Yours sincerely</p>
<p>###EMAILS###We would appreciate if you could group your demands by laboratory.</p>';
}else{
$template_mail .= '<p>###EMAILS###</p>';
}
$template_mail.='<p>Yours sincerely</p>
<p>nG6 team (for GeT-Genotoul and Bioinfo-Genotoul facilities)</p>
<p>Files impacted of:</p>
......@@ -395,6 +401,21 @@ please have a look at our storage fees (<a href="###URL_PRICE###">###URL_PRICE##
return($path_to_space_save_dir);
}
static function get_project_purge_msg($project_id){
$space_id = tx_nG6_db::get_project_space_id($project_id);
$space_config = tx_nG6_utils::get_retention_policy_from_space_id($space_id);
$project_purge_msg = '';
foreach($space_config as $line_id => $line_content){
if(strpos($line_content, 'purge_msg') === 0){
//We get the value in the "purge_msg = " line
$project_purge_msg = trim( substr( $line_content, strpos( $line_content, '=')+1 ) );
}
}
return($project_purge_msg);
}
static function get_save_dir(){
$config_file_content = tx_nG6_utils::get_config_content($space_id);
......
......@@ -154,9 +154,11 @@ class tx_nG6_pi1 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
} else {
if( $is_current_user_superadmin ){
$projects = tx_nG6_db::select_superadmin_projects();
$visible_projects = NULL;
}else{
$projects = tx_nG6_db::select_all_user_projects($user_id, 'tx_nG6_project.uid DESC');
//$projects = tx_nG6_db::select_all_user_projects($user_id, 'tx_nG6_project.name');
$visible_projects = tx_nG6_db::get_user_projects($user_id);
}
}
......@@ -201,6 +203,8 @@ class tx_nG6_pi1 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
$smarty->assign('single_project_display', $single_project_display);
$smarty->assign('is_ng6_admin', tx_nG6_db::is_ng6_administrator($user_id) || tx_nG6_db::is_user_ng6_superadmin($user_id) ? true : false);
$smarty->assign('is_ng6_superadmin', tx_nG6_db::is_user_ng6_superadmin($user_id) ? true : false);
$smarty->assign('visible_projects', $visible_projects);
// If it's a single project, add runs and analysis information
if ($single_project_display) {
......@@ -251,6 +255,7 @@ class tx_nG6_pi1 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
$smarty->assign_by_ref('tx_nG6_utils', $txNG6Utils);
$smarty->assign_by_ref('retention_policy', tx_nG6_utils::get_project_retention_policy($projects[key($projects)]['id']));
$smarty->assign('space_purge_msg', tx_nG6_utils::get_project_purge_msg($projects[key($projects)]['id']));
}
return $smarty->fetch('project_view.tpl');
......
......@@ -44,6 +44,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<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>
......@@ -60,7 +61,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<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 />
<!-- 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">
......@@ -301,7 +302,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div>
<div class="ng6-content-header-right">
You have access to <strong>{$projects|@count}</strong> projects.
{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}
<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.
......
......@@ -451,6 +451,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
With selection :
<div class="btn-group">
<button id="btn_obsolete_mail" type="button" class="btn btn-sm btn-default" ><i class="glyphicon glyphicon-envelope"></i> Send mail </button>
<button id="btn_obsolete_mail_without_extension" type="button" class="btn btn-sm btn-default" ><i class="glyphicon glyphicon-envelope"></i> Send mail without extension</button>
</div>
</th>
</tr>
......@@ -467,6 +468,41 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</p>
</div>
<div class="col-sm-6">
<fieldset class="col-sm-12">
<h4>1. Filter on space</h4>
<div class="text">
<select name="space_select_options" id="purge_demand_filter_space" >
<option value="">No filter</option>
{foreach $available_space_ids key=space_id item=space_name}
<option value="{$space_name}">{$space_name}</option>
{/foreach}
</select>
</div>
</fieldset>
</div>
<div class="col-sm-6">
<fieldset class="col-sm-12">
<h4>2. Delay exceeded : </h4>
<div class="text">
<select name="delay_exceeded_options" id="purge_demand_filter_delay_exceeded" >
<option value="">No filter</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</div>
</fieldset>
</div>
<div class="row">
<div class="col-sm-offset-10 col-sm-2">
<button type="button" id="refresh_purge_demands_list_btn" class="multiple-selection-btn btn btn-primary"> <i class="glyphicon glyphicon-refresh"></i> Refresh list</button>
</div>
</div>
</br>
<div class="tx-nG6-wait" id="data_table_purge_demand_wait">Please wait while processing ...</div>
<div class="alert alert-danger" id="purge_demand_error"></div>
<div id="purge_demand_list">
......@@ -476,6 +512,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<th><center><input type="checkbox" id="all_chk_demand"></center></th>
<th>Demand number</th>
<th>Project name</th>
<th>Project space</th>
<th>Purgeable size</th>
<th>Demand date</th>
<th>Users</th>
......@@ -488,7 +525,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</tbody>
<tfoot>
<tr>
<th align="left" colspan="7">
<th align="left" colspan="8">
With selection :
<div class="btn-group">
<button id="btn_demand_resend_mail" type="button" class="btn btn-sm btn-default" ><i class="glyphicon glyphicon-remove"></i> Resend mail</button>
......@@ -510,6 +547,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</p>
</div>
<input type="hidden" id="tx_nG6_pi6_redirection_page" value="{$tx_nG6_pi6_redirection_page}"/>
<div class="tx-nG6-wait" id="all_project_wait">Please wait while processing ...</div>
<div class="alert alert-danger" id="all_project_error"></div>
<div id="all_project_list">
......
......@@ -99,16 +99,16 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
$smarty->assign('ng6_superadmin_users', tx_nG6_db::get_ng6_superadmin_users() );
$smarty->assign('is_current_user_superadmin', tx_nG6_db::is_user_ng6_superadmin($GLOBALS['TSFE']->fe_user->user['uid']) );
$smarty->assign('available_space_ids', tx_nG6_utils::get_available_space_ids());
$smarty->assign('tx_nG6_pi6_redirection_page',$this->conf['redirection_page']);
$smarty->assign('ng6_purge_delay',$this->conf['delay_purge']);
return $smarty->fetch('administration_view.tpl');
}
static function send_purge_demand_mail($project_ids) {
static function send_purge_demand_mail($project_ids, $extension_allowed = 1) {
$project_name="";
$project_name="";
foreach(explode(",", $project_ids) as $project_id){
#retrieve project data
......@@ -197,13 +197,13 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
#Build corresponding string array
//TODO RETURN TOTAL SIZE tx_nG6_utils::get_octet_string_representation($p[$project_id]["total_size"]
$total_project_size = tx_nG6_db::get_project_size($project_id, true);
$mail = tx_nG6_utils::get_purge_mail($p[$project_id]["project_name"],$project_id, $nb_run_purgeable,$nb_analyse_purgeable, $purge_demand_id,
tx_nG6_utils::get_octet_string_representation($p[$project_id]["total_purgeable_size"]), tx_nG6_utils::get_octet_string_representation($total_project_size),
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["delay_purge"],
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["extension_url_price"], $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_duration"],
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_size"], $email_warn, join(', ', $run_info), join(', ', $analyses_info));
$mail = tx_nG6_utils::get_purge_mail($p[$project_id]["project_name"],$project_id, $nb_run_purgeable,$nb_analyse_purgeable, $purge_demand_id,
tx_nG6_utils::get_octet_string_representation($p[$project_id]["total_purgeable_size"]), tx_nG6_utils::get_octet_string_representation($total_project_size),
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["delay_purge"],
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["extension_url_price"], $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_duration"],
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_size"], $email_warn, join(', ', $run_info), join(', ', $analyses_info), $extension_allowed);
$to = $purge_email_to;
$subject = '[nG6 purge] No '.$purge_demand_id.' - Project '.$p[$project_id]["project_name"];
$headers[] = 'From: '.$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_from"];
......@@ -245,20 +245,13 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
}
//We now use join(', ', $run_info) and join(', ', $analyses_info) in get_purge_mail().
/*
$mail = tx_nG6_utils::get_purge_mail($res_project["name"],$res_demand["project_id"],
count(explode(",", $res_demand["run_ids"])), count(explode(",", $res_demand["analyze_ids"])), $res_demand["demand_id"],
tx_nG6_utils::get_octet_string_representation($res_demand["purge_size"]), tx_nG6_utils::get_octet_string_representation($total_project_size),
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["delay_purge"],
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["extension_url_price"], $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_duration"],
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_size"], "This email was send to ". join(', ',$res_demand["emails"]).". ", $res_demand["run_ids"], $res_demand["analyze_ids"]);
*/
$extension_allowed = 1;
$mail = tx_nG6_utils::get_purge_mail($res_project["name"],$res_demand["project_id"],
count(explode(",", $res_demand["run_ids"])), count(explode(",", $res_demand["analyze_ids"])), $res_demand["demand_id"],
tx_nG6_utils::get_octet_string_representation($res_demand["purge_size"]), tx_nG6_utils::get_octet_string_representation($total_project_size),
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["delay_purge"],
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["extension_url_price"], $GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_duration"],
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_size"], "This email was send to ". join(', ',$res_demand["emails"]).". ", join(', ', $run_info), join(', ', $analyses_info));
$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["min_extension_size"], "This email was send to ". join(', ',$res_demand["emails"]).". ", join(', ', $run_info), join(', ', $analyses_info), $extension_allowed);
$subject = '[nG6 purge / reminder] No '.$res_demand["demand_id"].' - Project '.$res_project["name"];
$headers[] = 'From: '.$GLOBALS['TSFE']->tmpl->setup["plugin."]["tx_nG6_pi6."]["email_from"];
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -899,13 +899,14 @@ $(function () {
$.ajax({
url: val_url,
success: function(val, status, xhr) {
if (val == '1') {
val = parseInt(val);
if (val == 1) {
// user has already access to this project
$("#error_message").html($("#username_val").val() + ' has already access to this project!').show();
} else if (val == '4' || val == '3') {
} else if (val == 4 || val == 3) {
// username exists in database cannot create
$("#error_message").html('Cannot create this user account, ' + $("#username_val").val() + ' already exists!').show();
} else if (val == '5') {
} else if (val == 5) {
// email exists in database cannot create
$("#error_message").html('Cannot create this user account, ' + $("#email_val").val() + ' already exists!').show();
} else {
......@@ -1591,7 +1592,8 @@ function deletePRAHandler() {
url: val_url,
success: function(val, status, xhr) {
// return code : 0 = ok, 1 = right error, 2 = authentication error, 3 = connexion error
if (val == '0') {
val = parseInt(val);
if (val == 0) {
// Uncheck all checkboxes
$(':checked').each(function(i){
$(this).attr('checked',false);
......@@ -1600,11 +1602,11 @@ function deletePRAHandler() {
location.reload();
} else {
$("#modal-label-tmpl").html("Error");
if (val == '1') {
if (val == 1) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi1-error'>You don't have write permission on the specified directory.</div>");
} else if (val == '2') {
} else if (val == 2) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi1-error'>An error occurred during login. Most likely you didn't enter the username or password correctly. Be certain that you enter them precisely as they are, including upper/lower case.</div>");
} else if (val == '3') {
} else if (val == 3) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi1-error'>An error occurred during server connection. Please contact the site administrator.</div>");
}
$("#modal-foot-tmpl").html('<button class="btn btn-default" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove"></i> Close</button>');
......
......@@ -516,7 +516,7 @@ $(function () {
"order": [[ 1, "asc" ]],
"columns": [
{ "orderable": false },
null,null,null,null,null,null]});
null,null,null,null,null,null,null]});
purge_table["allproject"] = $("#data_table_allproject").DataTable({});
......@@ -567,10 +567,48 @@ $(function () {
}
});
});
$("#btn_obsolete_mail_without_extension").click(function(){
$('#data_table_obsolete_wait').show();
$('#obsolete_list').hide();
var all_project=Array();
$("#ng6modal").modal('hide');
all_project = getPurgeDatatableCheckedValue(purge_table["obsolete"], "obsolete")
$.ajax({
url: "index.php?eID=tx_nG6&type=purge_managment_mail_without_extension&project="+all_project.join(',')+"&user_id="+$('input[id=user_id]').val(),
dataType: 'json',
success: function(val, status, xhr) {
refresh_project_obsolete(purge_table["obsolete"]);
refresh_purge_demand(purge_table["demand"]);
$("#purge_demand_error").hide()
},
error: function(returnval){
alert(returnval.status)
//TODO Afficher alerte en cas d'erreur de mail
var message = 'nG6 was unable to perform your action.';
if (returnval.status == 401){
message = 'it seems your session expired. Please re-authenticate!';
}
$('#data_table_obsolete_wait').hide();
$("#data_table_obsolete_error").html("<div class='tx-nG6-pi6-error'>Error : "+message+"</div>");
$("#data_table_obsolete_error").show();
$('#obsolete_list').show();
}
});
});
/****************************************
* tab process mail demand
***************************************/
//refresh purge demands list button
$("#refresh_purge_demands_list_btn").click(function(){
refresh_purge_demand(purge_table["demand"]);
});
//resend email
$("#btn_demand_resend_mail").click(function(){
var demands = getPurgeDatatableCheckedValue(purge_table["demand"],"demand");
......@@ -625,8 +663,8 @@ $(function () {
url: val_url,
success: function(val, status, xhr) {
// return code : 0 = ok, 1 = right error, 2 = authentication error, 3 = connexion error, 4 = error delete file , 5 error sql update
if (val == "0") {
val = parseInt(val);
if (val == 0) {
// Uncheck all checkboxes
$(".tx-nG6-wait").hide();
$("#modal-body-tmpl").html('Done !');
......@@ -634,15 +672,15 @@ $(function () {
refresh_purge_demand(purge_table["demand"]);
} else {
$("#modal-label-tmpl").html("Error");
if (val == "1") {
if (val == 1) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi6-error'>You don't have write permission on the specified directory.</div>");
} else if (val == "2") {
} else if (val == 2) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi6-error'>An error occurred during login. Most likely you didn't enter the username or password correctly. Be certain that you enter them precisely as they are, including upper/lower case.</div>");
} else if (val == "3") {
} else if (val == 3) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi6-error'>An error occurred during server connection. Please contact the site administrator.</div>");
} else if (val == "4") {
} else if (val == 4) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi6-error'>An error occurred during file deletion check if user have unix rigth to remove files. Please contact the site administrator.</div>");
} else if (val == "5") {
} else if (val == 5) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi6-error'>An error occurred while updating in db. Please contact the site administrator.</div>");
}
$("#modal-foot-tmpl").html('<button class="btn btn-default" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove"></i> Close</button>');
......@@ -695,6 +733,7 @@ $(function () {
function refreshAllProjectDatatable(allproject_datatble){
$("#all_project_error").hide();
$("#all_project_wait").show();
tx_nG6_pi6_redirection_page = $("#tx_nG6_pi6_redirection_page").val();
$.ajax({
url: "index.php?eID=tx_nG6&type=get_all_project",
dataType: 'json',
......@@ -703,7 +742,7 @@ $(function () {
oTable.clear();
$.each(val, function(key,values){
var checkbox = '<center><input id="chk_allproject_"'+values["pid"]+'" type="checkbox" value="' + values["pid"] + '" class="chk_allproject"></center>' ;
var row=[checkbox, "<a href='index.php?id=3&tx_nG6_pi1[project_id]="+values["pid"]+"'>"+values["project_name"]+"</a>"];
var row=[checkbox, "<a href='index.php?id="+tx_nG6_pi6_redirection_page+"&tx_nG6_pi1[project_id]="+values["pid"]+"'>"+values["project_name"]+"</a>"];
oTable.row.add(row);
});
oTable.draw();
......@@ -813,12 +852,15 @@ $(function () {
}
function refresh_purge_demand(purge_demand_datatable){
var purge_delay=$("#purge_delay").val();
var purge_demand_filter_delay_exceeded = $("#purge_demand_filter_delay_exceeded").val();
var purge_demand_filter_space = $("#purge_demand_filter_space").val();
$("#purge_demand_error").hide();
$('#data_table_purge_demand_wait').show();
$('#purge_demand_list').hide();
$.ajax({
url: "index.php?eID=tx_nG6&type=refresh_purge_demand&purge_delay="+purge_delay,
url: "index.php?eID=tx_nG6&type=refresh_purge_demand&purge_delay="+purge_delay+"&purge_demand_filter_space="+purge_demand_filter_space+"&purge_demand_filter_delay_exceeded="+purge_demand_filter_delay_exceeded,
dataType: 'json',
success: function(val, status, xhr) {
oTable = purge_demand_datatable;
......@@ -826,7 +868,9 @@ $(function () {
$.each(val, function(key,values){
var checkbox = '<center><input id="chk_demand_"'+key+'" type="checkbox" value="' + key + '" class="chk_demand"></center>' ;
var row=[checkbox, key, "<a href='index.php?id=3&tx_nG6_pi1[project_id]="+values["project_id"]+"'>"+values["project_name"]+"</a>",
tx_nG6_pi6_redirection_page = $("#tx_nG6_pi6_redirection_page").val();
var row=[checkbox, key, "<a href='index.php?id="+tx_nG6_pi6_redirection_page+"&tx_nG6_pi1[project_id]="+values["project_id"]+"'>"+values["project_name"]+"</a>",
values["space_id"],
get_octet_string_representation(values["purge_size"],2),
values["mail_sent_date"]];
......@@ -894,7 +938,8 @@ $(function () {
global_purgeable_size+=values["total_purgeable_size"];
nb_purgeable_project+=1;
var checkbox = '<center><input id="chk_obsolete_'+key+'" class="chk_obsolete" type="checkbox" value="' + key + '"></center>' ;
var row=[checkbox, "<a href='index.php?id=3&tx_nG6_pi1[project_id]="+key+"'>"+values["project_name"]+"</a>", values["nb_runs"]];
tx_nG6_pi6_redirection_page = $("#tx_nG6_pi6_redirection_page").val();
var row=[checkbox, "<a href='index.php?id="+tx_nG6_pi6_redirection_page+"&tx_nG6_pi1[project_id]="+key+"'>"+values["project_name"]+"</a>", values["nb_runs"]];
var nb_purgeable_element=0,
nb_all_element=parseInt(values["nb_runs"], 10);
if (values["state"].hasOwnProperty('stored') && values["state"]["stored"] != null && values["state"]["stored"]['nb_run'] != null) {
......
......@@ -19,7 +19,7 @@ from jflow.workflow import Workflow
from ng6.project import Project
from workflows.types import ng6adminlogin, uniqproject
from workflows.types import ng6adminlogin, uniqproject, ng6space
class AddProject (Workflow):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment