diff --git a/frontend/module.admin.container.suspend.php b/frontend/module.admin.container.suspend.php new file mode 100644 index 0000000..2fe2d29 --- /dev/null +++ b/frontend/module.admin.container.suspend.php @@ -0,0 +1,66 @@ +RequireAccessLevel(20); + + $sContainer = new Container($router->uParameters[1]); + + $sSuspended = ($sContainer->sStatus == CVM_STATUS_SUSPENDED) ? true : false; + + if(isset($_POST['submit'])) + { + if($_POST['action'] == "suspend") + { + $sContainer->Suspend(); + + $err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_SUCCES, "Container suspended", "The container has been suspended and can no longer be used by the owner."); + $sMainContents .= $err->Render(); + } + elseif($_POST['action'] == "unsuspend") + { + $sContainer->Unsuspend(); + + $err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_SUCCES, "Container unsuspended", "The container has been unsuspended and can now be used by the owner again."); + $sMainContents .= $err->Render(); + } + } + + $sPageContents = Templater::InlineRender("admin.container.suspend", $locale->strings, array( + 'id' => $sContainer->sId, + 'suspended' => $sSuspended + )); +} +catch (InsufficientAccessLevelException $e) +{ + $err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_ERROR, "You are not authorized to view this page", "Your access level is not sufficient."); + $sMainContents .= $err->Render(); +} +catch (NotFoundException $e) +{ + $err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_ERROR, "Container not found", "The container you selected was not found."); + $sMainContents .= $err->Render(); +} +catch (ContainerSuspendException $e) +{ + $err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_ERROR, "Failed to suspend container", "The container could not be suspended."); + $sMainContents .= $err->Render(); +} +catch (ContainerUnsuspendException $e) +{ + $err = new CPHPErrorHandler(CPHP_ERRORHANDLER_TYPE_ERROR, "Failed to unsuspend container", "The container could not be unsuspended."); + $sMainContents .= $err->Render(); +} diff --git a/frontend/module.admin.overview.php b/frontend/module.admin.overview.php new file mode 100644 index 0000000..649ec0e --- /dev/null +++ b/frontend/module.admin.overview.php @@ -0,0 +1,16 @@ +strings, array()); diff --git a/frontend/templates/admin.container.suspend.tpl b/frontend/templates/admin.container.suspend.tpl new file mode 100644 index 0000000..f827804 --- /dev/null +++ b/frontend/templates/admin.container.suspend.tpl @@ -0,0 +1,14 @@ +
+ diff --git a/frontend/templates/admin.overview.tpl b/frontend/templates/admin.overview.tpl new file mode 100644 index 0000000..090fedd --- /dev/null +++ b/frontend/templates/admin.overview.tpl @@ -0,0 +1,3 @@ +<%!admin-overview-message>