Change usage of the word 'container' to 'vps' everywhere

feature/node-rewrite
Sven Slootweg 12 years ago
parent 39893c940b
commit fe8ff917b2

@ -68,20 +68,20 @@ if(isset($_GET['key']) && $_GET['key'] == $settings['local_api_key'])
if($result = mysql_query_cached($query))
{
$sContainers = array();
$sVpses = array();
foreach($result->data as $row)
{
$sContainer = new Container($row);
$sContainers[] = array(
'hostname' => $sContainer->sHostname,
'internal_id' => $sContainer->sInternalId,
'node_id' => $sContainer->sNodeId,
'status' => $sContainer->sStatus
$sVps = new Vps($row);
$sVpses[] = array(
'hostname' => $sVps->sHostname,
'internal_id' => $sVps->sInternalId,
'node_id' => $sVps->sNodeId,
'status' => $sVps->sStatus
);
}
$return_object = $sContainers;
$return_object = $sVpses;
$return_success = true;
}
break;

@ -17,9 +17,9 @@ $router->uVariables['display_menu'] = true;
try
{
$sContainer = new Container($router->uParameters[1]);
$sVps = new Vps($router->uParameters[1]);
if($sContainer->sUserId != $sUser->sId && $sUser->sAccessLevel < 20)
if($sVps->sUserId != $sUser->sId && $sUser->sAccessLevel < 20)
{
throw new UnauthorizedException("You are not authorized to control this VPS.");
}
@ -28,16 +28,16 @@ try
try
{
$sContainer->CheckAllowed();
$sVps->CheckAllowed();
}
catch (ContainerSuspendedException $e)
catch (VpsSuspendedException $e)
{
$sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/warning", $locale->strings, array(
'title' => $locale->strings['warning-suspended-title'],
'message' => $locale->strings['warning-suspended-text']
));
}
catch (ContainerTerminatedException $e)
catch (VpsTerminatedException $e)
{
$sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/warning", $locale->strings, array(
'title' => $locale->strings['warning-terminated-title'],

@ -13,7 +13,7 @@
if(!isset($_CVM)) { die("Unauthorized."); }
class Container extends CPHPDatabaseRecordClass
class Vps extends CPHPDatabaseRecordClass
{
public $table_name = "containers";
public $fill_query = "SELECT * FROM containers WHERE `Id` = '%d'";
@ -260,11 +260,11 @@ class Container extends CPHPDatabaseRecordClass
{
if($this->sStatus == CVM_STATUS_SUSPENDED)
{
throw new ContainerSuspendedException("No operations can be performed on this VPS beacuse it is suspended.", 1, $this->sInternalId);
throw new VpsSuspendedException("No operations can be performed on this VPS beacuse it is suspended.", 1, $this->sInternalId);
}
elseif($this->sStatus == CVM_STATUS_TERMINATED)
{
throw new ContainerSuspendedException("No operations can be performed on this VPS beacuse it is terminated.", 1, $this->sInternalId);
throw new VpsSuspendedException("No operations can be performed on this VPS beacuse it is terminated.", 1, $this->sInternalId);
}
else
{
@ -290,7 +290,7 @@ class Container extends CPHPDatabaseRecordClass
}
else
{
throw new InvalidArgumentException("The option argument to Container::SetOptions should be an array.");
throw new InvalidArgumentException("The option argument to Vps::SetOptions should be an array.");
}
}
@ -425,12 +425,12 @@ class Container extends CPHPDatabaseRecordClass
}
else
{
throw new ContainerConfigureException($result->stderr, $result->returncode, $this->sInternalId);
throw new VpsConfigureException($result->stderr, $result->returncode, $this->sInternalId);
}
}
else
{
throw new ContainerCreateException($result->stderr, $result->returncode, $this->sInternalId);
throw new VpsCreateException($result->stderr, $result->returncode, $this->sInternalId);
}
}
@ -450,7 +450,7 @@ class Container extends CPHPDatabaseRecordClass
}
else
{
throw new ContainerDestroyException("Destroying VPS failed: {$result->stderr}", $result->returncode, $this->sInternalId);
throw new VpsDestroyException("Destroying VPS failed: {$result->stderr}", $result->returncode, $this->sInternalId);
}
}
@ -461,17 +461,17 @@ class Container extends CPHPDatabaseRecordClass
$this->Destroy();
$this->Deploy();
}
catch (ContainerDestroyException $e)
catch (VpsDestroyException $e)
{
throw new ContainerReinstallException("Reinstalling VPS failed during destroying: " . $e->getMessage(), $e->getCode(), $this->sInternalId, $e);
throw new VpsReinstallException("Reinstalling VPS failed during destroying: " . $e->getMessage(), $e->getCode(), $this->sInternalId, $e);
}
catch (ContainerCreateException $e)
catch (VpsCreateException $e)
{
throw new ContainerReinstallException("Reinstalling VPS failed during creation: " . $e->getMessage(), $e->getCode(), $this->sInternalId, $e);
throw new VpsReinstallException("Reinstalling VPS failed during creation: " . $e->getMessage(), $e->getCode(), $this->sInternalId, $e);
}
catch (ContainerConfigureException $e)
catch (VpsConfigureException $e)
{
throw new ContainerReinstallException("Reinstalling VPS failed during configuration: " . $e->getMessage(), $e->getCode(), $this->sInternalId, $e);
throw new VpsReinstallException("Reinstalling VPS failed during configuration: " . $e->getMessage(), $e->getCode(), $this->sInternalId, $e);
}
}
@ -479,11 +479,11 @@ class Container extends CPHPDatabaseRecordClass
{
if($this->sStatus == CVM_STATUS_SUSPENDED && $forced == false)
{
throw new ContainerSuspendedException("The VPS cannot be started as it is suspended.", 1, $this->sInternalId);
throw new VpsSuspendedException("The VPS cannot be started as it is suspended.", 1, $this->sInternalId);
}
elseif($this->sStatus == CVM_STATUS_TERMINATED && $forced == false)
{
throw new ContainerTerminatedException("The VPS cannot be started as it is terminated.", 1, $this->sInternalId);
throw new VpsTerminatedException("The VPS cannot be started as it is terminated.", 1, $this->sInternalId);
}
else
{
@ -498,7 +498,7 @@ class Container extends CPHPDatabaseRecordClass
}
else
{
throw new ContainerStartException($result->stderr, $result->returncode, $this->sInternalId);
throw new VpsStartException($result->stderr, $result->returncode, $this->sInternalId);
}
}
}
@ -507,18 +507,19 @@ class Container extends CPHPDatabaseRecordClass
{
if($this->sStatus == CVM_STATUS_SUSPENDED)
{
throw new ContainerSuspendedException("The VPS cannot be stopped as it is suspended.", 1, $this->sInternalId);
throw new VpsSuspendedException("The VPS cannot be stopped as it is suspended.", 1, $this->sInternalId);
}
elseif($this->sStatus == CVM_STATUS_TERMINATED)
{
throw new ContainerTerminatedException("The VPS cannot be stopped as it is terminated.", 1, $this->sInternalId);
throw new VpsTerminatedException("The VPS cannot be stopped as it is terminated.", 1, $this->sInternalId);
}
else
{
$command = array("vzctl", "stop", $this->sInternalId);
$result = $this->sNode->ssh->RunCommand($command, false);
// vzctl is retarded enough to return exit status 0 when the command fails because the container isn't running, so we'll have to check the stderr for specific error string(s) as well. come on guys, it's 2012.
/* vzctl is retarded enough to return code 0 when the command fails because the container isn't running,
* so we'll have to check stderr for specific error strings as well. Come on guys, it's 2012. */
if($result->returncode == 0 && strpos($result->stderr, "Unable to stop") === false)
{
$this->uStatus = CVM_STATUS_STOPPED;
@ -527,7 +528,7 @@ class Container extends CPHPDatabaseRecordClass
}
else
{
throw new ContainerStopException($result->stderr, $result->returncode, $this->sInternalId);
throw new VpsStopException($result->stderr, $result->returncode, $this->sInternalId);
}
}
}
@ -542,14 +543,14 @@ class Container extends CPHPDatabaseRecordClass
$this->uStatus = CVM_STATUS_SUSPENDED;
$this->InsertIntoDatabase();
}
catch (ContainerStopException $e)
catch (VpsStopException $e)
{
throw new ContainerSuspendException("Suspension failed as the VPS could not be stopped.", 1, $this->sInternalId, $e);
throw new VpsSuspendException("Suspension failed as the VPS could not be stopped.", 1, $this->sInternalId, $e);
}
}
else
{
throw new ContainerSuspendException("The VPS is already suspended.", 1, $this->sInternalId);
throw new VpsSuspendException("The VPS is already suspended.", 1, $this->sInternalId);
}
}
@ -563,14 +564,14 @@ class Container extends CPHPDatabaseRecordClass
$this->uStatus = CVM_STATUS_STARTED;
$this->InsertIntoDatabase();
}
catch (ContainerStartException $e)
catch (VpsStartException $e)
{
throw new ContainerUnsuspendException("Unsuspension failed as the VPS could not be started.", 1, $this->sInternalId, $e);
throw new VpsUnsuspendException("Unsuspension failed as the VPS could not be started.", 1, $this->sInternalId, $e);
}
}
else
{
throw new ContainerUnsuspendException("The VPS is not suspended.", 1, $this->sInternalId);
throw new VpsUnsuspendException("The VPS is not suspended.", 1, $this->sInternalId);
}
}
@ -586,7 +587,7 @@ class Container extends CPHPDatabaseRecordClass
}
else
{
throw new ContainerIpAddException($result->stderr, $result->returncode, $this->sInternalId);
throw new VpsIpAddException($result->stderr, $result->returncode, $this->sInternalId);
}
}
@ -602,7 +603,7 @@ class Container extends CPHPDatabaseRecordClass
}
else
{
throw new ContainerIpRemoveException($result->stderr, $result->returncode, $this->sInternalId);
throw new VpsIpRemoveException($result->stderr, $result->returncode, $this->sInternalId);
}
}
@ -642,7 +643,7 @@ class Container extends CPHPDatabaseRecordClass
}
else
{
throw new ContainerTrafficRetrieveException($result->stderr, $result->returncode, $this->sInternalId);
throw new VpsTrafficRetrieveException($result->stderr, $result->returncode, $this->sInternalId);
}
}
@ -650,11 +651,11 @@ class Container extends CPHPDatabaseRecordClass
{
if($this->sStatus == CVM_STATUS_SUSPENDED)
{
throw new ContainerSuspendedException("The root password cannot be changed, because the VPS is suspended.", 1, $this->sInternalId);
throw new VpsSuspendedException("The root password cannot be changed, because the VPS is suspended.", 1, $this->sInternalId);
}
elseif($this->sStatus == CVM_STATUS_TERMINATED)
{
throw new ContainerTerminatedException("The root password cannot be changed, because the VPS is terminated.", 1, $this->sInternalId);
throw new VpsTerminatedException("The root password cannot be changed, because the VPS is terminated.", 1, $this->sInternalId);
}
else
{

@ -41,8 +41,8 @@ class User extends CPHPDatabaseRecordClass
{
switch($name)
{
case "sContainerCount":
return $this->GetContainerCount();
case "sVpsCount":
return $this->GetVpsCount();
break;
default:
return parent::__get($name);
@ -50,7 +50,7 @@ class User extends CPHPDatabaseRecordClass
}
}
public function GetContainerCount()
public function GetVpsCount()
{
if($result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$this->sId}'"))
{

@ -18,15 +18,15 @@ if($result = mysql_query_cached("SELECT * FROM containers"))
{
foreach($result->data as $row)
{
$sContainer = new Container($row);
$sVps = new Vps($row);
try
{
$sContainer->UpdateTraffic();
$sVps->UpdateTraffic();
}
catch (ContainerTrafficRetrieveException $e)
catch (VpsTrafficRetrieveException $e)
{
if($sContainer->sCurrentStatus == CVM_STATUS_STARTED)
if($sVps->sCurrentStatus == CVM_STATUS_STARTED)
{
// This is not supposed to fail, as the VPS is running.
// Something shady going on.

@ -21,6 +21,8 @@ require("include.exceptions.php");
require("include.constants.php");
require("include.parsing.php");
require("include.misc.php");
/* TODO: Reorganize and autoloading. */
require("classes/class.user.php");
require("classes/class.controller.php");
require("classes/class.container.php");

@ -20,8 +20,8 @@ class SshAuthException extends SshException {}
class SshCommandException extends SshException {}
class SshExitException extends SshException {}
// Container-related exceptions
class ContainerException extends Exception
// VPS-related exceptions
class VpsException extends Exception
{
private $id = "";
@ -38,20 +38,20 @@ class ContainerException extends Exception
}
}
class ContainerCreateException extends ContainerException {}
class ContainerConfigureException extends ContainerException {}
class ContainerStartException extends ContainerException {}
class ContainerStopException extends ContainerException {}
class ContainerSuspendException extends ContainerException {}
class ContainerUnsuspendException extends ContainerException {}
class ContainerSuspendedException extends ContainerException {}
class ContainerTerminatedException extends ContainerException {}
class ContainerDestroyException extends ContainerException {}
class ContainerReinstallException extends ContainerException {}
class ContainerDeployException extends ContainerException {}
class ContainerIpAddException extends ContainerException {}
class ContainerIpRemoveException extends ContainerException {}
class ContainerTrafficRetrieveException extends ContainerException {}
class VpsCreateException extends VpsException {}
class VpsConfigureException extends VpsException {}
class VpsStartException extends VpsException {}
class VpsStopException extends VpsException {}
class VpsSuspendException extends VpsException {}
class VpsUnsuspendException extends VpsException {}
class VpsSuspendedException extends VpsException {}
class VpsTerminatedException extends VpsException {}
class VpsDestroyException extends VpsException {}
class VpsReinstallException extends VpsException {}
class VpsDeployException extends VpsException {}
class VpsIpAddException extends VpsException {}
class VpsIpRemoveException extends VpsException {}
class VpsTrafficRetrieveException extends VpsException {}
class UnauthorizedException extends Exception {}
class InsufficientAccessLevelException extends Exception {}

@ -68,7 +68,7 @@ menu-password; Root Password
## Administration panel menu items
menu-admin-overview; Overview
menu-admin-users; Users
menu-admin-containers; VPSes
menu-admin-vpses; VPSes
menu-admin-nodes; Nodes
## Global warnings and errors
@ -237,12 +237,12 @@ admin-title-id; User ID
admin-title-username; Username
admin-title-email; Email address
admin-title-accesslevel; Access level
admin-title-containers; VPS count
admin-title-vpses; VPS count
admin-level-enduser; End user
admin-level-reseller; Reseller
admin-level-nodeadmin; Node administrator
admin-level-masteradmin; Master administrator
header-admin-user-containers; VPSes owned by this user
header-admin-user-vpses; VPSes owned by this user
## VPS list
title-admin-vpslist; VPS overview
@ -267,7 +267,7 @@ toolbar-addnode; Add node
title-admin-nodeinfo; Node lookup
toolbar-createvps; Create VPS
toolbar-editnode; Edit node details
header-admin-node-containers; VPSes on this node
header-admin-node-vpses; VPSes on this node
## Add node
title-admin-addnode; Add node
@ -286,7 +286,7 @@ addnode-privatekey; Private key
button-admin-addnode; Add node
## Create VPS
title-admin-addcontainer; Create VPS
title-admin-addvps; Create VPS
error-admin-vpses-add-node; You did not select a valid node.
error-admin-vpses-add-user; You did not select a valid user.
error-admin-vpses-add-template; You did not select a valid template.
@ -296,16 +296,16 @@ error-admin-vpses-add-burstable; You did not enter a valid burstable RAM spe
error-admin-vpses-add-cpucount; You did not enter a valid amount of CPUs.
error-admin-vpses-add-traffic; You did not enter a valid traffic allocation specification.
error-admin-vpses-add-hostname; You entered an invalid hostname.
addcontainer-node; Node
addcontainer-user; User
addcontainer-diskspace; Disk space
addcontainer-guaranteed; Guaranteed RAM
addcontainer-burstable; Burstable RAM
addcontainer-cpucount; CPUs
addcontainer-traffic; Traffic allocation
addcontainer-hostname; Hostname (optional)
addcontainer-template; Template
button-admin-addcontainer; Create VPS
addvps-node; Node
addvps-user; User
addvps-diskspace; Disk space
addvps-guaranteed; Guaranteed RAM
addvps-burstable; Burstable RAM
addvps-cpucount; CPUs
addvps-traffic; Traffic allocation
addvps-hostname; Hostname (optional)
addvps-template; Template
button-admin-addvps; Create VPS
## Administrative overview
title-admin-overview; Administrative overview

@ -17,13 +17,13 @@ try
{
$sUser->RequireAccessLevel(20);
$sContainer = new Container($router->uParameters[1]);
$sVps = new Vps($router->uParameters[1]);
if(isset($_POST['submit']))
{
if($_POST['action'] == "suspend")
{
$sContainer->Suspend();
$sVps->Suspend();
$sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array(
'title' => $locale->strings['error-suspend-success-title'],
@ -32,7 +32,7 @@ try
}
elseif($_POST['action'] == "unsuspend")
{
$sContainer->Unsuspend();
$sVps->Unsuspend();
$sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array(
'title' => $locale->strings['error-unsuspend-success-title'],
@ -40,15 +40,15 @@ try
));
}
$sContainer->RefreshData();
$sVps->RefreshData();
/* TODO: Flash message and redirect to VPS lookup page. */
}
$sSuspended = ($sContainer->sStatus == CVM_STATUS_SUSPENDED) ? true : false;
$sSuspended = ($sVps->sStatus == CVM_STATUS_SUSPENDED) ? true : false;
$sPageContents = Templater::AdvancedParse("{$sTheme}/admin/vps/suspend", $locale->strings, array(
'id' => $sContainer->sId,
'id' => $sVps->sId,
'suspended' => $sSuspended
));
}
@ -59,14 +59,14 @@ catch (NotFoundException $e)
'message' => $locale->strings['error-notfound-text']
));
}
catch (ContainerSuspendException $e)
catch (VpsSuspendException $e)
{
$sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-suspend-error-title'],
'message' => $locale->strings['error-suspend-error-text']
));
}
catch (ContainerUnsuspendException $e)
catch (VpsUnsuspendException $e)
{
$sMainContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-unsuspend-error-title'],

@ -118,23 +118,23 @@ if(isset($_POST['submit']))
if(empty($sErrors))
{
$sContainer = new Container(0);
$sContainer->uHostname = $hostname;
$sContainer->uInternalId = first_unused_ctid();
$sContainer->uNodeId = $node->sId;
$sContainer->uTemplateId = $template->sId;
$sContainer->uUserId = $user->sId;
$sContainer->uVirtualizationType = CVM_VIRTUALIZATION_OPENVZ;
$sContainer->uGuaranteedRam = ($guaranteed_ram / 1024 / 1024); /* MB */
$sContainer->uBurstableRam = ($burstable_ram / 1024 / 1024); /* MB */
$sContainer->uDiskSpace = ($disk_space / 1024 / 1024); /* MB */
$sContainer->uCpuCount = $cpu_count;
$sContainer->uStatus = CVM_STATUS_BLANK;
$sContainer->uIncomingTrafficLimit = $traffic;
$sContainer->uOutgoingTrafficLimit = $traffic;
$sContainer->uTotalTrafficLimit = $traffic;
$sContainer->InsertIntoDatabase();
$sContainer->Deploy();
$sVps = new Vps(0);
$sVps->uHostname = $hostname;
$sVps->uInternalId = first_unused_ctid();
$sVps->uNodeId = $node->sId;
$sVps->uTemplateId = $template->sId;
$sVps->uUserId = $user->sId;
$sVps->uVirtualizationType = CVM_VIRTUALIZATION_OPENVZ;
$sVps->uGuaranteedRam = ($guaranteed_ram / 1024 / 1024); /* MB */
$sVps->uBurstableRam = ($burstable_ram / 1024 / 1024); /* MB */
$sVps->uDiskSpace = ($disk_space / 1024 / 1024); /* MB */
$sVps->uCpuCount = $cpu_count;
$sVps->uStatus = CVM_STATUS_BLANK;
$sVps->uIncomingTrafficLimit = $traffic;
$sVps->uOutgoingTrafficLimit = $traffic;
$sVps->uTotalTrafficLimit = $traffic;
$sVps->InsertIntoDatabase();
$sVps->Deploy();
/* TODO: Flash message. */

@ -13,13 +13,13 @@
if(!isset($_CVM)) { die("Unauthorized."); }
$sContainerList = array();
$sVpsList = array();
if($result = mysql_query_cached("SELECT * FROM containers"))
{
foreach($result->data as $row)
{
$sVps = new Container($row);
$sVps = new Vps($row);
try
{

@ -21,29 +21,29 @@ try
{
foreach($result->data as $row)
{
$sContainer = new Container($row);
$sVps = new Vps($row);
try
{
$sStatus = $sContainer->sStatusText;
$sStatus = $sVps->sStatusText;
}
catch (SshException $e)
{
$sStatus = "unknown";
}
$sContainerList[] = array(
'id' => $sContainer->sId,
'hostname' => $sContainer->sHostname,
'node' => $sContainer->sNode->sName,
'node-hostname' => $sContainer->sNode->sHostname,
'template' => $sContainer->sTemplate->sName,
'diskspace' => number_format($sContainer->sDiskSpace / 1024),
$sVpsList[] = array(
'id' => $sVps->sId,
'hostname' => $sVps->sHostname,
'node' => $sVps->sNode->sName,
'node-hostname' => $sVps->sNode->sHostname,
'template' => $sVps->sTemplate->sName,
'diskspace' => number_format($sVps->sDiskSpace / 1024),
'diskspace-unit' => "GB",
'guaranteed-ram' => $sContainer->sGuaranteedRam,
'guaranteed-ram' => $sVps->sGuaranteedRam,
'guaranteed-ram-unit' => "MB",
'status' => $sStatus,
'virtualization-type' => $sContainer->sVirtualizationType
'virtualization-type' => $sVps->sVirtualizationType
);
}
}
@ -52,7 +52,7 @@ try
'id' => $sNode->sId,
'hostname' => $sNode->sHostname,
'location' => $sNode->sPhysicalLocation,
'containers' => $sContainerList
'vpses' => $sVpsList
));
}
catch (NotFoundException $e)

@ -19,35 +19,35 @@ try
{
$sUserEntry = new User($router->uParameters[1]);
$sContainerList = array();
$sVpsList = array();
if($result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$sUserEntry->sId}'"))
{
foreach($result->data as $row)
{
$sContainer = new Container($row);
$sVps = new Vps($row);
try
{
$sStatus = $sContainer->sStatusText;
$sStatus = $sVps->sStatusText;
}
catch (SshException $e)
{
$sStatus = "unknown";
}
$sContainerList[] = array(
'id' => $sContainer->sId,
'hostname' => $sContainer->sHostname,
'node' => $sContainer->sNode->sName,
'node-hostname' => $sContainer->sNode->sHostname,
'template' => $sContainer->sTemplate->sName,
'diskspace' => number_format($sContainer->sDiskSpace / 1024),
$sVpsList[] = array(
'id' => $sVps->sId,
'hostname' => $sVps->sHostname,
'node' => $sVps->sNode->sName,
'node-hostname' => $sVps->sNode->sHostname,
'template' => $sVps->sTemplate->sName,
'diskspace' => number_format($sVps->sDiskSpace / 1024),
'diskspace-unit' => "GB",
'guaranteed-ram' => $sContainer->sGuaranteedRam,
'guaranteed-ram' => $sVps->sGuaranteedRam,
'guaranteed-ram-unit' => "MB",
'status' => $sStatus,
'virtualization-type' => $sContainer->sVirtualizationType
'virtualization-type' => $sVps->sVirtualizationType
);
}
}
@ -57,8 +57,8 @@ try
'username' => $sUserEntry->sUsername,
'email' => $sUserEntry->sEmailAddress,
'accesslevel' => $sUserEntry->sAccessLevel,
'containercount' => $sUserEntry->sContainerCount,
'containers' => $sContainerList
'vpscount' => $sUserEntry->sVpsCount,
'vpses' => $sVpsList
));
}
catch (NotFoundException $e)

@ -17,38 +17,38 @@ if($sLoggedIn === true)
{
$result = mysql_query_cached("SELECT * FROM containers WHERE `UserId` = '{$sUser->sId}'");
$sContainerList = array();
$sVpsList = array();
foreach($result->data as $row)
{
$sContainer = new Container($row);
$sVps = new Vps($row);
try
{
$sStatus = $sContainer->sStatusText;
$sStatus = $sVps->sStatusText;
}
catch (SshException $e)
{
$sStatus = "unknown";
}
$sContainerList[] = array(
'id' => $sContainer->sId,
'hostname' => $sContainer->sHostname,
'node' => $sContainer->sNode->sName,
'node-hostname' => $sContainer->sNode->sHostname,
'template' => $sContainer->sTemplate->sName,
'diskspace' => number_format($sContainer->sDiskSpace / 1024),
$sVpsList[] = array(
'id' => $sVps->sId,
'hostname' => $sVps->sHostname,
'node' => $sVps->sNode->sName,
'node-hostname' => $sVps->sNode->sHostname,
'template' => $sVps->sTemplate->sName,
'diskspace' => number_format($sVps->sDiskSpace / 1024),
'diskspace-unit' => "GB",
'guaranteed-ram' => $sContainer->sGuaranteedRam,
'guaranteed-ram' => $sVps->sGuaranteedRam,
'guaranteed-ram-unit' => "MB",
'status' => $sStatus,
'virtualization-type' => $sContainer->sVirtualizationType
'virtualization-type' => $sVps->sVirtualizationType
);
}
$sMainContents = Templater::AdvancedParse("{$sTheme}/client/vps/list", $locale->strings, array(
'containers' => $sContainerList
'vpses' => $sVpsList
));
}
else

@ -41,24 +41,24 @@ test_iprange("192.168.1.0/27", "192.168.1.0", "192.168.1.31", 27, 4);
test_iprange("192.168.1.0/32", "192.168.1.0", "192.168.1.0", 32, 4);
test_iprange("192.168.1.0", "192.168.1.0", "192.168.1.0", 0, 4);
$sContainer = new Container(0);
$sContainer->uHostname = "test6.cryto.net";
$sContainer->uInternalId = "110";
$sContainer->uNodeId = 2;
$sContainer->uTemplateId = 1;
$sContainer->uUserId = 1;
$sContainer->uVirtualizationType = CVM_VIRTUALIZATION_OPENVZ;
$sContainer->uGuaranteedRam = 256;
$sContainer->uBurstableRam = 384;
$sContainer->uDiskSpace = 6000;
$sContainer->uCpuCount = 1;
$sContainer->uStatus = CVM_STATUS_BLANK;
$sContainer->uIncomingTrafficLimit = 500000000000;
$sContainer->uOutgoingTrafficLimit = 500000000000;
$sContainer->uTotalTrafficLimit = 1000000000000;
$sContainer->InsertIntoDatabase();
$sVps = new Vps(0);
$sVps->uHostname = "test6.cryto.net";
$sVps->uInternalId = "110";
$sVps->uNodeId = 2;
$sVps->uTemplateId = 1;
$sVps->uUserId = 1;
$sVps->uVirtualizationType = CVM_VIRTUALIZATION_OPENVZ;
$sVps->uGuaranteedRam = 256;
$sVps->uBurstableRam = 384;
$sVps->uDiskSpace = 6000;
$sVps->uCpuCount = 1;
$sVps->uStatus = CVM_STATUS_BLANK;
$sVps->uIncomingTrafficLimit = 500000000000;
$sVps->uOutgoingTrafficLimit = 500000000000;
$sVps->uTotalTrafficLimit = 1000000000000;
$sVps->InsertIntoDatabase();
$sContainer->Deploy();
$sVps->Deploy();
*/
/*
var_dump(

@ -29,39 +29,39 @@ if(!empty($router->uParameters[2]))
}
}
if($sContainer->sTotalTrafficLimit != 0)
if($sVps->sTotalTrafficLimit != 0)
{
$sTrafficLimit = $sContainer->sTotalTrafficLimit;
$sTrafficLimit = $sVps->sTotalTrafficLimit;
}
else
{
$sTrafficLimit = $sContainer->sIncomingTrafficLimit + $sContainer->sOutgoingTrafficLimit;
$sTrafficLimit = $sVps->sIncomingTrafficLimit + $sVps->sOutgoingTrafficLimit;
}
$sVariables = array(
'id' => $sContainer->sId,
'server-location' => $sContainer->sNode->sPhysicalLocation,
'operating-system' => $sContainer->sTemplate->sName,
'guaranteed-ram' => "{$sContainer->sGuaranteedRam}MB",
'burstable-ram' => "{$sContainer->sBurstableRam}MB",
'disk-space' => "{$sContainer->sDiskSpace}MB",
'total-traffic-limit' => format_size($sContainer->sTotalTrafficLimit, 1024, true, 0) . "B",
'incoming-traffic-limit'=> format_size($sContainer->sIncomingTrafficLimit, 1024, true, 0) . "B",
'outgoing-traffic-limit'=> format_size($sContainer->sOutgoingTrafficLimit, 1024, true, 0) . "B",
'id' => $sVps->sId,
'server-location' => $sVps->sNode->sPhysicalLocation,
'operating-system' => $sVps->sTemplate->sName,
'guaranteed-ram' => "{$sVps->sGuaranteedRam}MB",
'burstable-ram' => "{$sVps->sBurstableRam}MB",
'disk-space' => "{$sVps->sDiskSpace}MB",
'total-traffic-limit' => format_size($sVps->sTotalTrafficLimit, 1024, true, 0) . "B",
'incoming-traffic-limit'=> format_size($sVps->sIncomingTrafficLimit, 1024, true, 0) . "B",
'outgoing-traffic-limit'=> format_size($sVps->sOutgoingTrafficLimit, 1024, true, 0) . "B",
'bandwidth-limit' => "100mbit",
'status' => $sContainer->sStatusText,
'traffic-used' => number_format(($sContainer->sIncomingTrafficUsed + $sContainer->sOutgoingTrafficUsed) / 1024 / 1024 / 1024, 2),
'status' => $sVps->sStatusText,
'traffic-used' => number_format(($sVps->sIncomingTrafficUsed + $sVps->sOutgoingTrafficUsed) / 1024 / 1024 / 1024, 2),
'traffic-total' => number_format($sTrafficLimit / 1024 / 1024 / 1024, 0),
'traffic-percentage' => number_format(($sContainer->sIncomingTrafficUsed + $sContainer->sOutgoingTrafficUsed) / $sTrafficLimit, 2),
'traffic-percentage' => number_format(($sVps->sIncomingTrafficUsed + $sVps->sOutgoingTrafficUsed) / $sTrafficLimit, 2),
'traffic-unit' => "GB"
);
try
{
$sVariables = array_merge($sVariables, array(
'disk-used' => number_format($sContainer->sDiskUsed / 1024, 2),
'disk-total' => number_format($sContainer->sDiskTotal / 1024, 2),
'disk-percentage' => ($sContainer->sDiskTotal == 0) ? 0 : number_format(($sContainer->sDiskUsed / $sContainer->sDiskTotal) * 100, 2),
'disk-used' => number_format($sVps->sDiskUsed / 1024, 2),
'disk-total' => number_format($sVps->sDiskTotal / 1024, 2),
'disk-percentage' => ($sVps->sDiskTotal == 0) ? 0 : number_format(($sVps->sDiskUsed / $sVps->sDiskTotal) * 100, 2),
'disk-unit' => "GB"
));
}
@ -78,9 +78,9 @@ catch (SshExitException $e)
try
{
$sVariables = array_merge($sVariables, array(
'ram-used' => $sContainer->sRamUsed,
'ram-total' => $sContainer->sRamTotal,
'ram-percentage' => ($sContainer->sRamTotal == 0) ? 0 : number_format(($sContainer->sRamUsed / $sContainer->sRamTotal) * 100, 2),
'ram-used' => $sVps->sRamUsed,
'ram-total' => $sVps->sRamTotal,
'ram-percentage' => ($sVps->sRamTotal == 0) ? 0 : number_format(($sVps->sRamUsed / $sVps->sRamTotal) * 100, 2),
'ram-unit' => "MB"
));
}

@ -23,7 +23,7 @@ if(isset($_POST['submit']))
{
if($_POST['password'] == $_POST['confirm'])
{
$sContainer->SetRootPassword($_POST['password']);
$sVps->SetRootPassword($_POST['password']);
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array(
'title' => $locale->strings['error-password-success-title'],
@ -46,14 +46,14 @@ if(isset($_POST['submit']))
));
}
}
catch (ContainerSuspendedException $e)
catch (VpsSuspendedException $e)
{
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-password-suspended-title'],
'message' => $locale->strings['error-password-suspended-text']
));
}
catch (ContainerTerminatedException $e)
catch (VpsTerminatedException $e)
{
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-password-terminated-title'],
@ -77,6 +77,6 @@ if($display_form === true)
));
$sPageContents .= Templater::AdvancedParse("{$sTheme}/client/vps/password", $locale->strings, array(
'id' => $sContainer->sId
'id' => $sVps->sId
));
}

@ -21,16 +21,16 @@ if(isset($_POST['submit']))
{
try
{
$sContainer->CheckAllowed();
$sVps->CheckAllowed();
$sTemplate = new Template($_POST['template']);
$sTemplate->CheckAvailable();
if(isset($_POST['confirm']))
{
$sContainer->uTemplateId = $sTemplate->sId;
$sContainer->InsertIntoDatabase();
$sContainer->Reinstall();
$sContainer->Start();
$sVps->uTemplateId = $sTemplate->sId;
$sVps->InsertIntoDatabase();
$sVps->Reinstall();
$sVps->Start();
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array(
'title' => $locale->strings['error-reinstall-success-title'],
@ -59,28 +59,28 @@ if(isset($_POST['submit']))
'message' => $locale->strings['error-reinstall-unavailable-text']
));
}
catch (ContainerReinstallException $e)
catch (VpsReinstallException $e)
{
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-reinstall-failed-title'],
'message' => $locale->strings['error-reinstall-failed-text']
));
}
catch (ContainerStartException $e)
catch (VpsStartException $e)
{
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-reinstall-start-title'],
'message' => $locale->strings['error-reinstall-start-text']
));
}
catch (ContainerSuspendedException $e)
catch (VpsSuspendedException $e)
{
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-reinstall-suspended-title'],
'message' => $locale->strings['error-reinstall-suspended-text']
));
}
catch (ContainerTerminatedException $e)
catch (VpsTerminatedException $e)
{
$sPageContents .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-reinstall-terminated-title'],

@ -42,7 +42,7 @@ $sPageTitle = "";
// Initialize some variables to ensure they are available through the application.
// This works around the inability of CPHP to retain variables set in the first rewrite.
$sContainer = null;
$sVps = null;
$sPageContents = "";
$router = null;
$sError = null;
@ -138,35 +138,35 @@ try
'_prefilled_user' => true
),
/* Admin - VPSes - Overview */
'^/admin/containers/?$' => array(
'^/admin/vpses/?$' => array(
'target' => "module.admin.containers.php",
'authenticator' => "authenticator.admin.php",
'auth_error' => "error.access.php",
'_menu' => "admin"
),
/* Admin - VPSes - Create VPS */
'^/admin/containers/add/?$' => array(
'^/admin/vpses/add/?$' => array(
'target' => "module.admin.containers.create.php",
'authenticator' => "authenticator.admin.php",
'auth_error' => "error.access.php",
'_menu' => "admin"
),
/* Admin - VPSes - Suspend */
'^/admin/container/([0-9]+)/suspend/?$' => array(
'^/admin/vps/([0-9]+)/suspend/?$' => array(
'target' => "module.admin.container.suspend.php",
'authenticator' => "authenticator.admin.php",
'auth_error' => "error.access.php",
'_menu' => "admin"
),
/* Admin - VPSes - Transfer */
'^/admin/container/([0-9]+)/transfer/?$' => array(
'^/admin/vps/([0-9]+)/transfer/?$' => array(
'target' => "module.admin.container.transfer.php",
'authenticator' => "authenticator.admin.php",
'auth_error' => "error.access.php",
'_menu' => "admin"
),
/* Admin - VPSes - Terminate */
'^/admin/container/([0-9]+)/terminate/?$' => array(
'^/admin/vps/([0-9]+)/terminate/?$' => array(
'target' => "module.admin.container.terminate.php",
'authenticator' => "authenticator.admin.php",
'auth_error' => "error.access.php",
@ -209,14 +209,14 @@ try
{
$router->RouteRequest();
}
catch (ContainerSuspendedException $e)
catch (VpsSuspendedException $e)
{
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-suspended-title'],
'message' => $e->getMessage()
));
}
catch (ContainerTerminatedException $e)
catch (VpsTerminatedException $e)
{
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-terminated-title'],
@ -229,7 +229,7 @@ try
$sMainContents .= Templater::AdvancedParse("{$sTheme}/client/vps/main", $locale->strings, array(
'error' => $sError,
'contents' => $sPageContents,
'id' => $sContainer->sId
'id' => $sVps->sId
));
}
elseif($router->uVariables['menu'] == "admin" && $router->uVariables['display_menu'] === true)

@ -17,36 +17,36 @@ try
{
try
{
$sContainer->Stop();
$sVps->Stop();
}
catch(ContainerStopException $e)
catch(VpsStopException $e)
{
// we can make this silently fail, as the only important thing is that it starts again
}
$sContainer->Start();
$sContainer->sCurrentStatus = CVM_STATUS_STARTED;
$sVps->Start();
$sVps->sCurrentStatus = CVM_STATUS_STARTED;
$sError .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array(
'title' => $locale->strings['error-stop-restart-success'],
'message' => $locale->strings['error-stop-restart-success']
));
}
catch (ContainerSuspendedException $e)
catch (VpsSuspendedException $e)
{
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-restart-suspended-title'],
'message' => $locale->strings['error-restart-suspended-text']
));
}
catch (ContainerTerminatedException $e)
catch (VpsTerminatedException $e)
{
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-restart-terminated-title'],
'message' => $locale->strings['error-restart-terminated-text']
));
}
catch(ContainerStartException $e)
catch(VpsStartException $e)
{
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-restart-start-title'],

@ -13,33 +13,33 @@
if(!isset($_CVM)) { die("Unauthorized."); }
if($sContainer->sCurrentStatus != CVM_STATUS_STARTED)
if($sVps->sCurrentStatus != CVM_STATUS_STARTED)
{
try
{
$sContainer->Start();
$sContainer->sCurrentStatus = CVM_STATUS_STARTED;
$sVps->Start();
$sVps->sCurrentStatus = CVM_STATUS_STARTED;
$sError .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array(
'title' => $locale->strings['error-start-success-title'],
'message' => $locale->strings['error-start-success-text']
));
}
catch (ContainerSuspendedException $e)
catch (VpsSuspendedException $e)
{
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-start-suspended-title'],
'message' => $locale->strings['error-start-suspended-text']
));
}
catch (ContainerTerminatedException $e)
catch (VpsTerminatedException $e)
{
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-start-terminated-title'],
'message' => $locale->strings['error-start-terminated-text']
));
}
catch (ContainerStartException $e)
catch (VpsStartException $e)
{
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-start-failed-title'],

@ -13,33 +13,33 @@
if(!isset($_CVM)) { die("Unauthorized."); }
if($sContainer->sCurrentStatus != CVM_STATUS_STOPPED)
if($sVps->sCurrentStatus != CVM_STATUS_STOPPED)
{
try
{
$sContainer->Stop();
$sContainer->sCurrentStatus = CVM_STATUS_STOPPED;
$sVps->Stop();
$sVps->sCurrentStatus = CVM_STATUS_STOPPED;
$sError .= NewTemplater::Render("{$sTheme}/shared/error/success", $locale->strings, array(
'title' => $locale->strings['error-stop-success-title'],
'message' => $locale->strings['error-stop-success-text']
));
}
catch (ContainerSuspendedException $e)
catch (VpsSuspendedException $e)
{
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-stop-suspended-title'],
'message' => $locale->strings['error-stop-suspended-text']
));
}
catch (ContainerTerminatedException $e)
catch (VpsTerminatedException $e)
{
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-stop-terminated-title'],
'message' => $locale->strings['error-stop-terminated-text']
));
}
catch(ContainerStopException $e)
catch(VpsStopException $e)
{
$sError .= NewTemplater::Render("{$sTheme}/shared/error/error", $locale->strings, array(
'title' => $locale->strings['error-stop-failed-title'],

@ -2,7 +2,7 @@
<a class="sidebutton" href="/admin/">{%!menu-admin-overview}</a>
<a class="sidebutton" href="/admin/nodes/">{%!menu-admin-nodes}</a>
<a class="sidebutton" href="/admin/users/">{%!menu-admin-users}</a>
<a class="sidebutton" href="/admin/containers/">{%!menu-admin-containers}</a>
<a class="sidebutton" href="/admin/vpses/">{%!menu-admin-vpses}</a>
</div>
{%?contents}

@ -21,7 +21,7 @@
</tr>
</table>
<h3>{%!header-admin-node-containers}</h3>
<h3>{%!header-admin-node-vpses}</h3>
<table class="vpslist">
<tr>
<th></th>
@ -31,47 +31,47 @@
<th>{%!list-column-ram}</th>
<th>{%!list-column-template}</th>
</tr>
{%if isset|containers == true}
{%foreach container in containers}
<tr class="clickable" data-url="/{%?container[id]}/">
<td class="container-status">
{%if container[status] == running}
{%if isset|vpses == true}
{%foreach vps in vpses}
<tr class="clickable" data-url="/{%?vps[id]}/">
<td class="vps-status">
{%if vps[status] == running}
<img src="/templates/default/static/images/status/online.png" alt="{%!list-status-running}">
{%elseif container[status] == stopped}
{%elseif vps[status] == stopped}
<img src="/templates/default/static/images/status/offline.png" alt="{%!list-status-stopped}">
{%elseif container[status] == suspended}
{%elseif vps[status] == suspended}
<img src="/templates/default/static/images/status/suspended.png" alt="{%!list-status-suspended}">
{%else}
<img src="/templates/default/static/images/status/unknown.png" alt="{%!list-status-unknown}">
{%/if}
</td>
<td>
<a href="/{%?container[id]}/">
{%?container[hostname]}
<a href="/{%?vps[id]}/">
{%?vps[hostname]}
</a>
</td>
<td>
<a href="/{%?container[id]}/">
{%if container[virtualization-type] == 1}
<a href="/{%?vps[id]}/">
{%if vps[virtualization-type] == 1}
OpenVZ
{%/if}{%if container[virtualization-type] == 2}
{%/if}{%if vps[virtualization-type] == 2}
Xen PV
{%/if}{%if container[virtualization-type] == 3}
{%/if}{%if vps[virtualization-type] == 3}
Xen HVM
{%/if}{%if container[virtualization-type] == 4}
{%/if}{%if vps[virtualization-type] == 4}
KVM
{%/if}
</a>
</td>
<td>
{%?container[diskspace]}
<span class="unit">{%?container[diskspace-unit]}</span>
{%?vps[diskspace]}
<span class="unit">{%?vps[diskspace-unit]}</span>
</td>
<td>
{%?container[guaranteed-ram]}
<span class="unit">{%?container[guaranteed-ram-unit]}</span>
{%?vps[guaranteed-ram]}
<span class="unit">{%?vps[guaranteed-ram-unit]}</span>
</td>
<td>{%?container[template]}</td>
<td>{%?vps[template]}</td>
</tr>
{%/foreach}
{%/if}

@ -34,12 +34,12 @@
</td>
</tr>
<tr>
<th>{%!admin-title-containers}</th>
<td>{%?containercount}</td>
<th>{%!admin-title-vpses}</th>
<td>{%?vpscount}</td>
</tr>
</table>
<h3>{%!header-admin-user-containers}</h3>
<h3>{%!header-admin-user-vpses}</h3>
<table class="vpslist">
<tr>
<th></th>
@ -49,45 +49,45 @@
<th>{%!list-column-ram}</th>
<th>{%!list-column-template}</th>
</tr>
{%foreach container in containers}
<tr class="clickable" data-url="/{%?container[id]}/">
<td class="container-status">
{%if container[status] == running}
{%foreach vps in vpses}
<tr class="clickable" data-url="/{%?vps[id]}/">
<td class="vps-status">
{%if vps[status] == running}
<img src="/templates/default/static/images/status/online.png" alt="{%!list-status-running}">
{%elseif container[status] == stopped}
{%elseif vps[status] == stopped}
<img src="/templates/default/static/images/status/offline.png" alt="{%!list-status-stopped}">
{%elseif container[status] == suspended}
{%elseif vps[status] == suspended}
<img src="/templates/default/static/images/status/suspended.png" alt="{%!list-status-suspended}">
{%else}
<img src="/templates/default/static/images/status/unknown.png" alt="{%!list-status-unknown}">
{%/if}
<td>
<a href="/{%?container[id]}/">
{%?container[hostname]}
<a href="/{%?vps[id]}/">
{%?vps[hostname]}
</a>
</td>
<td>
<a href="/{%?container[id]}/">
{%if container[virtualization-type] == 1}
<a href="/{%?vps[id]}/">
{%if vps[virtualization-type] == 1}
OpenVZ
{%/if}{%if container[virtualization-type] == 2}
{%/if}{%if vps[virtualization-type] == 2}
Xen PV
{%/if}{%if container[virtualization-type] == 3}
{%/if}{%if vps[virtualization-type] == 3}
Xen HVM
{%/if}{%if container[virtualization-type] == 4}
{%/if}{%if vps[virtualization-type] == 4}
KVM
{%/if}
</a>
</td>
<td>
{%?container[diskspace]}
<span class="unit">{%?container[diskspace-unit]}</span>
{%?vps[diskspace]}
<span class="unit">{%?vps[diskspace-unit]}</span>
</td>
<td>
{%?container[guaranteed-ram]}
<span class="unit">{%?container[guaranteed-ram-unit]}</span>
{%?vps[guaranteed-ram]}
<span class="unit">{%?vps[guaranteed-ram-unit]}</span>
</td>
<td>{%?container[template]}</td>
<td>{%?vps[template]}</td>
</tr>
{%/foreach}
</table>

@ -1,4 +1,4 @@
<h2>{%!title-admin-addcontainer}</h2>
<h2>{%!title-admin-addvps}</h2>
{%if isempty|errors == false}
<div class="errorhandler error-error">
@ -13,10 +13,10 @@
</div>
{%/if}
<form method="post" action="/admin/containers/add/" class="add dark">
<form method="post" action="/admin/vpses/add/" class="add dark">
<div class="field">
<label for="form_addcontainer_node">{%!addcontainer-node}</label>
{%select group="addcontainer" name="node"}
<label for="form_addvps_node">{%!addvps-node}</label>
{%select group="addvps" name="node"}
{%foreach node in nodes}
{%option value="(?node[id])" text="(?node[name]) ((?node[location]))"}
{%/foreach}
@ -25,8 +25,8 @@
</div>
<div class="field">
<label for="form_addcontainer_template">{%!addcontainer-template}</label>
{%select group="addcontainer" name="template"}
<label for="form_addvps_template">{%!addvps-template}</label>
{%select group="addvps" name="template"}
{%foreach template in templates}
{%option value="(?template[id])" text="(?template[name])"}
{%/foreach}
@ -35,8 +35,8 @@
</div>
<div class="field">
<label for="form_addcontainer_user">{%!addcontainer-user}</label>
{%select group="addcontainer" name="user"}
<label for="form_addvps_user">{%!addvps-user}</label>
{%select group="addvps" name="user"}
{%foreach user in users}
{%option value="(?user[id])" text="(?user[username]) (#(?user[id]))"}
{%/foreach}
@ -45,44 +45,44 @@
</div>
<div class="field">
<label for="form_addnode_diskspace">{%!addcontainer-diskspace}</label>
{%input type="text" group="addcontainer" name="diskspace"}
<label for="form_addnode_diskspace">{%!addvps-diskspace}</label>
{%input type="text" group="addvps" name="diskspace"}
<div class="clear"></div>
</div>
<div class="field">
<label for="form_addnode_guaranteed">{%!addcontainer-guaranteed}</label>
{%input type="text" group="addcontainer" name="guaranteed"}
<label for="form_addnode_guaranteed">{%!addvps-guaranteed}</label>
{%input type="text" group="addvps" name="guaranteed"}
<div class="clear"></div>
</div>
<div class="field">
<label for="form_addnode_burstable">{%!addcontainer-burstable}</label>
{%input type="text" group="addcontainer" name="burstable"}
<label for="form_addnode_burstable">{%!addvps-burstable}</label>
{%input type="text" group="addvps" name="burstable"}
<div class="clear"></div>
</div>
<div class="field">
<label for="form_addnode_cpucount">{%!addcontainer-cpucount}</label>
{%input type="text" group="addcontainer" name="cpucount"}
<label for="form_addnode_cpucount">{%!addvps-cpucount}</label>
{%input type="text" group="addvps" name="cpucount"}
<div class="clear"></div>
</div>
<div class="field">
<label for="form_addnode_traffic">{%!addcontainer-traffic}</label>
{%input type="text" group="addcontainer" name="traffic"}
<label for="form_addnode_traffic">{%!addvps-traffic}</label>
{%input type="text" group="addvps" name="traffic"}
<div class="clear"></div>
</div>
<div class="field">
<label for="form_addnode_hostname">{%!addcontainer-hostname}</label>
{%input type="text" group="addcontainer" name="hostname"}
<label for="form_addnode_hostname">{%!addvps-hostname}</label>
{%input type="text" group="addvps" name="hostname"}
<div class="clear"></div>
</div>
<div class="field">
<div class="filler"></div>
<button type="submit" name="submit">{%!button-admin-addcontainer}</button>
<button type="submit" name="submit">{%!button-admin-addvps}</button>
<div class="clear"></div>
</div>
</form>

@ -11,7 +11,7 @@
</tr>
{%foreach vps in vpses}
<tr class="clickable" data-url="/{%?vps[id]}/">
<td class="container-status">
<td class="vps-status">
{%if vps[status] == running}
<img src="/templates/default/static/images/status/online.png" alt="{%!list-status-running}">
{%elseif vps[status] == stopped}

@ -1,4 +1,4 @@
<form method="post" action="/admin/container/{%?id}/suspend/">
<form method="post" action="/admin/vps/{%?id}/suspend/">
{%if suspended == false}
<h2>{%!title-admin-vps-suspend}</h2>
<p>{%!vps-admin-suspend-text}</p>

@ -8,52 +8,52 @@
<th>{%!list-column-ram}</th>
<th>{%!list-column-template}</th>
</tr>
{%foreach container in containers}
<tr class="clickable" data-url="/{%?container[id]}/">
<td class="container-status">
{%if container[status] == running}
{%foreach vps in vpses}
<tr class="clickable" data-url="/{%?vps[id]}/">
<td class="vps-status">
{%if vps[status] == running}
<img src="/templates/default/static/images/status/online.png" alt="{%!list-status-running}">
{%elseif container[status] == stopped}
{%elseif vps[status] == stopped}
<img src="/templates/default/static/images/status/offline.png" alt="{%!list-status-stopped}">
{%elseif container[status] == suspended}
{%elseif vps[status] == suspended}
<img src="/templates/default/static/images/status/suspended.png" alt="{%!list-status-suspended}">
{%else}
<img src="/templates/default/static/images/status/unknown.png" alt="{%!list-status-unknown}">
{%/if}
</td>
<td>
<a href="/{%?container[id]}/">
{%?container[hostname]}
<a href="/{%?vps[id]}/">
{%?vps[hostname]}
</a>
</td>
<td>
<a href="/{%?container[id]}/">
{%if container[virtualization-type] == 1}
<a href="/{%?vps[id]}/">
{%if vps[virtualization-type] == 1}
OpenVZ
{%/if}{%if container[virtualization-type] == 2}
{%/if}{%if vps[virtualization-type] == 2}
Xen PV
{%/if}{%if container[virtualization-type] == 3}
{%/if}{%if vps[virtualization-type] == 3}
Xen HVM
{%/if}{%if container[virtualization-type] == 4}
{%/if}{%if vps[virtualization-type] == 4}
KVM
{%/if}
</a>
</td>
<td>
<a href="/{%?container[id]}/">
<span class="nodename">{%?container[node]}</span>
<span class="hostname">({%?container[node-hostname]})</span>
<a href="/{%?vps[id]}/">
<span class="nodename">{%?vps[node]}</span>
<span class="hostname">({%?vps[node-hostname]})</span>
</a>
</td>
<td>
{%?container[diskspace]}
<span class="unit">{%?container[diskspace-unit]}</span>
{%?vps[diskspace]}
<span class="unit">{%?vps[diskspace-unit]}</span>
</td>
<td>
{%?container[guaranteed-ram]}
<span class="unit">{%?container[guaranteed-ram-unit]}</span>
{%?vps[guaranteed-ram]}
<span class="unit">{%?vps[guaranteed-ram-unit]}</span>
</td>
<td>{%?container[template]}</td>
<td>{%?vps[template]}</td>
</tr>
{%/foreach}
</table>

@ -99,9 +99,9 @@
{%if accesslevel = 20}
<h3>{%!header-vps-admin}</h3>
<div class="vps-admin">
<a href="/admin/container/{%?id}/suspend/">{%!vps-admin-suspend}</a>
<a href="/admin/container/{%?id}/transfer/">{%!vps-admin-transfer}</a>
<a href="/admin/container/{%?id}/terminate/">{%!vps-admin-terminate}</a>
<a href="/admin/vps/{%?id}/suspend/">{%!vps-admin-suspend}</a>
<a href="/admin/vps/{%?id}/transfer/">{%!vps-admin-transfer}</a>
<a href="/admin/vps/{%?id}/terminate/">{%!vps-admin-terminate}</a>
</div>
<div class="clear"></div>
{%/if}

@ -58,7 +58,7 @@ table.vertical th
padding: 3px 7px;
}
td.container-status img
td.vps-status img
{
margin-top: 3px;
}

Loading…
Cancel
Save