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

Improve email ; List all project #18 ; Extend and remove a purge if project is linked to

parent 5c9e2015
......@@ -873,7 +873,7 @@ class tx_nG6_eid {
$res = tx_nG6_db::delete_purge_demand($purge_ids,$user_login, $user_pwd, $data_folder);
}
print $res;
} elseif ($type == 'extend_retention_date') {
} elseif ($type == 'extend_retention_date_from_demand') {
//Extend the retention date for the
$purge_ids = trim(t3lib_div::_GP('purge_demand'));
$value = trim(t3lib_div::_GP('date_value'));
......@@ -881,8 +881,19 @@ class tx_nG6_eid {
//Change date format
$date = explode('/', $value);
$timestamp = mktime (0, 0, 1, $date[1], $date[0], $date[2]);
print json_encode(tx_nG6_db::extend_retention_date(explode(',',$purge_ids),$timestamp,$type_extend));
}
print json_encode(tx_nG6_db::extend_retention_date_from_demand(explode(',',$purge_ids),$timestamp,$type_extend));
} elseif ($type == 'extend_retention_date_from_project') {
//Extend the retention date for the
$projects_id_str = trim(t3lib_div::_GP('projects_id'));
$value = trim(t3lib_div::_GP('date_value'));
//Change date format
$date = explode('/', $value);
$timestamp = mktime (0, 0, 1, $date[1], $date[0], $date[2]);
//TODO project
print json_encode(tx_nG6_db::extend_retention_date_from_project($projects_id_str,$timestamp, TRUE));
} elseif ($type == 'get_all_project') {
print json_encode(tx_nG6_db::select_all_projects());
}
}
}
......
......@@ -180,7 +180,6 @@ class tx_nG6_db {
$conditions[] = ' DATEDIFF( FROM_UNIXTIME( retention_date ) , now( ) ) <0';
}
$conditions[] = 'purge_demand_id IS NULL';
$conditions[] = 'state IN ( \'stored\', \'extended\')';
if ($filter_size != "") {
......@@ -377,6 +376,20 @@ class tx_nG6_db {
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
$result=array();
while($res_row= $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$queryPartsEmails=array(
'SELECT' => ' email ',
'FROM' => 'fe_users JOIN tx_nG6_purge_demand_fe_users ON fe_users.uid = tx_nG6_purge_demand_fe_users.fe_users_id',
'WHERE' => 'purge_demand_id = '.$res_row["demand_id"],
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
$emails=Array();
$res_email = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryPartsEmails);
while($email = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_email)) {
$emails[]=$email["email"];
}
$result[]=array(
"demand_id"=>$res_row["demand_id"],
"project_id"=>$res_row["project_id"],
......@@ -385,7 +398,8 @@ class tx_nG6_db {
"processed_date"=>$res_row["processed_date"],
"demand_state"=>$res_row["demand_state"],
"analyze_ids"=>$res_row["analyze_ids"],
"run_ids"=>$res_row["run_ids"]
"run_ids"=>$res_row["run_ids"],
"emails"=>$emails
);
}
return($result);
......@@ -429,41 +443,74 @@ INNER JOIN fe_groups ON fe_groups.uid = fe_users.usergroup',
return ($results);
}
function extend_retention_date($demand_ids, $date, $type_extend){
//TODO extend thanks to the type
function extend_retention_date_from_demand($demand_ids, $date, $type_extend){
//extend
$all_demands=tx_nG6_db::get_purge_demand_from_id( join(', ', $demand_ids));
$all_runs=array();
$all_analyses=array();
error_log("extend extend_retention_date_from_demand ". join(',',$demand_ids) . " TYPE ". $type_extend);
foreach($all_demands as $res){
if ($res["state"] != "deleted")
error_log("DEMAND ". json_encode($res) );
if ($res["demand_state"] != "deleted")
{
$all_runs=array();
$all_analyses=array();
if ($type_extend == 'extend_all_project') {
//extend all project
$curr_project_id=$res["project_id"];
$all_project_filter = " project_id =".$curr_project_id. " AND DATEDIFF( FROM_UNIXTIME( retention_date ), FROM_UNIXTIME(" .$date. ") ) <0
AND state in ('extended','stored') ";
// get all info of a project even non obsolete run analyse (by TRUE parameter)
$res_project_analyze = tx_nG6_db::select_all_in_view("tx_nG6_view_project_analyze", $all_project_filter);
$res_project_run = tx_nG6_db::select_all_in_view("tx_nG6_view_project_run", $all_project_filter);
$res_project_run_analyze = tx_nG6_db::select_all_in_view("tx_nG6_view_project_run_analyze", $all_project_filter);
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_project_analyze)) {
$all_analyses[] = $res_row["analyze_id"];
}
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_project_run_analyze)) {
$all_analyses[] = $res_row["analyze_id"];
}
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_project_run)) {
$all_runs[] = $res_row["run_id"];
}
tx_nG6_db::extend_retention_date_from_project($res["project_id"],$date, FALSE);
} else {
$all_analyses=array_merge($all_analyses,explode(',',$res["analyze_ids"]));
$all_runs=array_merge($all_runs,explode(',',$res["run_ids"]));
$all_analyses=explode(',',$res["analyze_ids"]);
$all_runs=explode(',',$res["run_ids"]);
tx_nG6_db::extend_runs_analyses ($all_runs, $all_analyses, $date);
}
}
}
tx_nG6_db::update_field('tx_nG6_purge_demand',$demand_ids,
array("processed_date","demand_state"),
array($date,"extended"));
return("Done extend");
}
function extend_retention_date_from_project($projects_ids, $date, $check_purge){
$all_project_filter = " project_id in (".$projects_ids. ") AND DATEDIFF( FROM_UNIXTIME( retention_date ), FROM_UNIXTIME(" .$date. ") ) <0
AND state in ('extended','stored') ";
$all_project=tx_nG6_db::get_purge_demand_from_id( join(', ', $demand_ids));
$res_project_analyze = tx_nG6_db::select_all_in_view("tx_nG6_view_project_analyze", $all_project_filter);
$res_project_run = tx_nG6_db::select_all_in_view("tx_nG6_view_project_run", $all_project_filter);
$res_project_run_analyze = tx_nG6_db::select_all_in_view("tx_nG6_view_project_run_analyze", $all_project_filter);
$purge_ids=Array();
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_project_analyze)) {
$all_analyses[] = $res_row["analyze_id"];
if ($res_row["purge_demand_id"] != NULL) {
$purge_ids[] = $res_row["purge_demand_id"];
}
}
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_project_run_analyze)) {
$all_analyses[] = $res_row["analyze_id"];
if ($res_row["purge_demand_id"] != NULL) {
$purge_ids[] = $res_row["purge_demand_id"];
}
}
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_project_run)) {
$all_runs[] = $res_row["run_id"];
if ($res_row["purge_demand_id"] != NULL) {
$purge_ids[] = $res_row["purge_demand_id"];
}
}
tx_nG6_db::extend_runs_analyses ($all_runs, $all_analyses, $date);
if ($check_purge == True){
$purge_uniq = array_unique ($purge_ids);
if (count($purge_uniq) > 0) {
tx_nG6_db::update_field('tx_nG6_purge_demand',$purge_uniq,
array("processed_date","demand_state"),
array($date,"extended"));
}
}
}
function extend_runs_analyses($all_runs, $all_analyses, $date){
error_log("extend RUNS ". join(',',$all_runs)." - ANALYSES : " . join(',',$all_analyses));
tx_nG6_db::update_field('tx_nG6_run', $all_runs,
array("retention_date","data_state", "mail_sent_date","purge_demand_id"),
array($date,"extended","","NULL"),
......@@ -472,12 +519,7 @@ INNER JOIN fe_groups ON fe_groups.uid = fe_users.usergroup',
array("retention_date","data_state", "mail_sent_date","purge_demand_id"),
array($date,"extended","","NULL"),
array("purge_demand_id"));
tx_nG6_db::update_field('tx_nG6_purge_demand',$demand_ids,
array("processed_date","demand_state"),
array($date,"extended"));
return("Done extend");
}
}
function delete_purge_demand($demand_ids,$user_login, $user_pwd, $data_folder){
$date= time();
......@@ -583,7 +625,22 @@ INNER JOIN fe_groups ON fe_groups.uid = fe_users.usergroup',
return ($by_location);
}
}
function select_all_projects(){
$result=Array();
$queryParts = array(
'SELECT' => 'tx_nG6_project.uid as pid, tx_nG6_project.name as project_name ',
'FROM' => 'tx_nG6_project ',
'WHERE' => "",
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$results[] = $res_row;
}
return($results);
}
function select_projects_evolution($values, $by, $role, $cumulate) {
if ($by == "organism" || $by == "location") {
$by = "tx_nG6_".$by;
......
......@@ -178,7 +178,7 @@ class tx_nG6_utils {
return $value;
}
function get_purge_email($project_name, $project_id, $nb_run_purgeable,$nb_analyse_purgeable, $demand_id,
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) {
......@@ -187,7 +187,7 @@ Dear user,
The two years data storage period of your ###PROJECT_NAME### project (###nb_run### run(s) and ###nb_analyse### analyse(s)) is ended.
This purge alert No ###DEMAND_ID### corresponds to ###PURGEABLE_SIZE### purgeable data on ###PROJECT_SIZE### of whole project see list of impacted files below.
This purge alert No ###DEMAND_ID### corresponds to ###SIZE_STR### see list of impacted files below.
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 (###URL_PRICE###) and reply to this email with the following information:
......@@ -207,13 +207,17 @@ Files impacted of:
- runs names: ###RUNS_LIST###
- analyses ids: ###ANALYSES_LIST###
';
$size_str = $purgeable_size . " purgeable data on ". $project_size ." of whole project";
if ($purgeable_size == $project_size) {
$size_str = "whole project (".$purgeable_size . ")";
}
$search=array("###nb_run###","###nb_analyse###","###PROJECT_NAME###","###PROJET_ID###","###DEMAND_ID###",
"###EMAILS###","###RUNS_LIST###","###ANALYSES_LIST###","###PURGEABLE_SIZE###", "###PROJECT_SIZE###",
"###EMAILS###","###RUNS_LIST###","###ANALYSES_LIST###","###SIZE_STR###",
"###EXTENSION_DURATION###","###EXTENSION_SIZE###","###URL_PRICE###","###PURGE_DELAY###");
$replace=array($nb_run_purgeable,$nb_analyse_purgeable,$project_name,$project_id, $demand_id ,
$emails, $runs_list, $analyse_list, $purgeable_size,$project_size,
$emails, $runs_list, $analyse_list, $size_str,
$min_extention_duration, $min_extention_size, $url_price, $purge_delay);
$mail=str_replace($search, $replace, $template_mail);
......
......@@ -44,7 +44,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<li><a href="#wf_monitoring" data-toggle="tab">Workflows monitoring</a></li>
<li><a href="#project_data_management" data-toggle="tab">Mail obsolete project</a></li>
<li><a href="#purge_demand_management" data-toggle="tab">Process mail demands</a></li>
<li><a href="#list_all_project" data-toggle="tab">Extend project</a></li>
<li><a href="#all_project_extention" data-toggle="tab">Extend project</a></li>
</ul>
<div id="myTabContent" class="tab-content">
......@@ -444,8 +444,46 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</table>
</div> <!--end purge_demand_list-->
</div> <!--purge demand management-->
</div> <!--Extend projects-->
<div class="tab-pane fade" id="all_project_extention">
<div>
<p>
Following table contains all projects.</br>
</p>
</div>
<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">
<table class="table table-striped table-bordered dataTable" id="data_table_allproject">
<thead>
<tr>
<th><center><input type="checkbox" id="all_chk_project"></center></th>
<th>Project name</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<th align="left" colspan="2">
<div style="float: left;">
Select extention date :
<input id="input_extend_all_project" class="form-control" type="text" value="" data-date-format="dd/mm/yyyy" data-provide="datepicker" name="change_retention_date"/>
</div>
<div class="btn-group" style="float: right;">
<button id="btn_extend_all_project" type="button" class="btn btn-sm btn-default"><i class="glyphicon glyphicon-pencil"></i> Extend retention date </button>
</div>
</th>
</tr>
</tfoot>
</table>
</div> <!--all_project_list-->
</div> <!--Extend projects-->
</div>
......
......@@ -102,7 +102,7 @@ class tx_nG6_pi6 extends tslib_pibase {
return $smarty->fetch('administration_view.tpl');
}
function send_purge_demand_mail($user_id,$project_ids) {
function send_purge_demand_mail($project_ids) {
$project_name="";
foreach(explode(",", $project_ids) as $project_id){
......@@ -161,7 +161,7 @@ class tx_nG6_pi6 extends tslib_pibase {
//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_email($p[$project_id]["project_name"],$project_id, $nb_run_purgeable,$nb_analyse_purgeable, $purge_demand_id,
$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['TYPO3_CONF_VARS']['EXT']['extConf']['ng6']['delay_purge'],
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ng6']['extension_url_price'], $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ng6']['min_extension_duration'],
......@@ -174,11 +174,34 @@ class tx_nG6_pi6 extends tslib_pibase {
#TODO Uncomment
$to = "celine.noirot@inra.fr";
mail($to, $subject, $mail, implode("\r\n", $headers));
}
return implode("\r\n", $headers).$mail;
//TODO check return function mail ok
}
return "Mail sent";
}
function resend_purge_demand_mail ($demands_id) {
$res_demands = tx_nG6_db::get_purge_demand_from_id($demands_id);
foreach($res_demands as $res_demand){
$res_project = tx_nG6_db::select_project($res_demand["project_id"]);
$total_project_size = tx_nG6_db::get_project_size($res_demand["project_id"], true) ;
$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['TYPO3_CONF_VARS']['EXT']['extConf']['ng6']['delay_purge'],
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ng6']['extension_url_price'], $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ng6']['min_extension_duration'],
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ng6']['min_extension_size'], "This email was send to ". join(', ',$res_demand["emails"]).". ", $res_demand["run_ids"], $res_demand["analyze_ids"]);
$subject = '[nG6 purge / reminder] No '.$res_demand["demand_id"].' - Project '.$res_project["name"];
$headers[] = 'From: '.$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ng6']['email_from'];
$headers[] = 'X-Mailer: PHP/' . phpversion();
$to= join(",",$res_demand["emails"]);
#TODO Uncomment
$to = "celine.noirot@inra.fr";
mail($to, $subject, $mail, implode("\r\n", $headers));
}
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/nG6/pi6/class.tx_nG6_pi6.php']) {
......
......@@ -333,7 +333,6 @@ $(function () {
* OBSOLETE PROJECT MANAGEMENT / PURGE DEMAND MANAGEMENT
*
***************************************/
$("#purge_demand_error").fadeOut();
/* init datatable */
var purge_table = {};
purge_table["obsolete"] = $("#data_table_obsolete").DataTable({
......@@ -351,14 +350,20 @@ $(function () {
},
"order": [[ 1, "asc" ]],
"columns": [
{ "orderable": false , className: 'select-checkbox' },
null,null,null,null,null,null]
});
{ "orderable": false },
null,null,null,null,null,null]});
purge_table["allproject"] = $("#data_table_allproject").DataTable({});
//Load data
refresh_project_obsolete(purge_table["obsolete"]);
refresh_purge_demand(purge_table["demand"]);
/****************************************
* tab mail obsolete project
***************************************/
//filtre table obsolete
$("#refresh_obsolete_list_btn").click(function(){
refresh_project_obsolete(purge_table["obsolete"]);
......@@ -380,19 +385,24 @@ $(function () {
success: function(val, status, xhr) {
refresh_project_obsolete(purge_table["obsolete"]);
refresh_purge_demand(purge_table["demand"]);
$("#purge_demand_error").hide()
},
error: function(returnval){
//TODO Afficher alerte en cas d'erreur de mail
$('#data_table_obsolete_wait').hide();
$('#obsolete_list').show();
$("#purge_demand_error").html("<div class='tx-nG6-pi6-error'>Error mail sending.</div>");
$("#purge_demand_error").show();
$('#obsolete_list').show();
}
});
});
/****************************************
* tab process mail demand
***************************************/
//resend email
$("#btn_demand_resend_mail").click(function(){
var demands = getPurgeDatatableCheckedValue(purge_table["demand"],"demand");
$.ajax({
url: "index.php?eID=tx_nG6&type=purge_managment_resend_mail&purge_demand="+demands.join(',')+"&user_id="+$('input[id=user_id]').val(),
......@@ -432,7 +442,7 @@ $(function () {
$("#ng6modal").modal();
var demands = [];
$("#modal-btn-purge").click( function() {
demands = getDatatableCheckedValue(purge_table["demand"], "demand");
demands = getPurgeDatatableCheckedValue(purge_table["demand"], "demand");
var val_url = "index.php?eID=tx_nG6&type=delete_purge_data&purge_demand=" + demands.join(',');
val_url += "&user_login=" + $("#user_login_val").val() + "&user_pwd=" + $("#user_pwd_val").val();
val_url += "&user_id="+$("#user_id").val() +"&data_folder=" + $("#data_folder").val() ;
......@@ -478,13 +488,29 @@ $(function () {
});
// Extend retention after selecting list of ids demand
// Extend retention date after selecting list of ids demand
$("#btn_demand_retention").click(function(){
var demands=Array();
demands = getPurgeDatatableCheckedValue(purge_table["demand"],"demand");
extend_date(demands.join(','),purge_table["demand"],purge_table["obsolete"]);
extend_date_from_demand(demands.join(','),purge_table["demand"],purge_table["obsolete"]);
});
$("#input_extend_all_project").change(function(){
$("#btn_extend_all_project").prop('disabled', false);
});
// Extend retention date with list of project_id
$("#btn_extend_all_project").click(function(){
var projects = getPurgeDatatableCheckedValue(purge_table["allproject"],"allproject"),
date = $("#input_extend_all_project").val()
extend_date_from_project(projects.join(','),purge_table);
});
/****************************************
* tab all project extention
***************************************/
$("#btn_extend_all_project").prop('disabled', true);
refreshAllProjectDatatable(purge_table["allproject"]);
/***** DataTable Obsolete & Demand chek all ****/
$("[id^=all_chk_]").change(function(){
var type = $(this).attr("id").split("_")[2];
......@@ -493,8 +519,34 @@ $(function () {
//updateDatatableButton(purge_table[type],type);
});
});
function extend_date(list_ids, purge_demand_datatable, obsolete_project_datatable){
/****************************************
* END init 3 tabs of purge
***************************************/
function refreshAllProjectDatatable(allproject_datatble){
$("#all_project_error").hide();
$("#all_project_wait").show();
$.ajax({
url: "index.php?eID=tx_nG6&type=get_all_project",
dataType: 'json',
success: function(val, status, xhr) {
oTable = allproject_datatble;
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>"];
oTable.row.add(row);
});
oTable.draw();
$('#purge_demand_list').show();
$('#all_project_error').hide();
$("#all_project_wait").hide();
$('#input_extend_all_project').val("");
}
});
}
function extend_date_from_demand(list_ids, purge_demand_datatable, obsolete_project_datatable){
if(list_ids == ""){
window.alert("You must select or enter purge demand. ");
return 0;
......@@ -528,8 +580,9 @@ $(function () {
$('#data_table_purge_demand_wait').show();
$('#purge_demand_list').hide();
$('#purge_demand_error').hide();
$.ajax({
url: "index.php?eID=tx_nG6&type=extend_retention_date&purge_demand="+list_ids+"&date_value="+date_send+"&user_id="+$('input[id=user_id]').val()+'&type_extend='+type_extend,
url: "index.php?eID=tx_nG6&type=extend_retention_date_from_demand&purge_demand="+list_ids+"&date_value="+date_send+"&user_id="+$('input[id=user_id]').val()+'&type_extend='+type_extend,
dataType: 'json',
success: function(val, status, xhr) {
$("#ng6modal").modal('hide');
......@@ -538,6 +591,9 @@ $(function () {
},
error: function(val) {
//TO PRINT ERROR
$('#purge_demand_error').html ('Error while extend date ' + val );
$('#purge_demand_error').show();
$("#ng6modal").modal('hide');
}
......@@ -545,10 +601,49 @@ $(function () {
});
});
}
function extend_date_from_project(list_ids, purge_tables){
if(list_ids == ""){
window.alert("You must select a project. ");
return 0;
}
$('#data_table_all_project_wait').show();
$('#all_project_wait').show();
$('#all_project_error').hide();
date_send = $("#input_extend_all_project").val();
$.ajax({
url: "index.php?eID=tx_nG6&type=extend_retention_date_from_project&projects_id="+list_ids+"&date_value="+date_send+"&user_id="+$('input[id=user_id]').val(),
dataType: 'json',
success: function(val, status, xhr) {
$('#data_table_all_project_wait').hide();
refresh_purge_demand(purge_tables["demand"]);
refresh_project_obsolete(purge_tables["obsolete"]);
$('#all_project_wait').hide();
$("#modal-label-tmpl").html("Extention");
$("#modal-body-tmpl").html("Project(s) extended");
$("#modal-foot-tmpl").html('<button id="modal-btn-ok" class="btn btn-primary">OK</button>');
$("#ng6modal").modal();
$("#modal-btn-ok").click( function() {
$(':checked[id^=chk_allproject_]').each(function(i){
$(this).prop('checked', false);
});
$('#input_extend_all_project').val("");
$("#ng6modal").modal('hide');
});
},
error: function(val) {
$('#data_table_all_project_wait').hide();
$('#all_project_error').html ('Error while extend date ' + val );
$('#all_project_error').show();
}
});
}
function refresh_purge_demand(purge_demand_datatable){
var purge_delay=$("#purge_delay").val();
$("#purge_demand_error").hide();
$('#data_table_purge_demand_wait').show();
$('#purge_demand_list').hide();
......@@ -692,41 +787,40 @@ $(function () {
}
});
}
/*
* Retrieve checked values for data managment
*/
function getPurgeDatatableCheckedValue(oTable, type){
var values = new Array();
$.each(oTable.rows({search: 'applied'}).nodes(), function(idx, node){
$(node)
.find('input[type=checkbox][class=chk_'+type+']:checked')
.each(function(idx,element){
values.push($(this).val());
});
});
return values
}
/*
* Handle buttons of datatables for data managment
*/
function updateDatatableButton(oTable, type){
var values = new Array();