2015-04-13 10:18:15 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* LibreNMS
|
|
|
|
*
|
|
|
|
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
|
|
|
|
*
|
|
|
|
* 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. Please see LICENSE.txt at the top level of
|
|
|
|
* the source code distribution for details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
$pagetitle[] = "Alert Schedule";
|
2015-04-13 17:48:49 +01:00
|
|
|
$no_refresh = TRUE;
|
2015-04-19 00:43:16 +01:00
|
|
|
if(is_admin() !== false) {
|
2015-04-13 10:18:15 +01:00
|
|
|
|
2015-04-19 20:23:34 +01:00
|
|
|
require_once("includes/modal/alert_schedule.inc.php");
|
|
|
|
require_once("includes/modal/remove_alert_schedule.inc.php");
|
2015-04-13 10:18:15 +01:00
|
|
|
|
2015-04-19 20:23:34 +01:00
|
|
|
?>
|
2015-04-13 10:18:15 +01:00
|
|
|
|
2015-04-13 17:48:49 +01:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<span id="message"></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2015-04-13 10:18:15 +01:00
|
|
|
|
|
|
|
<div class="panel panel-default panel-condensed">
|
|
|
|
<div class="table-responsive">
|
|
|
|
<table id="alert-schedule" class="table table-condensed">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2015-04-19 20:23:34 +01:00
|
|
|
<th data-column-id="title">Title</th>
|
|
|
|
<th data-column-id="start" data-order="desc">Start</th>
|
2015-04-13 10:18:15 +01:00
|
|
|
<th data-column-id="end">End</th>
|
2015-04-19 00:43:16 +01:00
|
|
|
<th data-column-id="actions" data-sortable="false" data-searchable="false" data-formatter="commands">Actions</th>
|
2015-04-13 10:18:15 +01:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
var grid = $("#alert-schedule").bootgrid({
|
|
|
|
ajax: true,
|
2015-04-19 00:43:16 +01:00
|
|
|
formatters: {
|
|
|
|
"commands": function(column, row)
|
|
|
|
{
|
2015-04-19 20:23:34 +01:00
|
|
|
if (row.status == 1) {
|
|
|
|
return '<button type="button" class="btn btn-xs btn-danger" disabled>Lapsed</button>';
|
|
|
|
} else {
|
|
|
|
var response = "<button type=\"button\" class=\"btn btn-xs btn-primary command-edit\" data-toggle='modal' data-target='#schedule-maintenance' data-schedule_id=\"" + row.id + "\"><span class=\"fa fa-pencil\"></span></button> " +
|
|
|
|
"<button type=\"button\" class=\"btn btn-xs btn-danger command-delete\" data-schedule_id=\"" + row.id + "\"><span class=\"fa fa-trash-o\"></span></button>";
|
|
|
|
if (row.status == 2) {
|
|
|
|
response = response + ' <button type="button" class="btn btn-xs btn-success" disabled>Current</button>';
|
|
|
|
}
|
|
|
|
return response;
|
|
|
|
}
|
2015-04-19 00:43:16 +01:00
|
|
|
}
|
|
|
|
},
|
2015-04-13 10:18:15 +01:00
|
|
|
templates: {
|
|
|
|
header: "<div id=\"{{ctx.id}}\" class=\"{{css.header}}\"><div class=\"row\">"+
|
|
|
|
"<div class=\"col-sm-8 actionBar\"><span class=\"pull-left\">"+
|
|
|
|
"<button type=\"button\" class=\"btn btn-primary btn-sm\" data-toggle=\"modal\" data-target=\"#schedule-maintenance\">Schedule maintenance</button>"+
|
|
|
|
"</span></div>"+
|
|
|
|
"<div class=\"col-sm-4 actionBar\"><p class=\"{{css.search}}\"></p><p class=\"{{css.actions}}\"></p></div></div></div>"
|
|
|
|
},
|
|
|
|
rowCount: [50,100,250,-1],
|
|
|
|
post: function ()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
id: "alert-schedule",
|
|
|
|
};
|
|
|
|
},
|
|
|
|
url: "/ajax_table.php"
|
2015-04-19 00:43:16 +01:00
|
|
|
}).on("loaded.rs.jquery.bootgrid", function()
|
|
|
|
{
|
|
|
|
/* Executes after data is loaded and rendered */
|
|
|
|
grid.find(".command-edit").on("click", function(e)
|
|
|
|
{
|
|
|
|
$('#schedule_id').val($(this).data("schedule_id"));
|
|
|
|
$("#schedule-maintenance").modal('show');
|
|
|
|
}).end().find(".command-delete").on("click", function(e)
|
|
|
|
{
|
2015-04-19 20:23:34 +01:00
|
|
|
$('#del_schedule_id').val($(this).data("schedule_id"));
|
|
|
|
$('#delete-maintenance').modal('show');
|
2015-04-13 10:18:15 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
2015-04-19 00:43:16 +01:00
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|