Commit 4637df24 authored by Jason Frisvold's avatar Jason Frisvold
Browse files

- Drop downs for server, target, and scan type

parent 6dd6ac30
......@@ -219,6 +219,52 @@
$app->get('/edit-schedule', $isauthenticated(), function () use ($app) {
global $smarty_data;
$results = $app->db->table('cloud')
->select('id', 'server_ip', 'disabled')
->get();
$servers = Array();
foreach ($results as $row) {
if ($row['disabled']) {
$servers[$row['id']] = long2ip($row['server_ip']) . ' (Disabled)';
} else {
$servers[$row['id']] = long2ip($row['server_ip']);
}
}
$results = $app->db->table('target')
->select('id', 'address', 'cidr', 'disabled')
->get();
$targets = Array();
foreach ($results as $row) {
if ($row['disabled']) {
$targets[$row['id']] = long2ip($row['address']) . '/' . $row['cidr'] . ' (Disabled)';
} else {
$targets[$row['id']] = long2ip($row['address']) . '/' . $row['cidr'];
}
}
$results = $app->db->table('spawn')
->select('id', 'description', 'disabled')
->get();
$scantypes = Array();
foreach ($results as $row) {
if ($row['disabled']) {
$scantypes[$row['id']] = $row['description'] . ' (Disabled)';
} else {
$scantypes[$row['id']] = $row['description'];
}
}
$smarty_data['servers'] = $servers;
$smarty_data['targets'] = $targets;
$smarty_data['scantypes'] = $scantypes;
prep_smarty($app);
$app->render('edit-schedule.tpl', $smarty_data);
});
......@@ -227,12 +273,57 @@
$isauthenticated(), function ($id) use ($app) {
global $smarty_data;
$results = $app->db->table('cloud')
->select('id', 'server_ip', 'disabled')
->get();
$servers = Array();
foreach ($results as $row) {
if ($row['disabled']) {
$servers[$row['id']] = long2ip($row['server_ip']) . ' (Disabled)';
} else {
$servers[$row['id']] = long2ip($row['server_ip']);
}
}
$results = $app->db->table('target')
->select('id', 'address', 'cidr', 'disabled')
->get();
$targets = Array();
foreach ($results as $row) {
if ($row['disabled']) {
$targets[$row['id']] = long2ip($row['address']) . '/' . $row['cidr'] . ' (Disabled)';
} else {
$targets[$row['id']] = long2ip($row['address']) . '/' . $row['cidr'];
}
}
$results = $app->db->table('spawn')
->select('id', 'description', 'disabled')
->get();
$scantypes = Array();
foreach ($results as $row) {
if ($row['disabled']) {
$scantypes[$row['id']] = $row['description'] . ' (Disabled)';
} else {
$scantypes[$row['id']] = $row['description'];
}
}
$result = $app->db->table('timers')
->select('id', 'cloud_id', 'spawn_id', 'target_id', 'hour', 'minute',
'day', 'month', 'description', 'disabled', 'last_modified')
->where('id', $id)
->first();
$smarty_data['servers'] = $servers;
$smarty_data['targets'] = $targets;
$smarty_data['scantypes'] = $scantypes;
$smarty_data['result'] = $result;
prep_smarty($app);
......
......@@ -38,13 +38,13 @@
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Cloud ID</span>
<input type='text' name='cloud_id' value='{$result.cloud_id|default:""}' />
{html_options name=cloud_id options=$servers selected=$result.cloud_id|default:""}
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Spawn ID</span>
<input type='text' name='spawn_id' value='{$result.spawn_id|default:""}' />
{html_options name=spawn_id options=$scantypes selected=$result.spawn_id|default:""}
</div>
</div>
</div>
......@@ -52,7 +52,7 @@
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Target ID</span>
<input type='text' name='target_id' value='{$result.target_id|default:""}' />
{html_options name=target_id options=$targets selected=$result.target_id|default:""}
</div>
</div>
<div class="col-md-4">
......
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