System will be undergoing maintenance on November 24th from 20:00 CET to November 25th 05:00 CET Some downtime might happen. Sorry for the inconvenience.

Commit 0537927a authored by Bastien Pujos's avatar Bastien Pujos

Add tracking on notification rule (export, index, rules)

parent b7f482e1
......@@ -155,6 +155,7 @@
"label.admin_notifier.rules.type": "Type",
"label.admin_notifier.service" : "Règles des services",
"label.admin_notifier.title": "Notifications avancées",
"label.admin_notifier.rules.track": "Suivi",
"label.admin_process.title": "Gestion des processus",
"label.admin_user.ldap_log": "Login LDAP",
"label.admin_user.select": "Sélectionner",
......
......@@ -155,6 +155,7 @@
"label.admin_notifier.rules.type": "Rule Type",
"label.admin_notifier.service" : "Service rules",
"label.admin_notifier.title": "Advanced Notifications",
"label.admin_notifier.rules.track": "Tracking",
"label.admin_process.title": "Process management",
"label.admin_user.ldap_log": "LDAP login",
"label.admin_user.select": "Select",
......
......@@ -95,7 +95,7 @@ $node_service = $notifier_rules->createElement("service");
$node_rules->appendchild($node_service);
$rules_sql="SELECT rules.id,rules.name as name,rules.type as type,debug,contact,host,service,state,notificationnumber,
timeperiods.daysofweek as daysofweek, timeperiods.timeperiod as timeperiod, GROUP_CONCAT(methods.name) as methods
timeperiods.daysofweek as daysofweek, timeperiods.timeperiod as timeperiod, rules.tracking as tracking, GROUP_CONCAT(methods.name) as methods
FROM rules,timeperiods,methods,rule_method
WHERE rules.timeperiod_id=timeperiods.id
AND rules.id = rule_method.rule_id
......@@ -107,7 +107,7 @@ $rules_sql="SELECT rules.id,rules.name as name,rules.type as type,debug,contact,
$rules_req = sqlrequest($database_notifier,$rules_sql);
while($rule = mysqli_fetch_array($rules_req)) {
$rule_line="\n\t".$rule["debug"].":".$rule["contact"].":".$rule["host"].":".$rule["service"].":".$rule["state"];
$rule_line.=":".$rule["daysofweek"].":".$rule["timeperiod"].":".$rule["notificationnumber"].":".$rule["methods"];
$rule_line.=":".$rule["daysofweek"].":".$rule["timeperiod"].":".$rule["notificationnumber"].":".$rule["methods"].":".$rule["tracking"];
if($rule["type"]=="host") {
$rule_host = $notifier_rules->createTextNode($rule_line);
$node_host->appendchild($rule_host);
......
......@@ -154,7 +154,7 @@ if(isset($_GET["action"])) {
if($action==null or $action =="rules") {
// SQL get rules
$rules_sql="SELECT rules.id,rules.name as name,debug,contact,host,service,state,notificationnumber,
timeperiods.name as timeperiod, timeperiods.id as timeperiod_id, GROUP_CONCAT(methods.name) as methods
timeperiods.name as timeperiod, timeperiods.id as timeperiod_id, rules.tracking as tracking, GROUP_CONCAT(methods.name) as methods
FROM rules,timeperiods,methods,rule_method
WHERE rules.timeperiod_id=timeperiods.id
AND rules.id = rule_method.rule_id
......@@ -185,6 +185,7 @@ if(isset($_GET["action"])) {
<th> <?php echo getLabel("label.admin_notifier.notification"); ?> </th>
<th> <?php echo getLabel("label.admin_notifier.notifperiod"); ?> </th>
<th> <?php echo getLabel("label.admin_notifier.methods.menu"); ?> </th>
<th> <?php echo getLabel("label.admin_notifier.rules.track"); ?> </th>
<th> <?php echo getLabel("label.admin_notifier.move"); ?> </th>
</tr>
</thead>
......@@ -206,6 +207,7 @@ if(isset($_GET["action"])) {
<td><?php echo $line["notificationnumber"]; ?></td>
<td><a href="timeperiods.php?id=<?php echo $line["timeperiod_id"]; ?>"><?php echo $line["timeperiod"]; ?></a></td>
<td><?php echo $line["methods"]; ?></td>
<td><?php echo $line["tracking"]; ?></td>
<td>
<a class="up" href="javascript:void(0)"><i class="fa fa-arrow-up"></i></a>
<a class="down" href="javascript:void(0)"><i class="fa fa-arrow-down"></i></a>
......@@ -247,6 +249,7 @@ if(isset($_GET["action"])) {
<th> <?php echo getLabel("label.admin_notifier.notification"); ?> </th>
<th> <?php echo getLabel("label.admin_notifier.notifperiod"); ?> </th>
<th> <?php echo getLabel("label.admin_notifier.methods.menu"); ?> </th>
<th> <?php echo getLabel("label.admin_notifier.rules.track"); ?> </th>
<th> <?php echo getLabel("label.admin_notifier.move"); ?> </th>
</tr>
</thead>
......@@ -268,6 +271,7 @@ if(isset($_GET["action"])) {
<td><?php echo $line["notificationnumber"]; ?></td>
<td><a href="timeperiods.php?id=<?php echo $line["timeperiod_id"]; ?>"><?php echo $line["timeperiod"]; ?></a></td>
<td><?php echo $line["methods"]; ?></td>
<td><?php echo $line["tracking"]; ?></td>
<td>
<a class="up" href="javascript:void(0)"><i class="fa fa-arrow-up"></i></a>
<a class="down" href="javascript:void(0)"><i class="fa fa-arrow-down"></i></a>
......
......@@ -89,6 +89,11 @@ function get_field($field1, $base=false, $field2=false) {
}
}
$rule_track=0;
if(isset($_POST['rule_track'])){
$rule_track=$_POST['rule_track'];
}
// Hosts
$rule_host="-";
if(!empty($_POST['host'])){
......@@ -197,7 +202,7 @@ function get_field($field1, $base=false, $field2=false) {
$sql_sort_key = sqlrequest($database_notifier,"select max(sort_key+1) as sort_key from rules where type='".$rule_type."'");
$rule_sort_key = mysqli_result($sql_sort_key,0,"sort_key");
$sql_add = "INSERT INTO rules VALUES('','".$rule_name."','".$rule_type."','".$rule_debug."','".$rule_contact."',
'".$rule_host."','".$rule_service."','".$rule_state."','".$rule_notification."','".$rule_timeperiod_id."','".$rule_sort_key."')";
'".$rule_host."','".$rule_service."','".$rule_state."','".$rule_notification."','".$rule_timeperiod_id."','".$rule_sort_key."','".$rule_track."')";
$rule_id = sqlrequest($database_notifier,$sql_add,true);
$methodze=explode(",",$rule_method_ids);
foreach($methodze as $selected){
......@@ -207,7 +212,7 @@ function get_field($field1, $base=false, $field2=false) {
$rule_name_old=$rule_name;
}elseif(isset($_POST["update"])){
$sql_add = "UPDATE rules SET name='".$rule_name."', type='".$rule_type."', debug='".$rule_debug."', contact='".$rule_contact."',
host='".$rule_host."', service='".$rule_service."', state='".$rule_state."', notificationnumber='".$rule_notification."',timeperiod_id='".$rule_timeperiod_id."'
host='".$rule_host."', service='".$rule_service."', state='".$rule_state."', notificationnumber='".$rule_notification."',timeperiod_id='".$rule_timeperiod_id."', tracking='".$rule_track."'
WHERE id='".$rule_id."'";
sqlrequest($database_notifier,$sql_add);
sqlrequest($database_notifier,"DELETE FROM rule_method WHERE rule_id='".$rule_id."'",true);
......@@ -226,7 +231,7 @@ function get_field($field1, $base=false, $field2=false) {
if($rule_id) {
if(is_numeric($rule_id)) {
$rule_sql=sqlrequest($database_notifier,"SELECT rules.id,rules.name as name,rules.type as type,debug,
contact,host,service,state,notificationnumber,timeperiods.name as timeperiod,timeperiod_id,
contact,host,service,state,notificationnumber,timeperiods.name as timeperiod,timeperiod_id, rules.tracking as tracking,
GROUP_CONCAT(methods.name) as methods
FROM rules,timeperiods,methods,rule_method
WHERE rules.timeperiod_id=timeperiods.id
......@@ -249,6 +254,7 @@ function get_field($field1, $base=false, $field2=false) {
$rule_timeperiod=mysqli_result($rule_sql,0,"timeperiod");
$rule_timeperiod_id=mysqli_result($rule_sql,0,"timeperiod_id");
$rule_method_names=mysqli_result($rule_sql,0,"methods");
$rule_track=mysqli_result($rule_sql,0,"tracking");
} else {
message(7," : Rule does not exist",'warning');
}
......@@ -445,6 +451,15 @@ function get_field($field1, $base=false, $field2=false) {
</div>
</div>
<div class="row form-group">
<label class="col-md-3"><?php echo getLabel("label.admin_notifier.rules.track") ?></label>
<div class="col-md-9">
<div class="checkbox">
<label><input class="checkbox" type="checkbox" <?php if(isset($rule_track) && $rule_track==1){ echo "checked"; } ?> value=1 name="rule_track"></label>
</div>
</div>
</div>
<div class="form-group">
<?php
if (isset($rule_id) && $rule_id != null) {
......
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