diff --git a/db_server/hosting_db_server.service.inc b/db_server/hosting_db_server.service.inc index b61a73d..27c5e16 100644 --- a/db_server/hosting_db_server.service.inc +++ b/db_server/hosting_db_server.service.inc @@ -16,6 +16,7 @@ class hostingService_db extends hostingService { */ class hostingService_db_mysql extends hostingService_db { public $type = 'mysql'; + public $name = 'MySQL'; public $has_port = TRUE; function default_port() { diff --git a/dns/hosting_dns.service.inc b/dns/hosting_dns.service.inc index b72541c..0901dea 100644 --- a/dns/hosting_dns.service.inc +++ b/dns/hosting_dns.service.inc @@ -111,6 +111,7 @@ class hostingService_dns_master extends hostingService_dns { */ class hostingService_dns_dnsmasq extends hostingService_dns_master { public $type = 'dnsmasq'; + public $name = 'DNSMasq'; public $has_restart_cmd = TRUE; @@ -124,6 +125,7 @@ class hostingService_dns_dnsmasq extends hostingService_dns_master { */ class hostingService_dns_bind extends hostingService_dns_master { public $type = 'bind'; + public $name = 'Bind'; public $has_restart_cmd = TRUE; @@ -137,6 +139,7 @@ class hostingService_dns_bind extends hostingService_dns_master { */ class hostingService_dns_bind_slave extends hostingService_dns { public $type = 'bind_slave'; + public $name = 'Bind Slave'; public $has_restart_cmd = TRUE; diff --git a/example/example_service/hosting_example.service.inc b/example/example_service/hosting_example.service.inc index fc002e8..8930362 100644 --- a/example/example_service/hosting_example.service.inc +++ b/example/example_service/hosting_example.service.inc @@ -29,6 +29,10 @@ class hostingService_example_basic extends hostingService_example { */ public $type = 'basic'; + /** + * The name displayed to users when creating or editing a server. + */ + public $name = 'Basic'; /** * this service needs to have a port specified for it. diff --git a/server/hosting_server.module b/server/hosting_server.module index d2e2d11..cf3bd12 100644 --- a/server/hosting_server.module +++ b/server/hosting_server.module @@ -396,10 +396,19 @@ function hosting_server_form($node, &$form_state) { '#weight' => isset($service['weight']) ? $service['weight'] : 0, ); + $options = array( + 'null' => t('None'), + ); + + foreach ($service['types'] as $type => $class_name) { + $serviceClass = new $class_name; + $options[$type] = isset($serviceClass->name)? $serviceClass->name: $type; + } + $form['services'][$name]['type'] = array( '#type' => 'radios', '#weight' => -99, - '#options' => array_merge(array('null' => 'None'), drupal_map_assoc(array_keys($service['types']))), + '#options' => $options, '#default_value' => isset($node->services[$name]->available) && $node->services[$name]->available ? $node->services[$name]->type : 'null', ); diff --git a/web_cluster/hosting_web_cluster.service.inc b/web_cluster/hosting_web_cluster.service.inc index d6dfbfa..f6ed625 100644 --- a/web_cluster/hosting_web_cluster.service.inc +++ b/web_cluster/hosting_web_cluster.service.inc @@ -8,6 +8,7 @@ module_load_include('service.inc', 'hosting_web_server'); class hostingService_http_cluster extends hostingService_http { public $type = 'cluster'; + public $name = 'Web Cluster'; function view(&$render) { $render['web_servers'] = array( diff --git a/web_pack/hosting_web_pack.service.inc b/web_pack/hosting_web_pack.service.inc index 28ae37e..989d21b 100644 --- a/web_pack/hosting_web_pack.service.inc +++ b/web_pack/hosting_web_pack.service.inc @@ -8,6 +8,7 @@ module_load_include('service.inc', 'hosting_web_server'); class hostingService_http_pack extends hostingService_http { public $type = 'pack'; + public $name = 'Web Pack'; function view(&$render) { $render['master_servers'] = array( diff --git a/web_server/hosting_web_server.service.inc b/web_server/hosting_web_server.service.inc index b9c5d5d..fed9889 100644 --- a/web_server/hosting_web_server.service.inc +++ b/web_server/hosting_web_server.service.inc @@ -28,6 +28,7 @@ class hostingService_http_public extends hostingService_http { class hostingService_http_apache extends hostingService_http_public { public $type = 'apache'; + public $name = 'Apache'; protected $has_restart_cmd = TRUE; diff --git a/web_server/nginx/hosting_nginx.service.inc b/web_server/nginx/hosting_nginx.service.inc index 6807970..50777d1 100644 --- a/web_server/nginx/hosting_nginx.service.inc +++ b/web_server/nginx/hosting_nginx.service.inc @@ -8,6 +8,7 @@ module_load_include('service.inc', 'hosting_web_server'); class hostingService_http_nginx extends hostingService_http_public { public $type = 'nginx'; + public $name = 'NGINX'; public $has_restart_cmd = TRUE; function default_restart_cmd() { diff --git a/web_server/nginx/ssl/hosting_nginx_ssl.service.inc b/web_server/nginx/ssl/hosting_nginx_ssl.service.inc index 442516c..885f089 100644 --- a/web_server/nginx/ssl/hosting_nginx_ssl.service.inc +++ b/web_server/nginx/ssl/hosting_nginx_ssl.service.inc @@ -9,6 +9,7 @@ module_load_include('service.inc', 'hosting_ssl'); class hostingService_http_nginx_ssl extends hostingService_http_ssl { public $type = 'nginx_ssl'; + public $name = 'NGINX SSL'; protected $has_restart_cmd = TRUE; function default_restart_cmd() { diff --git a/web_server/ssl/hosting_ssl.service.inc b/web_server/ssl/hosting_ssl.service.inc index b2cdd32..b8cda1c 100644 --- a/web_server/ssl/hosting_ssl.service.inc +++ b/web_server/ssl/hosting_ssl.service.inc @@ -83,7 +83,7 @@ class hostingService_http_ssl extends hostingService_http_public { class hostingService_http_apache_ssl extends hostingService_http_ssl { public $type = 'apache_ssl'; - + public $name = 'Apache SSL'; protected $has_restart_cmd = TRUE;