Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated services edit / delete pages #1076

Merged
merged 1 commit into from May 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion html/css/dark.css
Expand Up @@ -14,6 +14,10 @@
color: #357ebd;
}

.fa-col-danger {
color: #e30613;
}

.twitter-typeahead .tt-hint {
border-color: #000 !important;
}
Expand Down Expand Up @@ -93,4 +97,4 @@
@keyframes pace-spinner {
0% { transform: rotate(0deg); transform: rotate(0deg); }
100% { transform: rotate(360deg); transform: rotate(360deg); }
}
}
6 changes: 5 additions & 1 deletion html/css/light.css
Expand Up @@ -14,6 +14,10 @@
color: #357ebd;
}

.fa-col-danger {
color: #e30613;
}

.pace {
-webkit-pointer-events: none;
pointer-events: none;
Expand Down Expand Up @@ -89,4 +93,4 @@
@keyframes pace-spinner {
0% { transform: rotate(0deg); transform: rotate(0deg); }
100% { transform: rotate(360deg); transform: rotate(360deg); }
}
}
6 changes: 5 additions & 1 deletion html/css/mono.css
Expand Up @@ -14,6 +14,10 @@
color: #357ebd;
}

.fa-col-danger {
color: #e30613;
}

.twitter-typeahead .tt-hint {
border-color: #000 !important;
}
Expand Down Expand Up @@ -93,4 +97,4 @@
@keyframes pace-spinner {
0% { transform: rotate(0deg); transform: rotate(0deg); }
100% { transform: rotate(360deg); transform: rotate(360deg); }
}
}
3 changes: 2 additions & 1 deletion html/includes/print-menubar.php
Expand Up @@ -185,7 +185,8 @@
echo('
<li role="presentation" class="divider"></li>
<li><a href="addsrv/"><i class="fa fa-cog fa-col-success fa-fw fa-lg"></i> Add Service</a></li>
<li><a href="delsrv/"><i class="fa fa-cog fa-col-info fa-fw fa-lg"></i> Delete Service</a></li>');
<li><a href="editsrv/"><i class="fa fa-cog fa-col-primary fa-fw fa-lg"></i> Edit Service</a></li>
<li><a href="delsrv/"><i class="fa fa-cog fa-col-danger fa-fw fa-lg"></i> Delete Service</a></li>');
}
?>
</ul>
Expand Down
54 changes: 54 additions & 0 deletions html/includes/print-service-add.inc.php
@@ -0,0 +1,54 @@
<?php

echo("
<h3><span class='label label-success threeqtr-width'>Add Service</span></h3>
<form id='addsrv' name='addsrv' method='post' action='' class='form-horizontal' role='form'>
<div class='well well-lg'>
<div class='form-group'>
<input type='hidden' name='addsrv' value='yes'>
<label for='device' class='col-sm-2 control-label'>Device</label>
<div class='col-sm-5'>
<select name='device' class='form-control input-sm'>
$devicesform
</select>
</div>
<div class='col-sm-5'>
</div>
</div>
<div class='form-group'>
<label for='type' class='col-sm-2 control-label'>Type</label>
<div class='col-sm-5'>
<select name='type' id='type' class='form-control input-sm'>
$servicesform
</select>
</div>
<div class='col-sm-5'>
</div>
</div>
<div class='form-group'>
<label for='descr' class='col-sm-2 control-label'>Description</label>
<div class='col-sm-5'>
<textarea name='descr' id='descr' class='form-control input-sm' rows='5'></textarea>
</div>
<div class='col-sm-5'>
</div>
</div>
<div class='form-group'>
<label for='ip' class='col-sm-2 control-label'>IP Address</label>
<div class='col-sm-5'>
<input name='ip' id='ip' class='form-control input-sm' placeholder='IP Address'>
</div>
<div class='col-sm-5'>
</div>
</div>
<div class='form-group'>
<label for='params' class='col-sm-2 control-label'>Parameters</label>
<div class='col-sm-5'>
<input name='params' id='params' class='form-control input-sm'>
</div>
<div class='col-sm-5'>
</div>
</div>
<button type='submit' name='Submit' class='btn btn-success input-sm'>Add Service</button>
</div>
</form>");
35 changes: 35 additions & 0 deletions html/includes/print-service-edit.inc.php
@@ -0,0 +1,35 @@
<?php

if (isset($_POST['service']) && is_numeric($_POST['service'])) {

$service = dbFetchRow("SELECT * FROM `services` WHERE `service_id`=?", array($_POST['service']));

echo("
<h3><span class='label label-primary threeqtr-width'>Edit Service</span></h3>
<form id='confirm-editsrv' name='confirm-editsrv' method='post' action='' class='form-horizontal' role='form'>
<input type='hidden' name='device' value='" . $service['device_id'] . "'>
<input type='hidden' name='service' value='" . $service['service_id'] . "'>
<div class='well well-lg'>
<div class='form-group'>
<label for='descr' class='col-sm-2 control-label'>Description</label>
<div class='col-sm-5'>
<textarea name='descr' id='descr' class='form-control input-sm' rows='5'>" . $service['service_desc'] . "</textarea>
</div>
</div>
<div class='form-group'>
<label for='ip' class='col-sm-2 control-label'>IP Address</label>
<div class='col-sm-5'>
<input name='ip' id='ip' value='" . $service['service_ip'] . "' class='form-control input-sm' placeholder='IP Address'>
</div>
</div>
<div class='form-group'>
<label for='params' class='col-sm-2 control-label'>Parameters</label>
<div class='col-sm-5'>
<input name='params' id='params' value='" . $service['service_param'] . "' class='form-control input-sm'>
</div>
</div>
<button type='submit' id='confirm-editsrv' name='confirm-editsrv' value='yes' class='btn btn-primary input-sm'>Edit Service</button>
</div>
</form>");

}
10 changes: 10 additions & 0 deletions html/includes/service-add.inc.php
@@ -0,0 +1,10 @@
<?php

$updated = '1';

$service_id = add_service(mres($_POST['device']), mres($_POST['type']), mres($_POST['descr']), mres($_POST['ip']), mres($_POST['params']));

if ($service_id) {
$message .= $message_break . "Service added (".$service_id.")!";
$message_break .= "<br />";
}
5 changes: 5 additions & 0 deletions html/includes/service-edit.inc.php
@@ -0,0 +1,5 @@
<?php

$updated = '1';

$updated = edit_service(mres($_POST['service']), mres($_POST['descr']), mres($_POST['ip']), mres($_POST['params']));
60 changes: 8 additions & 52 deletions html/pages/addsrv.inc.php
Expand Up @@ -44,58 +44,14 @@

$pagetitle[] = "Add service";

echo("
<h4>Add Service</h4>
<form id='addsrv' name='addsrv' method='post' action='' class='form-horizontal' role='form'>
<div class='well well-lg'>
<div class='form-group'>
<input type='hidden' name='addsrv' value='yes'>
<label for='device' class='col-sm-2 control-label'>Device</label>
<div class='col-sm-5'>
<select name='device' class='form-control input-sm'>
$devicesform
</select>
</div>
<div class='col-sm-5'>
</div>
</div>
<div class='form-group'>
<label for='type' class='col-sm-2 control-label'>Type</label>
<div class='col-sm-5'>
<select name='type' id='type' class='form-control input-sm'>
$servicesform
</select>
</div>
<div class='col-sm-5'>
</div>
</div>
<div class='form-group'>
<label for='descr' class='col-sm-2 control-label'>Description</label>
<div class='col-sm-5'>
<textarea name='descr' id='descr' class='form-control input-sm' rows='5'></textarea>
</div>
<div class='col-sm-5'>
</div>
</div>
<div class='form-group'>
<label for='ip' class='col-sm-2 control-label'>IP Address</label>
<div class='col-sm-5'>
<input name='ip' id='ip' class='form-control input-sm' placeholder='IP Address'>
</div>
<div class='col-sm-5'>
</div>
</div>
<div class='form-group'>
<label for='params' class='col-sm-2 control-label'>Parameters</label>
<div class='col-sm-5'>
<input name='params' id='params' class='form-control input-sm'>
</div>
<div class='col-sm-5'>
</div>
</div>
<button type='submit' name='Submit' class='btn btn-default input-sm'>Add Service</button>
</div>
</form>");
echo "<div class='row'>
<div class='col-sm-6'>";

require_once "includes/print-service-add.inc.php";

echo "</div>
</div>";


}

Expand Down
2 changes: 1 addition & 1 deletion html/pages/delsrv.inc.php
Expand Up @@ -37,7 +37,7 @@
<div class='col-sm-5'>
</div>
</div>
<button type='submit' name='Submit' class='btn btn-default input-sm'>Delete</button>
<button type='submit' name='Submit' class='btn btn-danger input-sm'>Delete</button>
</div>
</form>");

Expand Down
2 changes: 1 addition & 1 deletion html/pages/device/edit.inc.php
Expand Up @@ -25,7 +25,7 @@
$panes['alert-rules'] = 'Alert Rules';
$panes['modules'] = 'Modules';

if ($config['enable_services'])
if ($config['show_services'])
{
$panes['services'] = 'Services';
}
Expand Down