diff --git a/modules/hosting/site/hosting_site.module b/modules/hosting/site/hosting_site.module
index 30574d1..1eddbdc 100644
--- a/modules/hosting/site/hosting_site.module
+++ b/modules/hosting/site/hosting_site.module
@@ -275,6 +275,33 @@ function hosting_site_hosting_tasks() {
}
/**
+ * Implements hook_node_operations().
+ */
+function hosting_site_node_operations() {
+ $operations = array();
+
+ $operations['verify'] = array(
+ 'label' => t('Verify'),
+ 'callback' => 'hosting_task_operation',
+ 'callback arguments' => array('verify'),
+ );
+
+ $operations['disable'] = array(
+ 'label' => t('Disable'),
+ 'callback' => 'hosting_task_operation',
+ 'callback arguments' => array('disable'),
+ );
+
+ $operations['enable'] = array(
+ 'label' => t('Enable'),
+ 'callback' => 'hosting_task_operation',
+ 'callback arguments' => array('enable'),
+ );
+
+ return $operations;
+}
+
+/**
* Implementation of hook_perm
*/
function hosting_site_perm() {
@@ -767,20 +794,7 @@ function _hosting_site_list_class($node, $verified = null) {
*/
function hosting_site_views_api() {
return array(
- 'api' => 2,
+ 'api' => 2,
'path' => drupal_get_path('module', 'hosting_site'),
);
}
-
-
-function hosting_site_preprocess_views_view_table(&$variables) {
- $view = $variables['view'];
- if ($view->plugin_name == 'hosting_site_list') {
- foreach ($view->result as $num => $result) {
- if (isset($result->hosting_site_status) && isset($result->hosting_site_verified)) {
- $variables['row_classes'][$num][] = _hosting_site_list_class($result->hosting_site_status, $result->hosting_site_verified);
- }
- }
- }
- $variables['class'] .= " hosting-table";
-}
diff --git a/modules/hosting/site/hosting_site.views.inc b/modules/hosting/site/hosting_site.views.inc
index e84b5ea..03227c2 100644
--- a/modules/hosting/site/hosting_site.views.inc
+++ b/modules/hosting/site/hosting_site.views.inc
@@ -1,24 +1,23 @@
'Hosting Site',
- 'title' => 'Site',
- 'join' => array(
- 'node' => array(
- 'left_field' => 'vid',
- 'field' => 'vid',
- ),
+ 'group' => 'Hosting Site',
+ 'title' => 'Site',
+ 'join' => array(
+ 'node' => array(
+ 'left_field' => 'vid',
+ 'field' => 'vid',
),
- );
+ ),
+ );
$data['hosting_site']['client'] = array(
'title' => t('Client'),
@@ -37,68 +36,71 @@ function hosting_site_views_data() {
'relationship' => array(
'handler' => 'views_handler_relationship',
'base' => 'node',
- 'field' => 'nid',
+ 'base field' => 'nid',
'label' => t('db server'),
),
);
- $data['hosting_site']['profile'] = array(
- 'title' => t('Install Profile'),
- 'help' => t('Type of drupal site.'),
- 'relationship' => array(
+ $data['hosting_site']['profile'] = array(
+ 'title' => t('Install Profile'),
+ 'help' => t('Type of drupal site.'),
+ 'relationship' => array(
'handler' => 'views_handler_relationship',
'base' => 'node',
- 'field' => 'nid',
+ 'base field' => 'nid',
'label' => t('profile'),
),
);
- $data['hosting_site']['platform'] = array(
+
+ $data['hosting_site']['platform'] = array(
'title' => t('Platform'),
'help' => t('Platform'),
'relationship' => array(
'handler' => 'views_handler_relationship',
'base' => 'node',
- 'field' => 'nid',
+ 'base field' => 'nid',
'label' => t('platform'),
),
);
$data['hosting_site']['verified'] = array(
- 'title' => t('Verified'),
- 'help' => t('The last date verified task run on this site.'),
- 'field' => array(
- 'handler' => 'hosting_views_field_handler_interval',
- 'click sortable' => TRUE,
- ),
- );
+ 'title' => t('Verified'),
+ 'help' => t('The last date verified task run on this site.'),
+ 'field' => array(
+ 'handler' => 'hosting_views_field_handler_interval',
+ 'click sortable' => TRUE,
+ ),
+ );
$data['hosting_site']['last_cron'] = array(
- 'title' => t('Last Cron Run'),
- 'help' => t('The time the last cron run was executed on this site.'),
- 'field' => array(
- 'handler' => 'hosting_views_field_handler_interval',
- 'click sortable' => TRUE,
- ),
- );
+ 'title' => t('Last Cron Run'),
+ 'help' => t('The time the last cron run was executed on this site.'),
+ 'field' => array(
+ 'handler' => 'hosting_views_field_handler_interval',
+ 'click sortable' => TRUE,
+ ),
+ );
+
$data['hosting_site']['language'] = array(
- 'title' => t('Language'),
- 'help' => t('The default language of this site.'),
- 'field' => array(
- 'handler' => 'views_handler_field_hosting_language',
- 'click sortable' => TRUE,
- ),
- );
+ 'title' => t('Language'),
+ 'help' => t('The default language of this site.'),
+ 'field' => array(
+ 'handler' => 'views_handler_field_hosting_language',
+ 'click sortable' => TRUE,
+ ),
+ );
$data['hosting_site']['status'] = array(
- 'title' => t('Status'),
- 'help' => t('The current state of this site.'),
- 'field' => array(
- 'handler' => 'views_handler_field_hosting_site_status',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_numeric',
- ),
- );
+ 'title' => t('Status'),
+ 'help' => t('The current state of this site.'),
+ 'field' => array(
+ 'handler' => 'views_handler_field_hosting_site_status',
+ 'click sortable' => TRUE,
+ ),
+ 'filter' => array(
+ 'handler' => 'views_handler_filter_numeric',
+ ),
+ );
return $data;
}
@@ -121,398 +123,3 @@ function hosting_site_views_handlers() {
),
);
}
-
-function hosting_site_views_plugins() {
- return array(
- 'style' => array(
- 'hosting_site_list' => array(
- 'title' => t('Site listing'),
- 'help' => t('Displays sites in a table.'),
- 'handler' => 'views_plugin_style_site_table',
- 'theme' => 'views_view_table',
- 'parent' => 'table',
- 'path' => drupal_get_path('module', 'hosting_site'),
- 'uses row plugin' => FALSE,
- 'uses fields' => TRUE,
- 'uses options' => TRUE,
- 'type' => 'normal',
- ),
- )
- );
-
-}
-
-
-function hosting_site_views_default_views() {
- $view = new view;
- $view->name = 'hosting_site_list';
- $view->description = 'Display a list of sites hosted in aegir';
- $view->tag = '';
- $view->view_php = '';
- $view->base_table = 'node';
- $view->is_cacheable = FALSE;
- $view->api_version = 2;
- $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
- $handler = $view->new_display('default', 'Defaults', 'default');
- $handler->override_option('relationships', array(
- 'client' => array(
- 'id' => 'client',
- 'table' => 'hosting_site',
- 'field' => 'client',
- ),
- 'db_server' => array(
- 'id' => 'db_server',
- 'table' => 'hosting_site',
- 'field' => 'db_server',
- ),
- 'profile' => array(
- 'id' => 'profile',
- 'table' => 'hosting_site',
- 'field' => 'profile',
- ),
- 'platform' => array(
- 'id' => 'platform',
- 'table' => 'hosting_site',
- 'field' => 'platform',
- ),
- 'web_server' => array(
- 'label' => 'web server',
- 'required' => 0,
- 'id' => 'web_server',
- 'table' => 'hosting_platform',
- 'field' => 'web_server',
- 'relationship' => 'platform',
- ),
- ));
- $handler->override_option('fields', array(
- 'status' => array(
- 'label' => '',
- 'alter' => array(
- 'alter_text' => 0,
- 'text' => '',
- 'make_link' => 0,
- 'path' => '',
- 'link_class' => '',
- 'alt' => '',
- 'prefix' => '',
- 'suffix' => '',
- 'help' => '',
- 'trim' => 0,
- 'max_length' => '',
- 'word_boundary' => 1,
- 'ellipsis' => 1,
- 'strip_tags' => 0,
- 'html' => 0,
- ),
- 'status_icon' => '1',
- 'exclude' => 0,
- 'id' => 'status',
- 'table' => 'hosting_site',
- 'field' => 'status',
- 'relationship' => 'none',
- 'override' => array(
- 'button' => 'Override',
- ),
- ),
- 'title' => array(
- 'label' => 'Domain',
- 'alter' => array(
- 'alter_text' => 0,
- 'text' => '',
- 'make_link' => 0,
- 'path' => '',
- 'link_class' => '',
- 'alt' => '',
- 'prefix' => '',
- 'suffix' => '',
- 'help' => '',
- 'trim' => 0,
- 'max_length' => '',
- 'word_boundary' => 1,
- 'ellipsis' => 1,
- 'strip_tags' => 0,
- 'html' => 0,
- ),
- 'link_to_node' => 1,
- 'exclude' => 0,
- 'id' => 'title',
- 'table' => 'node',
- 'field' => 'title',
- 'relationship' => 'none',
- ),
- 'title_3' => array(
- 'label' => 'Install Profile',
- 'alter' => array(
- 'alter_text' => 0,
- 'text' => '',
- 'make_link' => 0,
- 'path' => '',
- 'link_class' => '',
- 'alt' => '',
- 'prefix' => '',
- 'suffix' => '',
- 'help' => '',
- 'trim' => 0,
- 'max_length' => '',
- 'word_boundary' => 1,
- 'ellipsis' => 1,
- 'strip_tags' => 0,
- 'html' => 0,
- ),
- 'link_to_node' => 1,
- 'exclude' => 0,
- 'id' => 'title_3',
- 'table' => 'node',
- 'field' => 'title',
- 'relationship' => 'profile',
- ),
- 'language' => array(
- 'label' => 'Language',
- 'alter' => array(
- 'alter_text' => 0,
- 'text' => '',
- 'make_link' => 0,
- 'path' => '',
- 'link_class' => '',
- 'alt' => '',
- 'prefix' => '',
- 'suffix' => '',
- 'help' => '',
- 'trim' => 0,
- 'max_length' => '',
- 'word_boundary' => 1,
- 'ellipsis' => 1,
- 'strip_tags' => 0,
- 'html' => 0,
- ),
- 'exclude' => 0,
- 'id' => 'language',
- 'table' => 'hosting_site',
- 'field' => 'language',
- 'relationship' => 'none',
- ),
- 'title_1' => array(
- 'label' => 'Client',
- 'alter' => array(
- 'alter_text' => 0,
- 'text' => '',
- 'make_link' => 0,
- 'path' => '',
- 'link_class' => '',
- 'alt' => '',
- 'prefix' => '',
- 'suffix' => '',
- 'help' => '',
- 'trim' => 1,
- 'max_length' => '10',
- 'word_boundary' => 1,
- 'ellipsis' => 1,
- 'strip_tags' => 0,
- 'html' => 0,
- ),
- 'link_to_node' => 1,
- 'exclude' => 0,
- 'id' => 'title_1',
- 'table' => 'node',
- 'field' => 'title',
- 'relationship' => 'client',
- 'override' => array(
- 'button' => 'Override',
- ),
- ),
- 'verified' => array(
- 'label' => 'Verified',
- 'alter' => array(
- 'alter_text' => 0,
- 'text' => '',
- 'make_link' => 0,
- 'path' => '',
- 'link_class' => '',
- 'alt' => '',
- 'prefix' => '',
- 'suffix' => '',
- 'help' => '',
- 'trim' => 0,
- 'max_length' => '',
- 'word_boundary' => 1,
- 'ellipsis' => 1,
- 'strip_tags' => 0,
- 'html' => 0,
- ),
- 'date_format' => 'small',
- 'custom_date_format' => '',
- 'exclude' => 0,
- 'id' => 'verified',
- 'table' => 'hosting_site',
- 'field' => 'verified',
- 'relationship' => 'none',
- ),
- 'title_2' => array(
- 'label' => 'Platform',
- 'alter' => array(
- 'alter_text' => 0,
- 'text' => '',
- 'make_link' => 0,
- 'path' => '',
- 'link_class' => '',
- 'alt' => '',
- 'prefix' => '',
- 'suffix' => '',
- 'help' => '',
- 'trim' => 1,
- 'max_length' => '20',
- 'word_boundary' => 1,
- 'ellipsis' => 1,
- 'strip_tags' => 0,
- 'html' => 0,
- ),
- 'link_to_node' => 1,
- 'exclude' => 0,
- 'id' => 'title_2',
- 'table' => 'node',
- 'field' => 'title',
- 'relationship' => 'platform',
- 'override' => array(
- 'button' => 'Override',
- ),
- ),
- 'title_5' => array(
- 'label' => 'Web Server',
- 'alter' => array(
- 'alter_text' => 0,
- 'text' => '',
- 'make_link' => 0,
- 'path' => '',
- 'link_class' => '',
- 'alt' => '',
- 'prefix' => '',
- 'suffix' => '',
- 'help' => '',
- 'trim' => 0,
- 'max_length' => '',
- 'word_boundary' => 1,
- 'ellipsis' => 1,
- 'strip_tags' => 0,
- 'html' => 0,
- ),
- 'link_to_node' => 1,
- 'exclude' => 0,
- 'id' => 'title_5',
- 'table' => 'node',
- 'field' => 'title',
- 'relationship' => 'web_server',
- 'override' => array(
- 'button' => 'Override',
- ),
- ),
- 'title_4' => array(
- 'label' => 'Database Server',
- 'alter' => array(
- 'alter_text' => 0,
- 'text' => '',
- 'make_link' => 0,
- 'path' => '',
- 'link_class' => '',
- 'alt' => '',
- 'prefix' => '',
- 'suffix' => '',
- 'help' => '',
- 'trim' => 0,
- 'max_length' => '',
- 'word_boundary' => 1,
- 'ellipsis' => 1,
- 'strip_tags' => 0,
- 'html' => 0,
- ),
- 'link_to_node' => 1,
- 'exclude' => 0,
- 'id' => 'title_4',
- 'table' => 'node',
- 'field' => 'title',
- 'relationship' => 'db_server',
- 'override' => array(
- 'button' => 'Override',
- ),
- ),
- ));
- $handler->override_option('sorts', array(
- 'title' => array(
- 'order' => 'ASC',
- 'id' => 'title',
- 'table' => 'node',
- 'field' => 'title',
- 'relationship' => 'none',
- ),
- ));
- $handler->override_option('filters', array(
- 'type' => array(
- 'operator' => 'in',
- 'value' => array(
- 'site' => 'site',
- ),
- 'group' => '0',
- 'exposed' => FALSE,
- 'expose' => array(
- 'operator' => FALSE,
- 'label' => '',
- ),
- 'id' => 'type',
- 'table' => 'node',
- 'field' => 'type',
- 'relationship' => 'none',
- ),
- 'status' => array(
- 'operator' => '!=',
- 'value' => array(
- 'value' => '-2',
- 'min' => '',
- 'max' => '',
- ),
- 'group' => '0',
- 'exposed' => FALSE,
- 'expose' => array(
- 'operator' => FALSE,
- 'label' => '',
- ),
- 'id' => 'status',
- 'table' => 'hosting_site',
- 'field' => 'status',
- 'relationship' => 'none',
- ),
- ));
- $handler->override_option('access', array(
- 'type' => 'none',
- ));
- $handler->override_option('cache', array(
- 'type' => 'none',
- ));
- $handler->override_option('items_per_page', 30);
- $handler->override_option('use_pager', 'mini');
- $handler->override_option('style_plugin', 'hosting_site_list');
- $handler->override_option('style_options', array(
- 'grouping' => '',
- 'override' => 1,
- 'sticky' => 0,
- 'order' => 'asc',
- 'columns' => array(
- 'title' => 'title',
- 'status' => 'status',
- ),
- 'info' => array(
- 'title' => array(
- 'sortable' => 0,
- 'separator' => '',
- ),
- 'status' => array(
- 'separator' => '',
- ),
- ),
- 'default' => '-1',
- ));
-
- $views[$view->name] = $view;
-
- return $views;
-}
-
-
diff --git a/modules/hosting/site/views_handler_field_hosting_site_status.inc b/modules/hosting/site/views_handler_field_hosting_site_status.inc
index 13e56f8..04fdb2b 100644
--- a/modules/hosting/site/views_handler_field_hosting_site_status.inc
+++ b/modules/hosting/site/views_handler_field_hosting_site_status.inc
@@ -1,11 +1,24 @@
additional_fields = array('verified');
+ }
+
function option_definition() {
$options = parent::option_definition();
- $options['status_icon'] = array('default' => '0');
+ $options['status_mode'] = array('default' => 'text');
return $options;
}
@@ -13,12 +26,17 @@ class views_handler_field_hosting_site_status extends views_handler_field {
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
- $form['status_icon'] = array(
+ $form['status_mode'] = array(
'#type' => 'radios',
- '#title' => t('Display icon'),
- '#options' => array('Text', 'Image', 'Both'),
- '#default_value' => isset($this->options['status_icon']) ? $this->options['status_icon'] : '0',
- '#description' => t("Display icons instead of status values.")
+ '#title' => t('Display mode'),
+ '#options' => array(
+ 'text' => t('Text'),
+ 'image' => t('Image'),
+ 'text_image' => t('Text & Image'),
+ 'class' => t('CSS class'),
+ ),
+ '#default_value' => isset($this->options['status_mode']) ? $this->options['status_mode'] : 'text',
+ '#description' => t("Display mode of status values.")
);
}
@@ -26,11 +44,15 @@ class views_handler_field_hosting_site_status extends views_handler_field {
$value = $values->{$this->field_alias};
$output = _hosting_site_status($value);
- if ($this->options['status_icon'] == 1) {
- $output = "";
- }
- elseif ($this->options['status_icon'] == 2) {
- $output = "{$output}";
+ switch ($this->options['status_mode']) {
+ case 'image':
+ return "";
+
+ case 'text_image':
+ return "{$output}";
+
+ case 'class':
+ return _hosting_site_list_class($value, $values->{$this->aliases['verified']});
}
return $output;
}
diff --git a/modules/hosting/task/hosting_task.module b/modules/hosting/task/hosting_task.module
index 3ad22ba..d903de3 100644
--- a/modules/hosting/task/hosting_task.module
+++ b/modules/hosting/task/hosting_task.module
@@ -375,6 +375,16 @@ function hosting_add_task($nid, $type, $args = null, $status = HOSTING_TASK_QUEU
return $task;
}
+
+/**
+ * Callback for Node operations.
+ */
+function hosting_task_operation($nodes, $type) {
+ foreach ($nodes as $nid) {
+ hosting_add_task($nid, $type);
+ }
+}
+
/**
* Implementation of hook_form().
*/
@@ -1191,7 +1201,7 @@ function hosting_task_status_class($status = null) {
*/
function hosting_task_views_api() {
return array(
- 'api' => 2,
+ 'api' => 3,
'path' => drupal_get_path('module', 'hosting_task'),
);
}
diff --git a/modules/hosting/task/hosting_task.views.inc b/modules/hosting/task/hosting_task.views.inc
index 161be54..3b6aea5 100644
--- a/modules/hosting/task/hosting_task.views.inc
+++ b/modules/hosting/task/hosting_task.views.inc
@@ -4,15 +4,17 @@
*/
/**
- * Implementation of hook_views_handlers() to register all of the basic handlers
- * views uses.
+ * Implements hook_views_handlers().
*/
function hosting_task_views_handlers() {
return array(
'info' => array(
'path' => drupal_get_path('module', 'hosting_task'),
- ),
+ ),
'handlers' => array(
+ 'hosting_task_handler_field_hosting_task_status' => array(
+ 'parent' => 'views_handler_field',
+ ),
'hosting_task_handler_filter_hosting_task_type' => array(
'parent' => 'views_handler_filter_in_operator',
),
@@ -20,7 +22,7 @@ function hosting_task_views_handlers() {
);
}
-/**
+/**
* Implements hook_views_data().
*/
function hosting_task_views_data() {
@@ -29,9 +31,9 @@ function hosting_task_views_data() {
'group' => 'Hosting Task',
'title' => 'Task',
'join' => array(
- 'node' => array(
- 'left_field' => 'vid',
- 'field' => 'vid',
+ 'node' => array(
+ 'left_field' => 'vid',
+ 'field' => 'vid',
),
),
),
@@ -43,13 +45,13 @@ function hosting_task_views_data() {
'click sortable' => TRUE,
),
'filter' => array(
- 'handler' => 'hosting_task_handler_filter_hosting_task_type',
+ 'handler' => 'hosting_task_handler_filter_hosting_task_type',
),
),
'rid' => array(
'title' => t('Reference'),
'help' => t(''),
- 'relationship' => array(
+ 'relationship' => array(
'handler' => 'views_handler_relationship',
'base' => 'node',
'field' => 'nid',
@@ -60,7 +62,7 @@ function hosting_task_views_data() {
'title' => t('Status'),
'help' => t('Current status of the task.'),
'field' => array(
- 'handler' => 'views_handler_field',
+ 'handler' => 'hosting_task_handler_field_hosting_task_status',
'click sortable' => TRUE,
),
),