Commit a3e743aa authored by Jason Frisvold's avatar Jason Frisvold
Browse files

- Fix path for CSS, was incorrect when URL was multiple levels deep

- Layouts for all display and edit screens (not reports)
- Code to present necessary date to display/edit screens
parent a97e67c5
......@@ -24,6 +24,23 @@
$app->render('edit-server.tpl', $smarty_data);
});
$app->get('/edit-server/:id', $isauthenticated(), function ($id) use ($app) {
global $smarty_data;
$result = $app->db->table('cloud')
->select('id', 'server_ip', 'description', 'ssh_key', 'gpg_key',
'contact_frequency', 'config_dir', 'output_dir',
'ssh_username', 'key_type', 'last_contacted', 'disabled',
'last_modified')
->where('id', $id)
->first();
$smarty_data['result'] = $result;
prep_smarty($app);
$app->render('edit-server.tpl', $smarty_data);
});
// Edit Target Item
$app->get('/edit-target', $isauthenticated(), function () use ($app) {
global $smarty_data;
......@@ -32,6 +49,21 @@
$app->render('edit-target.tpl', $smarty_data);
});
$app->get('/edit-target/:id', $isauthenticated(), function ($id) use ($app) {
global $smarty_data;
$result = $app->db->table('target')
->select('id', 'address', 'cidr', 'description', 'disabled',
'last_modified')
->where('id', $id)
->first();
$smarty_data['result'] = $result;
prep_smarty($app);
$app->render('edit-target.tpl', $smarty_data);
});
// Edit Scan Type Item
$app->get('/edit-scantype', $isauthenticated(), function () use ($app) {
global $smarty_data;
......@@ -40,6 +72,22 @@
$app->render('edit-scantype.tpl', $smarty_data);
});
$app->get('/edit-scantype/:id',
$isauthenticated(), function ($id) use ($app) {
global $smarty_data;
$result = $app->db->table('spawn')
->select('id', 'options', 'override', 'description', 'disabled',
'last_modified')
->where('id', $id)
->first();
$smarty_data['result'] = $result;
prep_smarty($app);
$app->render('edit-scantype.tpl', $smarty_data);
});
// Edit Schedule Item
$app->get('/edit-schedule', $isauthenticated(), function () use ($app) {
global $smarty_data;
......@@ -48,4 +96,20 @@
$app->render('edit-schedule.tpl', $smarty_data);
});
?>
$app->get('/edit-schedule/:id',
$isauthenticated(), function ($id) use ($app) {
global $smarty_data;
$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['result'] = $result;
prep_smarty($app);
$app->render('edit-schedule.tpl', $smarty_data);
});
?>
\ No newline at end of file
......@@ -20,6 +20,14 @@
$app->get('/servers', $isauthenticated(), function () use ($app) {
global $smarty_data;
// Pull all data from the cloud table
$result = $app->db->table('cloud')
->select('id', 'server_ip', 'description', 'contact_frequency',
'last_contacted', 'disabled', 'last_modified')
->get();
$smarty_data['results'] = $result;
prep_smarty($app);
$app->render('servers.tpl', $smarty_data);
});
......@@ -28,6 +36,14 @@
$app->get('/targets', $isauthenticated(), function () use ($app) {
global $smarty_data;
// Pull all data from the target table
$result = $app->db->table('target')
->select('id', 'address', 'cidr', 'description', 'disabled',
'last_modified')
->get();
$smarty_data['results'] = $result;
prep_smarty($app);
$app->render('targets.tpl', $smarty_data);
});
......@@ -36,6 +52,14 @@
$app->get('/scantypes', $isauthenticated(), function () use ($app) {
global $smarty_data;
// Pull all data from the spawn table
$result = $app->db->table('spawn')
->select('id', 'options', 'override', 'description', 'disabled',
'last_modified')
->get();
$smarty_data['results'] = $result;
prep_smarty($app);
$app->render('scantypes.tpl', $smarty_data);
});
......@@ -44,6 +68,14 @@
$app->get('/schedule', $isauthenticated(), function () use ($app) {
global $smarty_data;
// Pull all data from the timers table
$result = $app->db->table('timers')
->select('id', 'cloud_id', 'spawn_id', 'target_id', 'hour', 'minute',
'day', 'month', 'disabled', 'last_modified')
->get();
$smarty_data['results'] = $result;
prep_smarty($app);
$app->render('schedule.tpl', $smarty_data);
});
......
......@@ -37,64 +37,28 @@
<div class='row'>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Server IP</span>
<input type='text' name='server_ip' value='{$server_ip|default:""}' />
<span class="input-group-addon">Options</span>
<input type='text' name='server_ip' value='{$result.options|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">SSH Key</span>
<input type='text' name='ssh_key' value='{$ssh_key|default:""}' />
<span class="input-group-addon">Override</span>
<input type='text' name='ssh_key' value='{$result.override|default:""}' />
</div>
</div>
</div>
<div class='row'>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">SSH Username</span>
<input type='text' name='ssh_username' value='{$ssh_user|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">GPG Key</span>
<input type='text' name='gpg_key' value='{$gog_key|default:""}' />
</div>
</div>
</div>
<div class='row'>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Config Directory</span>
<input type='text' name='config_dir' value='{$config_dir|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Output Directory</span>
<input type='text' name='output_dir' value='{$output_dir|default:""}' />
</div>
</div>
</div>
<div class='row'>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Key Type</span>
<input type='text' name='key_type' value='{$key_type|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Contact Frequency</span>
<input type='text' name='contact_frequency' value='{$frequency|default:""}' />
<span class="input-group-addon">Description</span>
<textarea name='description'>{$result.description|default:""}</textarea>
</div>
</div>
</div>
<div class='row'>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Description</span>
<textarea name='description'>{$description|default:""}</textarea>
<span class="input-group-addon">Disabled</span>
<input type='text' name='ssh_key' value='{$result.disabled|default:""}' />
</div>
</div>
</div>
......@@ -102,7 +66,7 @@
<div class='input-group'>
<input type='button' name='save' value='Submit' />
</div>
<input type='hidden' name='cloud_id' value='{$cloud_id|default:""}' />
<input type='hidden' name='cloud_id' value='{$result.id|default:""}' />
</form>
</div>
......
......@@ -37,56 +37,56 @@
<div class='row'>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Server IP</span>
<input type='text' name='server_ip' value='{$server_ip|default:""}' />
<span class="input-group-addon">Cloud ID</span>
<input type='text' name='server_ip' value='{$result.cloud_id|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">SSH Key</span>
<input type='text' name='ssh_key' value='{$ssh_key|default:""}' />
<span class="input-group-addon">Spawn ID</span>
<input type='text' name='server_ip' value='{$result.spawn_id|default:""}' />
</div>
</div>
</div>
<div class='row'>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">SSH Username</span>
<input type='text' name='ssh_username' value='{$ssh_user|default:""}' />
<span class="input-group-addon">Target ID</span>
<input type='text' name='server_ip' value='{$result.target_id|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">GPG Key</span>
<input type='text' name='gpg_key' value='{$gog_key|default:""}' />
<span class="input-group-addon">Hour</span>
<input type='text' name='gpg_key' value='{$result.hour|default:""}' />
</div>
</div>
</div>
<div class='row'>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Config Directory</span>
<input type='text' name='config_dir' value='{$config_dir|default:""}' />
<span class="input-group-addon">Minute</span>
<input type='text' name='gpg_key' value='{$result.minute|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Output Directory</span>
<input type='text' name='output_dir' value='{$output_dir|default:""}' />
<span class="input-group-addon">Day</span>
<input type='text' name='gpg_key' value='{$result.day|default:""}' />
</div>
</div>
</div>
<div class='row'>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Key Type</span>
<input type='text' name='key_type' value='{$key_type|default:""}' />
<span class="input-group-addon">Month</span>
<input type='text' name='gpg_key' value='{$result.month|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Contact Frequency</span>
<input type='text' name='contact_frequency' value='{$frequency|default:""}' />
<span class="input-group-addon">Disabled</span>
<input type='text' name='ssh_key' value='{$result.disabled|default:""}' />
</div>
</div>
</div>
......@@ -94,7 +94,7 @@
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Description</span>
<textarea name='description'>{$description|default:""}</textarea>
<textarea name='description'>{$result.description|default:""}</textarea>
</div>
</div>
</div>
......@@ -102,7 +102,7 @@
<div class='input-group'>
<input type='button' name='save' value='Submit' />
</div>
<input type='hidden' name='cloud_id' value='{$cloud_id|default:""}' />
<input type='hidden' name='cloud_id' value='{$result.id|default:""}' />
</form>
</div>
......
......@@ -38,13 +38,13 @@
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Server IP</span>
<input type='text' name='server_ip' value='{$server_ip|default:""}' />
<input type='text' name='server_ip' value='{long2ip($result.server_ip)|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">SSH Key</span>
<input type='text' name='ssh_key' value='{$ssh_key|default:""}' />
<input type='text' name='ssh_key' value='{$result.ssh_key|default:""}' />
</div>
</div>
</div>
......@@ -52,13 +52,13 @@
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">SSH Username</span>
<input type='text' name='ssh_username' value='{$ssh_user|default:""}' />
<input type='text' name='ssh_username' value='{$result.ssh_username|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">GPG Key</span>
<input type='text' name='gpg_key' value='{$gog_key|default:""}' />
<input type='text' name='gpg_key' value='{$result.gpg_key|default:""}' />
</div>
</div>
</div>
......@@ -66,13 +66,13 @@
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Config Directory</span>
<input type='text' name='config_dir' value='{$config_dir|default:""}' />
<input type='text' name='config_dir' value='{$result.config_dir|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Output Directory</span>
<input type='text' name='output_dir' value='{$output_dir|default:""}' />
<input type='text' name='output_dir' value='{$result.output_dir|default:""}' />
</div>
</div>
</div>
......@@ -80,13 +80,14 @@
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Key Type</span>
<input type='text' name='key_type' value='{$key_type|default:""}' />
{$key_options = ['RSA' => 'RSA', 'DSA' => 'DSA']}
{html_options name=key_type options=$key_options selected=$result.key_type|default:""}
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Contact Frequency</span>
<input type='text' name='contact_frequency' value='{$frequency|default:""}' />
<input type='text' name='contact_frequency' value='{$result.contact_frequency|default:""}' />
</div>
</div>
</div>
......@@ -94,7 +95,13 @@
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Description</span>
<textarea name='description'>{$description|default:""}</textarea>
<textarea name='description'>{$result.description|default:""}</textarea>
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Disabled</span>
<input type='text' name='ssh_key' value='{$result.disabled|default:""}' />
</div>
</div>
</div>
......@@ -102,7 +109,7 @@
<div class='input-group'>
<input type='button' name='save' value='Submit' />
</div>
<input type='hidden' name='cloud_id' value='{$cloud_id|default:""}' />
<input type='hidden' name='cloud_id' value='{$result.id|default:""}' />
</form>
</div>
......
......@@ -37,64 +37,28 @@
<div class='row'>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Server IP</span>
<input type='text' name='server_ip' value='{$server_ip|default:""}' />
<span class="input-group-addon">Address</span>
<input type='text' name='server_ip' value='{long2ip($result.address)|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">SSH Key</span>
<input type='text' name='ssh_key' value='{$ssh_key|default:""}' />
<span class="input-group-addon">CIDR</span>
<input type='text' name='ssh_key' value='{$result.cidr|default:""}' />
</div>
</div>
</div>
<div class='row'>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">SSH Username</span>
<input type='text' name='ssh_username' value='{$ssh_user|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">GPG Key</span>
<input type='text' name='gpg_key' value='{$gog_key|default:""}' />
</div>
</div>
</div>
<div class='row'>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Config Directory</span>
<input type='text' name='config_dir' value='{$config_dir|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Output Directory</span>
<input type='text' name='output_dir' value='{$output_dir|default:""}' />
</div>
</div>
</div>
<div class='row'>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Key Type</span>
<input type='text' name='key_type' value='{$key_type|default:""}' />
</div>
</div>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Contact Frequency</span>
<input type='text' name='contact_frequency' value='{$frequency|default:""}' />
<span class="input-group-addon">Description</span>
<textarea name='description'>{$result.description|default:""}</textarea>
</div>
</div>
</div>
<div class='row'>
<div class="col-md-4">
<div class='input-group'>
<span class="input-group-addon">Description</span>
<textarea name='description'>{$description|default:""}</textarea>
<span class="input-group-addon">Disabled</span>
<input type='text' name='ssh_key' value='{$result.disabled|default:""}' />
</div>
</div>
</div>
......@@ -102,7 +66,7 @@
<div class='input-group'>
<input type='button' name='save' value='Submit' />
</div>
<input type='hidden' name='cloud_id' value='{$cloud_id|default:""}' />
<input type='hidden' name='cloud_id' value='{$result.id|default:""}' />
</form>
</div>
......
......@@ -22,4 +22,4 @@
<link href="{$skynet_bootstrap_root}/css/bootstrap.min.css" rel="stylesheet">
<link href="{$skynet_bootstrap_root}/css/bootstrap-theme.min.css" rel="stylesheet">
{/if}
<link rel='stylesheet' href='{$skynet_stylesheet}' type='text/css' />
<link rel='stylesheet' href='/{$skynet_stylesheet}' type='text/css' />
......@@ -34,6 +34,29 @@
<h1>Scan Type List</h1>
</div>
<div>
<table class='table table-striped'>
<tr>
<th>Options</th>
<th>Description</th>
<th>Override</th>
<th>State</th>
<th>Last Modified</th>
</tr>
{foreach from=$results item=row}
<tr>
<td><a href='/edit-server/{$row.id}'>{$row.options}</a></td>
<td>{$row.description}</td>
<td>{$row.override}</td>
{if $row.disabled == 1}
<td>Disabled</td>
{else}
<td>Active</td>
{/if}
<td>{$row.last_modified}</td>
</tr>
{/foreach}
</div>
</div>
......
......@@ -34,6 +34,39 @@
<h1>Schedule List</h1>
</div>
<div>
<table class='table table-striped'>
<tr>
<th>Cloud ID</th>
<th>Spawn ID</th>
<th>Target ID</th>
<th>Hour</th>
<th>Minute</th>
<th>Day</th>
<th>Month</th>
<th>Description</th>
<th>State</th>
<th>Last Modified</th>
</tr>
{foreach from=$results item=row}
<tr>
<td><a href='/edit-server/{$row.id}'>{$row.cloud_id}</a></td>
<td>{$row.spawn_id}</td>
<td>{$row.target_id}</td>
<td>{$row.hour}</td>
<td>{$row.minute}</td>
<td>{$row.day}</td>
<td>{$row.month}</td>
<td>{$row.description}</td>
{if $row.disabled == 1}
<td>Disabled</td>
{else}
<td>Active</td>
{/if}
<td>{$row.last_modified}</td>
</tr>
{/foreach}
</div>
</div>
......
......@@ -34,7 +34,31 @@
<h1>Server List</h1>
</div>
<div>
<table class='table table-striped'>
<tr>
<th>IP Address</th>
<th>Description</th>
<th>Frequency<br>(in seconds)</th>
<th>Last Contacted</th>
<th>State</th>
<th>Last Modified</th>
</tr>
{foreach from=$results item=row}
<tr>
<td><a href='/edit-server/{$row.id}'>{long2ip($row.server_ip)}</a></td>
<td>{$row.description}</td>
<td>{$row.contact_frequency}</td>
<td>{$row.last_contacted}</td>
{if $row.disabled == 1}
<td>Disabled</td>
{else}
<td>Active</td>
{/if}
<td>{$row.last_modified}</td>
</tr>
{/foreach}
</div>
</div>
{include file='footer.tpl'}
......
......@@ -34,7 +34,29 @@
<h1>Target List</h1>