Add admin backend for deleting sites
This commit is contained in:
@@ -58,6 +58,26 @@ if ($request->exists('do')) {
|
|||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case 'delete-site': {
|
||||||
|
$site_id = $request->get('site', 'Sihnon_Exception_InvalidParameters');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$site = StatusBoard_Site::fromId($site_id);
|
||||||
|
$site->delete();
|
||||||
|
|
||||||
|
$messages[] = array(
|
||||||
|
'severity' => 'success',
|
||||||
|
'content' => 'The Site was deleted successfully.',
|
||||||
|
);
|
||||||
|
} catch (Sihnon_Exception_ResultCountMismatch $e) {
|
||||||
|
$messages[] = array(
|
||||||
|
'severity' => 'error',
|
||||||
|
'content' => 'The Site was not deleted as the object requested could not be found.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
} break;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
$messages[] = array(
|
$messages[] = array(
|
||||||
'severity' => 'warning',
|
'severity' => 'warning',
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
<li class="active"><a href="#">Service {$service->name|escape:html}</a></li>
|
<li class="active"><a href="#">Service {$service->name|escape:html}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span16" name="name"><!--name content container -->
|
<div class="span16"><!--name content container -->
|
||||||
<h1>Service {$service->name|escape:html}</h1>
|
<h1>Service {$service->name|escape:html}</h1>
|
||||||
<div class="row" name="edit service">
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
<div class="span4 column"><!--New description-->
|
<div class="span4 column"><!--New description-->
|
||||||
<h3>Edit Service</h3>
|
<h3>Edit Service</h3>
|
||||||
<p>Use this form to update the existing Service</p>
|
<p>Use this form to update the existing Service</p>
|
||||||
@@ -41,12 +41,13 @@
|
|||||||
</div><!--/Add New Service -->
|
</div><!--/Add New Service -->
|
||||||
</div><!--/Row for New Service-->
|
</div><!--/Row for New Service-->
|
||||||
|
|
||||||
<div class="row" name="Sites_existing">
|
<div class="row">
|
||||||
<div class="span4 column">
|
<div class="span4 column">
|
||||||
<h3>Existing Sites</h3>
|
<h3>Existing Sites</h3>
|
||||||
<p>Currently the following sites that are defined for the service {$service->name|escape:html}, Edit the site or delete it from the service here, to add a new one use the form below</p>
|
<p>Currently the following sites that are defined for the service {$service->name|escape:html}, Edit the site or delete it from the service here, to add a new one use the form below</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="span12 column">
|
<div class="span12 column">
|
||||||
|
{if $sites}
|
||||||
<table class="bordered-table" name="sites_list_table"><!--Services table -->
|
<table class="bordered-table" name="sites_list_table"><!--Services table -->
|
||||||
<thead>
|
<thead>
|
||||||
<th>Sites</th>
|
<th>Sites</th>
|
||||||
@@ -54,7 +55,6 @@
|
|||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{if $sites}
|
|
||||||
{foreach from=$sites item=site}
|
{foreach from=$sites item=site}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@@ -65,7 +65,8 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class='btn info' onclick="document.location.href='{$base_uri}admin/site/service/{$service->id}/id/{$site->id}/';return false;">Edit</button>
|
<button class='btn info' onclick="document.location.href='{$base_uri}admin/site/service/{$service->id}/id/{$site->id}/';return false;">Edit</button>
|
||||||
<button style="margin-left:10px" class='btn danger'>Delete</button></td>
|
<button style="margin-left:10px" class='btn danger' onclick="sb.admin.deleteItem('{$base_uri}admin/service/do/delete-site/id/{$service->id}/site/{$site->id}/');">Delete</button>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -73,15 +74,28 @@
|
|||||||
{else}
|
{else}
|
||||||
You haven't created any sites for this service yet. Create some with the button below.
|
You haven't created any sites for this service yet. Create some with the button below.
|
||||||
{/if}
|
{/if}
|
||||||
|
<div id="confirm_delete" class="modal hide fade">
|
||||||
|
<div class="modal-header">
|
||||||
|
Confirm deletion
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
This action cannot be reversed and all dependent incidents will also be removed.
|
||||||
|
Are you sure you wish to delete this Site?
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn secondary" id="confirm_delete_cancel">Cancel</button>
|
||||||
|
<button class="btn danger" id="confirm_delete_do">Delete</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div><!--/Row for Existing Service-->
|
</div><!--/Row for Existing Service-->
|
||||||
|
|
||||||
<div class="row" name="edit service">
|
<div class="row">
|
||||||
<div class="span4 column"><!--New description-->
|
<div class="span4 column">
|
||||||
<h3>Add Site</h3>
|
<h3>Add Site</h3>
|
||||||
<p>Use this form to define a new site to the service {$service->name|escape:html}</p>
|
<p>Use this form to define a new site to the service {$service->name|escape:html}</p>
|
||||||
</div><!--/New Service description-->
|
</div><!--/New Service description-->
|
||||||
<div class="span12 column"><!--Add New Service -->
|
<div class="span12 column">
|
||||||
<form id="admin_addsite" method="post" action="{$base_uri}admin/service/id/{$service->id}/do/add-site/">
|
<form id="admin_addsite" method="post" action="{$base_uri}admin/service/id/{$service->id}/do/add-site/">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
@@ -94,7 +108,7 @@
|
|||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
<label for="admin_site_edit_description" style="width:87px">Description</label>
|
<label for="admin_site_edit_description" style="width:87px">Description</label>
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<textarea class="xxlarge" name="textarea" id="admin_site_add_description" rows="3" name="description" ></textarea>
|
<textarea class="xxlarge" id="admin_site_add_description" rows="3" name="description" ></textarea>
|
||||||
</div><!-- /text -->
|
</div><!-- /text -->
|
||||||
</div><!-- /clearfix -->
|
</div><!-- /clearfix -->
|
||||||
|
|
||||||
@@ -105,8 +119,10 @@
|
|||||||
</div><!-- /clearfix -->
|
</div><!-- /clearfix -->
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
</div><!--/Add New Service -->
|
|
||||||
</div><!--/Row for New Service-->
|
</div><!--/Row for New Service-->
|
||||||
|
|
||||||
</div><!-- /container -->
|
</div><!-- /container -->
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
sb.admin.init();
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user