diff --git a/views_integration-588728-11.patch b/views_integration-588728-27.patch index add789e..f0b0feb 100644 --- a/views_integration-588728-11.patch +++ b/views_integration-588728-27.patch @@ -1,42 +1,1130 @@ +diff --git a/hostmaster.make b/hostmaster.make +index fd232de..ff590f2 100644 +--- a/hostmaster.make ++++ b/hostmaster.make +@@ -7,6 +7,10 @@ projects[openidadmin][version] = "1.2" + projects[install_profile_api][version] = "2.1" + projects[jquery_ui][version] = "1.4" + projects[modalframe][version] = "1.6" ++projects[views][version] = "3.0" ++projects[views_bulk_operations][version] = "1.13" ++; Add support for row classes - http://drupal.org/node/1843166#comment-6743346 ++projects[views_bulk_operations][patch][] = "http://drupal.org/files/views_row_classes-6.x-1.13-1843166-2.patch" + + ; These are contrib modules, but come under the Aegir 'umbrella' of control. + projects[hosting_platform_pathauto][version] = "2.0-beta1" +diff --git a/modules/hosting/hosting.css b/modules/hosting/hosting.css +index 8b23cc7..1b7b4e5 100644 +--- a/modules/hosting/hosting.css ++++ b/modules/hosting/hosting.css +@@ -68,6 +68,18 @@ td.hosting-actions .hosting-button-disabled { + } + + /** ++ * Hosting queue list. ++ */ ++ ++.view-hosting-task-list .views-field-task-type { ++ text-transform: capitalize; ++} ++ ++.view-hosting-task-list .views-field-task-type a { ++ text-transform: none; ++} ++ ++/** + * Status icons, colors. + */ + +@@ -212,7 +224,7 @@ div.hosting-site-field-description { + -webkit-border-radius: 3px; + } + +-div#hosting-task-list, div#hosting-task-queue-block { position: relative } ++div#hosting-task-list, div.view-hosting-task-list .view-content { position: relative } + div.modalframe-page-wrapper { background: white } + + +diff --git a/modules/hosting/hosting.info b/modules/hosting/hosting.info +index 16a0a04..e5e6a10 100755 +--- a/modules/hosting/hosting.info ++++ b/modules/hosting/hosting.info +@@ -2,6 +2,8 @@ name = Hosting + description = Allow this Drupal site to deploy hosted sites. + package = Hosting + dependencies[] = modalframe ++dependencies[] = views ++dependencies[] = views_bulk_operations + #dependencies[] = hosting_task + #dependencies[] = hosting_client + #dependencies[] = hosting_db_server +diff --git a/modules/hosting/platform/hosting_platform.module b/modules/hosting/platform/hosting_platform.module +index f588ee0..0ea5378 100644 +--- a/modules/hosting/platform/hosting_platform.module ++++ b/modules/hosting/platform/hosting_platform.module +@@ -448,7 +448,7 @@ function hosting_platform_view($node, $teaser = FALSE, $page = FALSE) { + $node->content['info']['status'] = array( + '#type' => 'item', + '#title' => t('Status'), +- '#value' => _hosting_platform_status($node), ++ '#value' => _hosting_platform_status($node->platform_status), + ); + + if ($node->makefile) { +@@ -506,14 +506,14 @@ function hosting_platform_hosting_site_site_list_filters() { + return array('platform'); + } + +-function _hosting_platform_status($node) { ++function _hosting_platform_status($status) { + static $labels = array( + HOSTING_PLATFORM_QUEUED => "Queued", + HOSTING_PLATFORM_ENABLED => "Enabled", + HOSTING_PLATFORM_DELETED => "Deleted", + HOSTING_PLATFORM_LOCKED => "Locked", + ); +- return $labels[$node->platform_status]; ++ return is_object($status) ? $labels[$status->platform_status] : $labels[$status]; + } + + /** +@@ -546,15 +546,14 @@ function hosting_platform_views_api() { + /** + * Define the classes that correspond to the platform status. + */ +-function _hosting_platform_list_class($node) { ++function _hosting_platform_list_class($status) { + static $labels = array( + HOSTING_PLATFORM_QUEUED => "hosting-queue", + HOSTING_PLATFORM_ENABLED => "hosting-success", + HOSTING_PLATFORM_DELETED => "hosting-error", + HOSTING_PLATFORM_LOCKED => "hosting-warning", + ); +- +- return $labels[$node->platform_status]; ++ return is_object($status) ? $labels[$status->platform_status] : $labels[$status]; + } + + /** +@@ -578,7 +577,7 @@ function hosting_platform_listing() { + $row[] = hosting_format_interval($node->verified); + $total += $count = hosting_site_count($nid, array(HOSTING_SITE_ENABLED, HOSTING_SITE_DISABLED, HOSTING_SITE_QUEUED)); + $row[] = $count; +- $rows[] = array('data' => $row, 'class' => _hosting_platform_list_class($node)); ++ $rows[] = array('data' => $row, 'class' => _hosting_platform_list_class($node->platform_status)); + } + $row = array(); + $row[] = array('data' => t('Total sites hosted'), 'colspan' => 4); +diff --git a/modules/hosting/platform/hosting_platform.views.inc b/modules/hosting/platform/hosting_platform.views.inc +index b753b61..823ebd9 100644 +--- a/modules/hosting/platform/hosting_platform.views.inc ++++ b/modules/hosting/platform/hosting_platform.views.inc +@@ -13,86 +13,92 @@ function hosting_platform_views_handlers() { + 'path' => drupal_get_path('module', 'hosting_platform'), + ), + 'handlers' => array( +- 'hosting_platform_handler_filter_hosting_platform_type' => array( +- 'parent' => 'views_handler_filter_in_operator', ++ // field handlers ++ 'views_handler_field_hosting_platform_status' => array( ++ 'parent' => 'views_handler_field_hosting_site_status', ++ ), ++ // field handlers ++ 'views_handler_field_hosting_platform_sites' => array( ++ 'parent' => 'views_handler_field', + ), + ), + ); + } + +-/** ++/** + * Implements hook_views_data(). + */ + function hosting_platform_views_data() { +- $data['hosting_platform'] = array( +- 'table' => array( +- 'group' => 'Hosting Platform', +- 'title' => 'Platform', +- 'join' => array( +- 'node' => array( +- 'left_field' => 'vid', +- 'field' => 'vid', +- ), ++ $data['hosting_platform']['table'] = array( ++ 'group' => 'Hosting Platform', ++ 'title' => 'Platform', ++ 'join' => array( ++ 'node' => array( ++ 'left_field' => 'vid', ++ 'field' => 'vid', + ), +- ) ++ ), + ); + +- $data['hosting_platform']['web_server'] = array( +- 'title' => t('Web Server'), +- 'help' => t('Relate a platform to the web server it is hosted on.'), +- 'relationship' => array( ++ $data['hosting_platform']['web_server'] = array( ++ 'title' => t('Web Server'), ++ 'help' => t('Relate a platform to the web server it is hosted on.'), ++ 'relationship' => array( + 'handler' => 'views_handler_relationship', + 'base' => 'node', +- 'field' => 'nid', ++ 'field' => 'web_server', + 'label' => t('web server'), + ), + ); + +- $data['hosting_platform']['publish_path'] = array( +- 'title' => t('Publish Path'), +- 'help' => t('The path on the server where this platform is installed.'), +- 'field' => array( +- 'handler' => 'views_handler_field_xss', +- 'click sortable' => TRUE, +- ), +- ); +-/* ++ $data['hosting_platform']['publish_path'] = array( ++ 'title' => t('Publish Path'), ++ 'help' => t('The path on the server where this platform is installed.'), ++ 'field' => array( ++ 'handler' => 'views_handler_field_xss', ++ 'click sortable' => TRUE, ++ ), ++ ); + +- 'web_server' => array( +- 'title' => t('Web Server'), +- 'help' => t('The webserver this platform is installed on.'), +- 'field' => array( +- 'handler' => 'views_handler_field', +- 'click sortable' => TRUE, +- ), ++ // $data['hosting_platform']['release_id'] = array( ++ // 'title' => t('Release ID'), ++ // 'help' => t('The release ID.'), ++ // 'field' => array( ++ // 'handler' => 'views_handler_field', ++ // 'click sortable' => TRUE, ++ // ), ++ // ); ++ ++ $data['hosting_platform']['verified'] = array( ++ 'title' => t('Verified Date'), ++ 'help' => t('The most recent date that this platform was verified.'), ++ 'field' => array( ++ 'handler' => 'views_handler_field_date', ++ 'click sortable' => TRUE, + ), +- 'release_id' => array( +- 'title' => t('Release ID'), +- 'help' => t('The release ID.'), +- 'field' => array( +- 'handler' => 'views_handler_field', +- 'click sortable' => TRUE, +- ), ++ ); ++ ++ $data['hosting_platform']['status'] = array( ++ 'title' => t('Status'), ++ 'help' => t('The current state of this platform.'), ++ 'field' => array( ++ 'handler' => 'views_handler_field_hosting_platform_status', ++ 'click sortable' => TRUE, + ), +- 'verified' => array( +- 'title' => t('Verfied Date'), +- 'help' => t('The description information for this platform.'), +- 'field' => array( +- 'handler' => 'views_handler_field_date', +- 'click sortable' => TRUE, +- ), ++ 'filter' => array( ++ 'handler' => 'views_handler_filter_numeric', + ), +- 'status' => array( +- 'title' => t('Status'), +- 'help' => t('The descri.'), +- 'field' => array( +- 'handler' => 'views_handler_field', +- 'click sortable' => TRUE, +- ), ++ ); ++ ++ $data['hosting_platform']['sites'] = array( ++ 'title' => t('Sites'), ++ 'help' => t('The number of sites in this platform.'), ++ 'field' => array( ++ 'handler' => 'views_handler_field_hosting_platform_sites', ++ 'field' => 'nid', ++ // 'click sortable' => TRUE, + ), + ); +- */ ++ + return $data; + } +- +- +diff --git a/modules/hosting/platform/hosting_platform.views_default.inc b/modules/hosting/platform/hosting_platform.views_default.inc +new file mode 100644 +index 0000000..476657b +--- /dev/null ++++ b/modules/hosting/platform/hosting_platform.views_default.inc +@@ -0,0 +1,407 @@ ++name = 'hosting_platform_list'; ++ $view->description = 'Display a list of platforms in aegir'; ++ $view->tag = 'hosting_platform'; ++ $view->base_table = 'node'; ++ $view->human_name = ''; ++ $view->core = 6; ++ $view->api_version = '3.0'; ++ $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ ++ ++ /* Display: Defaults */ ++ $handler = $view->new_display('default', 'Defaults', 'default'); ++ $handler->display->display_options['title'] = 'Platforms'; ++ $handler->display->display_options['use_ajax'] = TRUE; ++ $handler->display->display_options['access']['type'] = 'none'; ++ $handler->display->display_options['cache']['type'] = 'none'; ++ $handler->display->display_options['query']['type'] = 'views_query'; ++ $handler->display->display_options['exposed_form']['type'] = 'basic'; ++ $handler->display->display_options['pager']['type'] = 'none'; ++ $handler->display->display_options['pager']['options']['offset'] = '0'; ++ $handler->display->display_options['style_plugin'] = 'bulk'; ++ $handler->display->display_options['style_options']['row_class'] = '[status]'; ++ $handler->display->display_options['style_options']['columns'] = array( ++ 'status' => 'status', ++ 'status_1' => 'status_1', ++ 'title' => 'title', ++ 'title_1' => 'title_1', ++ 'verified' => 'verified', ++ 'sites' => 'sites', ++ ); ++ $handler->display->display_options['style_options']['default'] = 'title'; ++ $handler->display->display_options['style_options']['info'] = array( ++ 'status' => array( ++ 'sortable' => 0, ++ 'default_sort_order' => 'asc', ++ 'align' => '', ++ 'separator' => '', ++ ), ++ 'status_1' => array( ++ 'sortable' => 1, ++ 'default_sort_order' => 'desc', ++ 'align' => '', ++ 'separator' => '', ++ ), ++ 'title' => array( ++ 'sortable' => 1, ++ 'default_sort_order' => 'asc', ++ 'align' => '', ++ 'separator' => '', ++ ), ++ 'title_1' => array( ++ 'sortable' => 1, ++ 'default_sort_order' => 'asc', ++ 'align' => '', ++ 'separator' => '', ++ ), ++ 'verified' => array( ++ 'sortable' => 1, ++ 'default_sort_order' => 'asc', ++ 'align' => '', ++ 'separator' => '', ++ ), ++ 'sites' => array( ++ 'align' => '', ++ 'separator' => '', ++ ), ++ ); ++ $handler->display->display_options['style_options']['override'] = 1; ++ $handler->display->display_options['style_options']['sticky'] = 0; ++ $handler->display->display_options['style_options']['empty_table'] = 0; ++ $handler->display->display_options['style_options']['operations'] = array( ++ 'node_assign_owner_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'hosting_task_operation-d5753f4149333e6bb163b78489af62a7' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'hosting_task_operation-cbcdb2f1b1694e48f1d2a1956d5b34aa' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'views_bulk_operations_delete_node_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'node_mass_update-a27b9efabcd054685a549378b174ad11' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'hosting_task_operation-2e697b94e1c2d6cfa04148e13bbf09ab' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'system_message_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'hosting_task_operation-2b33c2655429ff68933d62ef1c2c5dbf' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'views_bulk_operations_ruleset_action_rules_set_1' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'views_bulk_operations_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'views_bulk_operations_script_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'node_make_sticky_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'node_make_unsticky_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'node_mass_update-c4d3b28efb86fd703619a50b74d43794' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'views_bulk_operations_argument_selector_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'node_promote_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'node_mass_update-14de7d028b4bffdf2b4a266562ca18ac' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'node_mass_update-9c585624b9b3af0b4687d5f97f35e047' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'node_publish_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'system_goto_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'node_unpromote_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'node_mass_update-8ce21b08bb8e773d10018b484fe4815e' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'hosting_task_operation-62832bfa32dda6f49c47986802958a8d' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'node_save_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'system_send_email_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'node_mass_update-0ccad85c1ebe4c9ceada1aa64293b080' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'node_unpublish_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'node_unpublish_by_keyword_action' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ 'hosting_task_operation-1ba8dfdca72110c3d78b76f9b18bf909' => array( ++ 'selected' => 0, ++ 'skip_confirmation' => 0, ++ 'label' => '', ++ ), ++ ); ++ $handler->display->display_options['style_options']['execution_type'] = '1'; ++ $handler->display->display_options['style_options']['display_type'] = '0'; ++ $handler->display->display_options['style_options']['display_result'] = 1; ++ $handler->display->display_options['style_options']['merge_single_action'] = 1; ++ $handler->display->display_options['style_options']['hide_selector'] = 0; ++ $handler->display->display_options['style_options']['preserve_selection'] = 1; ++ /* Relationship: Hosting Platform: Web Server */ ++ $handler->display->display_options['relationships']['web_server']['id'] = 'web_server'; ++ $handler->display->display_options['relationships']['web_server']['table'] = 'hosting_platform'; ++ $handler->display->display_options['relationships']['web_server']['field'] = 'web_server'; ++ $handler->display->display_options['relationships']['web_server']['required'] = 0; ++ /* Field: Class */ ++ $handler->display->display_options['fields']['status']['id'] = 'status'; ++ $handler->display->display_options['fields']['status']['table'] = 'hosting_platform'; ++ $handler->display->display_options['fields']['status']['field'] = 'status'; ++ $handler->display->display_options['fields']['status']['ui_name'] = 'Class'; ++ $handler->display->display_options['fields']['status']['exclude'] = TRUE; ++ $handler->display->display_options['fields']['status']['alter']['alter_text'] = 0; ++ $handler->display->display_options['fields']['status']['alter']['make_link'] = 0; ++ $handler->display->display_options['fields']['status']['alter']['absolute'] = 0; ++ $handler->display->display_options['fields']['status']['alter']['external'] = 0; ++ $handler->display->display_options['fields']['status']['alter']['replace_spaces'] = 0; ++ $handler->display->display_options['fields']['status']['alter']['trim_whitespace'] = 0; ++ $handler->display->display_options['fields']['status']['alter']['nl2br'] = 0; ++ $handler->display->display_options['fields']['status']['alter']['word_boundary'] = 1; ++ $handler->display->display_options['fields']['status']['alter']['ellipsis'] = 1; ++ $handler->display->display_options['fields']['status']['alter']['strip_tags'] = 0; ++ $handler->display->display_options['fields']['status']['alter']['trim'] = 0; ++ $handler->display->display_options['fields']['status']['alter']['html'] = 0; ++ $handler->display->display_options['fields']['status']['element_label_colon'] = 1; ++ $handler->display->display_options['fields']['status']['element_default_classes'] = 1; ++ $handler->display->display_options['fields']['status']['hide_empty'] = 0; ++ $handler->display->display_options['fields']['status']['empty_zero'] = 0; ++ $handler->display->display_options['fields']['status']['hide_alter_empty'] = 1; ++ $handler->display->display_options['fields']['status']['status_mode'] = 'class'; ++ /* Field: Hosting Platform: Status */ ++ $handler->display->display_options['fields']['status_1']['id'] = 'status_1'; ++ $handler->display->display_options['fields']['status_1']['table'] = 'hosting_platform'; ++ $handler->display->display_options['fields']['status_1']['field'] = 'status'; ++ $handler->display->display_options['fields']['status_1']['alter']['alter_text'] = 1; ++ $handler->display->display_options['fields']['status_1']['alter']['text'] = ' '; ++ $handler->display->display_options['fields']['status_1']['alter']['make_link'] = 0; ++ $handler->display->display_options['fields']['status_1']['alter']['absolute'] = 0; ++ $handler->display->display_options['fields']['status_1']['alter']['external'] = 0; ++ $handler->display->display_options['fields']['status_1']['alter']['replace_spaces'] = 0; ++ $handler->display->display_options['fields']['status_1']['alter']['trim_whitespace'] = 0; ++ $handler->display->display_options['fields']['status_1']['alter']['nl2br'] = 0; ++ $handler->display->display_options['fields']['status_1']['alter']['word_boundary'] = 1; ++ $handler->display->display_options['fields']['status_1']['alter']['ellipsis'] = 1; ++ $handler->display->display_options['fields']['status_1']['alter']['strip_tags'] = 0; ++ $handler->display->display_options['fields']['status_1']['alter']['trim'] = 0; ++ $handler->display->display_options['fields']['status_1']['alter']['html'] = 0; ++ $handler->display->display_options['fields']['status_1']['element_class'] = 'hosting-status'; ++ $handler->display->display_options['fields']['status_1']['element_label_colon'] = 1; ++ $handler->display->display_options['fields']['status_1']['element_default_classes'] = 1; ++ $handler->display->display_options['fields']['status_1']['hide_empty'] = 0; ++ $handler->display->display_options['fields']['status_1']['empty_zero'] = 0; ++ $handler->display->display_options['fields']['status_1']['hide_alter_empty'] = 1; ++ $handler->display->display_options['fields']['status_1']['status_mode'] = 'image'; ++ /* Field: Node: Title */ ++ $handler->display->display_options['fields']['title']['id'] = 'title'; ++ $handler->display->display_options['fields']['title']['table'] = 'node'; ++ $handler->display->display_options['fields']['title']['field'] = 'title'; ++ $handler->display->display_options['fields']['title']['label'] = 'Platform'; ++ $handler->display->display_options['fields']['title']['alter']['alter_text'] = 0; ++ $handler->display->display_options['fields']['title']['alter']['make_link'] = 0; ++ $handler->display->display_options['fields']['title']['alter']['absolute'] = 0; ++ $handler->display->display_options['fields']['title']['alter']['external'] = 0; ++ $handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0; ++ $handler->display->display_options['fields']['title']['alter']['trim_whitespace'] = 0; ++ $handler->display->display_options['fields']['title']['alter']['nl2br'] = 0; ++ $handler->display->display_options['fields']['title']['alter']['word_boundary'] = 1; ++ $handler->display->display_options['fields']['title']['alter']['ellipsis'] = 1; ++ $handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0; ++ $handler->display->display_options['fields']['title']['alter']['trim'] = 0; ++ $handler->display->display_options['fields']['title']['alter']['html'] = 0; ++ $handler->display->display_options['fields']['title']['element_label_colon'] = 1; ++ $handler->display->display_options['fields']['title']['element_default_classes'] = 1; ++ $handler->display->display_options['fields']['title']['hide_empty'] = 0; ++ $handler->display->display_options['fields']['title']['empty_zero'] = 0; ++ $handler->display->display_options['fields']['title']['hide_alter_empty'] = 1; ++ $handler->display->display_options['fields']['title']['link_to_node'] = 1; ++ /* Field: Node: Title */ ++ $handler->display->display_options['fields']['title_1']['id'] = 'title_1'; ++ $handler->display->display_options['fields']['title_1']['table'] = 'node'; ++ $handler->display->display_options['fields']['title_1']['field'] = 'title'; ++ $handler->display->display_options['fields']['title_1']['relationship'] = 'web_server'; ++ $handler->display->display_options['fields']['title_1']['label'] = 'Server'; ++ $handler->display->display_options['fields']['title_1']['alter']['alter_text'] = 0; ++ $handler->display->display_options['fields']['title_1']['alter']['make_link'] = 0; ++ $handler->display->display_options['fields']['title_1']['alter']['absolute'] = 0; ++ $handler->display->display_options['fields']['title_1']['alter']['external'] = 0; ++ $handler->display->display_options['fields']['title_1']['alter']['replace_spaces'] = 0; ++ $handler->display->display_options['fields']['title_1']['alter']['trim_whitespace'] = 0; ++ $handler->display->display_options['fields']['title_1']['alter']['nl2br'] = 0; ++ $handler->display->display_options['fields']['title_1']['alter']['word_boundary'] = 1; ++ $handler->display->display_options['fields']['title_1']['alter']['ellipsis'] = 1; ++ $handler->display->display_options['fields']['title_1']['alter']['strip_tags'] = 0; ++ $handler->display->display_options['fields']['title_1']['alter']['trim'] = 0; ++ $handler->display->display_options['fields']['title_1']['alter']['html'] = 0; ++ $handler->display->display_options['fields']['title_1']['element_label_colon'] = 1; ++ $handler->display->display_options['fields']['title_1']['element_default_classes'] = 1; ++ $handler->display->display_options['fields']['title_1']['hide_empty'] = 0; ++ $handler->display->display_options['fields']['title_1']['empty_zero'] = 0; ++ $handler->display->display_options['fields']['title_1']['hide_alter_empty'] = 1; ++ $handler->display->display_options['fields']['title_1']['link_to_node'] = 1; ++ /* Field: Hosting Platform: Verified Date */ ++ $handler->display->display_options['fields']['verified']['id'] = 'verified'; ++ $handler->display->display_options['fields']['verified']['table'] = 'hosting_platform'; ++ $handler->display->display_options['fields']['verified']['field'] = 'verified'; ++ $handler->display->display_options['fields']['verified']['label'] = 'Verified'; ++ $handler->display->display_options['fields']['verified']['alter']['alter_text'] = 0; ++ $handler->display->display_options['fields']['verified']['alter']['make_link'] = 0; ++ $handler->display->display_options['fields']['verified']['alter']['absolute'] = 0; ++ $handler->display->display_options['fields']['verified']['alter']['external'] = 0; ++ $handler->display->display_options['fields']['verified']['alter']['replace_spaces'] = 0; ++ $handler->display->display_options['fields']['verified']['alter']['trim_whitespace'] = 0; ++ $handler->display->display_options['fields']['verified']['alter']['nl2br'] = 0; ++ $handler->display->display_options['fields']['verified']['alter']['word_boundary'] = 1; ++ $handler->display->display_options['fields']['verified']['alter']['ellipsis'] = 1; ++ $handler->display->display_options['fields']['verified']['alter']['strip_tags'] = 0; ++ $handler->display->display_options['fields']['verified']['alter']['trim'] = 0; ++ $handler->display->display_options['fields']['verified']['alter']['html'] = 0; ++ $handler->display->display_options['fields']['verified']['element_label_colon'] = 1; ++ $handler->display->display_options['fields']['verified']['element_default_classes'] = 1; ++ $handler->display->display_options['fields']['verified']['hide_empty'] = 0; ++ $handler->display->display_options['fields']['verified']['empty_zero'] = 0; ++ $handler->display->display_options['fields']['verified']['hide_alter_empty'] = 1; ++ $handler->display->display_options['fields']['verified']['date_format'] = 'time ago'; ++ /* Field: Hosting Platform: Sites */ ++ $handler->display->display_options['fields']['sites']['id'] = 'sites'; ++ $handler->display->display_options['fields']['sites']['table'] = 'hosting_platform'; ++ $handler->display->display_options['fields']['sites']['field'] = 'sites'; ++ $handler->display->display_options['fields']['sites']['alter']['alter_text'] = 0; ++ $handler->display->display_options['fields']['sites']['alter']['make_link'] = 0; ++ $handler->display->display_options['fields']['sites']['alter']['absolute'] = 0; ++ $handler->display->display_options['fields']['sites']['alter']['external'] = 0; ++ $handler->display->display_options['fields']['sites']['alter']['replace_spaces'] = 0; ++ $handler->display->display_options['fields']['sites']['alter']['trim_whitespace'] = 0; ++ $handler->display->display_options['fields']['sites']['alter']['nl2br'] = 0; ++ $handler->display->display_options['fields']['sites']['alter']['word_boundary'] = 1; ++ $handler->display->display_options['fields']['sites']['alter']['ellipsis'] = 1; ++ $handler->display->display_options['fields']['sites']['alter']['strip_tags'] = 0; ++ $handler->display->display_options['fields']['sites']['alter']['trim'] = 0; ++ $handler->display->display_options['fields']['sites']['alter']['html'] = 0; ++ $handler->display->display_options['fields']['sites']['element_label_colon'] = 1; ++ $handler->display->display_options['fields']['sites']['element_default_classes'] = 1; ++ $handler->display->display_options['fields']['sites']['hide_empty'] = 0; ++ $handler->display->display_options['fields']['sites']['empty_zero'] = 0; ++ $handler->display->display_options['fields']['sites']['hide_alter_empty'] = 1; ++ /* Filter: Node: Type */ ++ $handler->display->display_options['filters']['type']['id'] = 'type'; ++ $handler->display->display_options['filters']['type']['table'] = 'node'; ++ $handler->display->display_options['filters']['type']['field'] = 'type'; ++ $handler->display->display_options['filters']['type']['value'] = array( ++ 'platform' => 'platform', ++ ); ++ /* Filter: Node: Published */ ++ $handler->display->display_options['filters']['status']['id'] = 'status'; ++ $handler->display->display_options['filters']['status']['table'] = 'node'; ++ $handler->display->display_options['filters']['status']['field'] = 'status'; ++ $handler->display->display_options['filters']['status']['value'] = '1'; ++ /* Filter: Hosting Platform: Status */ ++ $handler->display->display_options['filters']['status_1']['id'] = 'status_1'; ++ $handler->display->display_options['filters']['status_1']['table'] = 'hosting_platform'; ++ $handler->display->display_options['filters']['status_1']['field'] = 'status'; ++ $handler->display->display_options['filters']['status_1']['operator'] = '!='; ++ $handler->display->display_options['filters']['status_1']['value']['value'] = '-2'; ++ $handler->display->display_options['filters']['status_1']['allow_null'] = 1; ++ ++ /* Display: Page */ ++ $handler = $view->new_display('page', 'Page', 'page_1'); ++ $handler->display->display_options['path'] = 'hosting/platforms'; ++ ++ $views[$view->name] = $view; ++ ++ return $views; ++} +diff --git a/modules/hosting/platform/views_handler_field_hosting_platform_sites.inc b/modules/hosting/platform/views_handler_field_hosting_platform_sites.inc +new file mode 100644 +index 0000000..3758bd5 +--- /dev/null ++++ b/modules/hosting/platform/views_handler_field_hosting_platform_sites.inc +@@ -0,0 +1,8 @@ ++{$this->field_alias}; ++ return hosting_site_count($value, array(HOSTING_SITE_ENABLED, HOSTING_SITE_DISABLED, HOSTING_SITE_QUEUED));; ++ } ++} +diff --git a/modules/hosting/platform/views_handler_field_hosting_platform_status.inc b/modules/hosting/platform/views_handler_field_hosting_platform_status.inc +new file mode 100644 +index 0000000..9f49e41 +--- /dev/null ++++ b/modules/hosting/platform/views_handler_field_hosting_platform_status.inc +@@ -0,0 +1,25 @@ ++{$this->field_alias}; ++ $output = _hosting_platform_status($value); ++ ++ switch ($this->options['status_mode']) { ++ case 'image': ++ return ""; ++ ++ case 'text_image': ++ return "{$output}"; ++ ++ case 'class': ++ return _hosting_platform_list_class($value); ++ } ++ return $output; ++ } ++} diff --git a/modules/hosting/site/hosting_site.module b/modules/hosting/site/hosting_site.module -index 30574d1..559168f 100644 +index 2f63464..4b0572f 100644 --- a/modules/hosting/site/hosting_site.module +++ b/modules/hosting/site/hosting_site.module -@@ -275,6 +275,33 @@ function hosting_site_hosting_tasks() { +@@ -35,14 +35,6 @@ if (module_exists('hosting_quota')) { + function hosting_site_menu() { + $items = array(); + +- $items['hosting/sites'] = array( +- 'title' => 'Sites', +- 'description' => 'Display a list of sites', +- 'page callback' => 'hosting_sites', +- 'access arguments' => array('view site'), +- 'type' => MENU_NORMAL_ITEM, +- ); +- + $items['hosting/sites/list'] = array( + 'title' => 'List', + 'type' => MENU_DEFAULT_LOCAL_TASK, +@@ -102,48 +94,6 @@ function hosting_site_node_load($arg) { + } + + /** +- * Get all possible filters types that could be applied to the site list. +- * +- * This list will be used to sanitise the selected filters in the query string. +- * +- * @return +- * An array of the possible filters. +- */ +-function hosting_site_get_possible_site_list_filters() { +- $filters = module_invoke_all('hosting_site_site_list_filters'); +- if (!is_array($filters)) { +- $filters = array(); +- } +- drupal_alter('hosting_site_site_list_filters', $filters); +- return $filters; +-} +- +-/** +- * Page handler for displaying list of hosted sites on front page +- */ +-function hosting_sites() { +- $filter_by = isset($_GET['filter_by']) ? $_GET['filter_by'] : NULL; +- $filter_value = isset($_GET['filter_value']) ? $_GET['filter_value'] : NULL; +- // Now, we need to be incredibly careful with what values of $filter_by and +- // $filter_value that we let through. First ensure that $filter_by is one of +- // the possible values that we send through. +- if (!in_array($filter_by, hosting_site_get_possible_site_list_filters(), TRUE)) { +- $filter_by = NULL; +- } +- // Now ensure that $filter_value is numeric. +- if (!is_numeric($filter_value)) { +- $filter_value = NULL; +- } +- +- if ($list = drupal_get_form('hosting_site_list_form', $filter_by, $filter_value)) { +- return $list; +- } +- $create_site_link = l(t('Create a site now?'), 'node/add/site'); +- return t("No sites have been created yet. !link", array( +- '!link' => $create_site_link)); +-} +- +-/** + * Generate a link allowing the user to log into their new site, or simply + * go to the site front page if the link has expired. + */ +@@ -305,6 +255,52 @@ function hosting_site_hosting_tasks() { + } + + /** ++ * Implements hook_node_operations(). ++ */ ++function hosting_site_node_operations() { ++ $operations = array(); ++ ++ $operations['hosting-site-verify'] = array( ++ 'label' => t('Verify'), ++ 'callback' => 'hosting_task_operation', ++ 'callback arguments' => array('verify'), ++ ); ++ ++ $operations['hosting-site-disable'] = array( ++ 'label' => t('Disable'), ++ 'callback' => 'hosting_task_operation', ++ 'callback arguments' => array('disable'), ++ ); ++ ++ $operations['hosting-site-enable'] = array( ++ 'label' => t('Enable'), ++ 'callback' => 'hosting_task_operation', ++ 'callback arguments' => array('enable'), ++ ); ++ ++ $operations['hosting-site-delete'] = array( ++ 'label' => t('Delete'), ++ 'callback' => 'hosting_task_operation', ++ 'callback arguments' => array('delete'), ++ ); ++ ++ $operations['hosting-site-login-reset'] = array( ++ 'label' => t('Reset password'), ++ 'callback' => 'hosting_task_operation', ++ 'callback arguments' => array('login-reset'), ++ ); ++ ++ $operations['hosting-site-backup-delete'] = array( ++ 'label' => t('Delete backups'), ++ 'callback' => 'hosting_task_operation', ++ 'callback arguments' => array('backup-delete'), ++ ); ++ ++ ++ return $operations; ++} ++ ++/** + * Implementation of hook_perm + */ + function hosting_site_perm() { +@@ -513,274 +509,6 @@ function hosting_site_task_status($nid) { + return hosting_task_status_output('nid', $nid, 'install'); } +-/** +- * Create a form for building a list of sites. +- * @TODO Add ability to filter by additional fields +- */ +-function hosting_site_list_form($form_state, $filter_by = NULL, $filter_value = NULL) { +- $step = isset($form_state['storage']['step']) ? $form_state['storage']['step'] : 1; +- +- // Step 1 - select sites +- if ($step == 1) { +- $args[] = 'site'; +- $cond = ''; +- +- if ($filter_by && $filter_value) { +- if ($filter_by == 'status') { +- $cond = ' AND s.' . $filter_by . ' & %d'; +- } else { +- $cond = ' AND s.' . $filter_by . ' = %d'; +- } +- $args[] = $filter_value; +- } +- +- $header = array( +- array('data' => t('Site'), 'field' => 'title'), +- array('data' => t('Profile'), 'field' => 'profile'), +- array('data' => t('Language'), 'field' => 'site_language'), +- array('data' => t('Created'), 'field' => 'created', 'sort' => 'desc'), +- ); +- $platforms = _hosting_get_platforms(); +- if (sizeof($platforms) > 1) { +- $header[] = array('data' => t('Platform'), 'field' => 'platform'); +- } +- +- $sql = "SELECT n.nid, n.title, n.created, s.status as site_status, profile, s.language as site_language, platform, verified FROM {node} n left join {hosting_site} s ON n.vid=s.vid WHERE type='%s' AND s.status != -2 " . $cond; +- $sql .= tablesort_sql($header); +- +- // @TODO hide deleted sites +- $result = pager_query(db_rewrite_sql($sql), 25, 1, null, $args); +- +- $form['options'] = array( +- '#type' => 'fieldset', +- '#title' => t('Site tasks'), +- '#prefix' => '
', +- '#suffix' => '
', +- ); +- $options = array(); +- +- foreach (hosting_available_tasks('site') as $task => $array) { +- // At this stage we only want to handle simple tasks, the presense of a +- // specific task form means there are other options for this tasks. +- $func = 'hosting_task_' . $task . '_form'; +- if (!function_exists($func) && user_access('create '. $task .' task')) { +- $options[$task] = $array['title']; +- } +- } +- $form['options']['task'] = array( +- '#type' => 'select', +- '#options' => $options, +- '#default_value' => 'backup', +- ); +- $form['options']['submit'] = array( +- '#type' => 'submit', +- '#value' => t('Add to queue'), +- '#submit' => array('hosting_site_list_form_submit'), +- ); +- +- $sites = array(); +- while ($node = db_fetch_object($result)) { +- $sites[$node->nid] = ''; +- $form['site'][$node->nid] = array('#value' => l($node->title, 'node/' . $node->nid)); +- $form['profile'][$node->nid] = array('#value' => ($node->profile) ? _hosting_node_link($node->profile) : t('n/a')); +- $form['language'][$node->nid] = array('#value' => ($node->site_language) ? _hosting_language_name($node->site_language) : t('n/a')); +- $form['created'][$node->nid] = array('#value' => t("@interval ago", array('@interval' => format_interval(time() - $node->created, 1)))); +- if (sizeof($platforms) > 1) { +- $form['platform'][$node->nid] = array('#value' => ($node->platform) ? _hosting_node_link($node->platform) : t('n/a')); +- } +- $form['site_class'][$node->nid] = array('#value' => _hosting_site_list_class($node, $node->verified)); +- } +- $form['sites'] = array('#type' => 'checkboxes', '#options' => $sites); +- $form['pager'] = array('#value' => theme('pager', NULL, 25, 1)); +- $form['#theme'] = 'hosting_site_list'; +- $query = array(); +- if (isset($_GET['page'])) { +- $query['page'] = $_GET['page']; +- } +- if (isset($filter_by)) { +- $query['filter_by'] = $filter_by; +- } +- if (isset($filter_value)) { +- $query['filter_value'] = $filter_value; +- } +- $form['#action'] = url('hosting/sites', array('query' => $query)); +- return $form; +- } +- elseif ($step == 2) { +- $task = $form_state['values']['task']; +- $tasks = hosting_available_tasks('site'); +- +- $title = array( +- 'passed' => t("The following sites will be processed"), +- 'failed' => t("The following sites failed validation checks and will not be processed") +- ); +- foreach (array('passed', 'failed') as $type) { +- if (sizeof($form_state['storage'][$type])) { +- foreach ($form_state['storage'][$type] as $site_id => $url) { +- $row = array( +- 'data' => array( +- array('data' => l($url, 'node/'.$site_id), 'class' => 'hosting-status'), +- ), +- 'class' => ($type == 'passed' ? 'hosting-success' : 'hosting-error'), +- ); +- $rows[] = $row; +- } +- } +- } +- +- $header = array(t('Site')); +- $form['sites_test'] = array( +- '#value' => theme('table', $header, $rows) +- ); +- +- if (sizeof($form_state['storage']['failed']) && sizeof($form_state['storage']['passed'])) { +- drupal_set_message(t('The task @task is not able to be performed on all the sites selected, the sites below that failed will not be added to the queue.', array('@task' => $task)), 'warning'); +- } +- elseif (sizeof($form_state['storage']['failed'])) { +- drupal_set_message(t('The task @task is not able to be performed on any of the selected sites.', array('@task' => $task)), 'error'); +- $form['return_link'] = array('#value' => l('Return to site listing', 'hosting/sites')); +- return $form; +- } +- +- $form['help'] = array('#value' => $tasks[$task]['description']); +- +- $question = t('Are you sure you want to perform the "@task" task on each of the following sites?', array('@task' => $tasks[$task]['title'])); +- return confirm_form($form, $question, 'hosting/sites', '', $tasks[$task]['title']); +- } +-} +-/** +- * Validate hosting_site_list form submissions. +- */ +-function hosting_site_list_form_validate($form, &$form_state) { +- if (isset($form_state['values']['sites'])) { +- $sites = array_filter($form_state['values']['sites']); +- if (count($sites) == 0) { +- form_set_error('', t('No sites selected.')); +- } +- } +-} +- +-/** +- * Process hosting_site_list form submissions. +- */ +-function hosting_site_list_form_submit($form, &$form_state) { +- $step = isset($form_state['storage']['step']) ? $form_state['storage']['step'] : 1; +- +- $task = $form_state['values']['task']; +- switch ($step) { +- case 1: +- $form_state['storage']['task'] = $task; +- // Verify tasks can be performed on each site. +- $tasks = hosting_available_tasks('site'); +- +- // Filter out unchecked sites +- $sites = array_filter($form_state['values']['sites']); +- +- $operations = array(); +- foreach ($sites as $site) { +- $operations[] = array('hosting_sites_batch_process', +- array($site, $task)); +- } +- if (sizeof($operations)) { +- $batch = array( +- 'operations' => $operations, +- 'title' => t('Processing'), +- 'progress_message' => t('Evaluated @current out of @total sites.'), +- 'error_message' => t('The update has encountered an error.'), +- ); +- batch_set($batch); +- } +- break; +- case 2: +- $values = $form_state['values']; +- foreach ($form_state['storage']['passed'] as $site_id => $url) { +- hosting_add_task($site_id, $form_state['storage']['task'], $values['parameters']); +- } +- unset($form_state['storage']); +- $step = 0; +- drupal_set_message(t('The task @task will be applied to the selected sites and have been added to the task queue.', array('@task' => $form_state['storage']['task']))); +- break; +- } +- $form_state['storage']['step'] = $step + 1; +-} +- +-function hosting_sites_batch_process($site_id, $task, &$context) { +- if (!isset($context['sandbox']['progress'])) { +- $context['sandbox']['progress'] = 0; +- } +- +- $site = node_load($site_id); +- $batch =& batch_get(); +- +- if (hosting_task_menu_access($site, $task)) { +- $batch['form_state']['storage']['passed'][$site->nid] = $site->title; +- } +- else { +- $batch['form_state']['storage']['failed'][$site->nid] = $site->title; +- } +-} +- +-/** +- * Implementation of hook_theme(). +- */ +-function hosting_site_theme() { +- return array( +- 'hosting_site_list' => array( +- 'arguments' => array('form' => NULL), +- ), +- ); +-} +- +-/** +- * Build the site list form. +- */ +-function theme_hosting_site_list($form) { +- // If there are rows in this form, then $form['site'] contains a list of +- // the title form elements. +- $has_posts = isset($form['site']) && is_array($form['site']); +- $select_header = $has_posts ? theme('table_select_header_cell') : ''; +- $header = array( +- $select_header, +- array('data' => t('Site'), 'field' => 'title'), +- array('data' => t('Profile'), 'field' => 'profile'), +- array('data' => t('Language'), 'field' => 'site_language'), +- array('data' => t('Created'), 'field' => 'created', 'sort' => 'desc'), +- ); +- if (isset($form['platform'])) { +- $header[] = array('data' => t('Platform'), 'field' => 'platform'); +- } +- $output = ''; +- +- $output .= drupal_render($form['options']); +- if ($has_posts) { +- foreach (element_children($form['site']) as $key) { +- $row = array(); +- $row[] = drupal_render($form['sites'][$key]); +- $row[] = array('data' => drupal_render($form['site'][$key]), 'class'=> 'hosting-status'); +- $row[] = drupal_render($form['profile'][$key]); +- $row[] = drupal_render($form['language'][$key]); +- $row[] = drupal_render($form['created'][$key]); +- if (isset($form['platform'])) { +- $row[] = drupal_render($form['platform'][$key]); +- } +- $rows[] = array('data' => $row, 'class' => drupal_render($form['site_class'][$key])); +- } +- +- } +- else { +- $rows[] = array(array('data' => t('No sites available.'), 'colspan' => sizeof($header))); +- } +- +- $output .= theme('table', $header, $rows, array('class' => 'hosting-table')); +- if ($form['pager']['#value']) { +- $output .= drupal_render($form['pager']); +- } +- +- $output .= drupal_render($form); +- +- return $output; +-} +- + /** -+ * 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) { + * Define the classes that correspond to the site status. +@@ -806,20 +534,7 @@ function _hosting_site_list_class($node, $verified = null) { */ function hosting_site_views_api() { return array( @@ -59,7 +1147,7 @@ index 30574d1..559168f 100644 - $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 +index e84b5ea..48071fc 100644 --- a/modules/hosting/site/hosting_site.views.inc +++ b/modules/hosting/site/hosting_site.views.inc @@ -1,24 +1,23 @@ @@ -208,7 +1296,11 @@ index e84b5ea..03227c2 100644 return $data; } -@@ -121,398 +123,3 @@ function hosting_site_views_handlers() { +@@ -117,402 +119,6 @@ function hosting_site_views_handlers() { + 'views_handler_field_hosting_site_status' => array( + 'parent' => 'views_handler_field', + ), +- ), ); } @@ -609,10 +1701,10 @@ index e84b5ea..03227c2 100644 - diff --git a/modules/hosting/site/hosting_site.views_default.inc b/modules/hosting/site/hosting_site.views_default.inc new file mode 100644 -index 0000000..08b49c4 +index 0000000..235b017 --- /dev/null +++ b/modules/hosting/site/hosting_site.views_default.inc -@@ -0,0 +1,414 @@ +@@ -0,0 +1,317 @@ +new_display('default', 'Defaults', 'default'); ++ $handler->display->display_options['title'] = 'Sites'; + $handler->display->display_options['use_ajax'] = TRUE; -+ $handler->display->display_options['access']['type'] = 'none'; ++ $handler->display->display_options['access']['type'] = 'perm'; ++ $handler->display->display_options['access']['perm'] = 'view site'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; @@ -700,18 +1794,8 @@ index 0000000..08b49c4 + $handler->display->display_options['style_options']['sticky'] = 0; + $handler->display->display_options['style_options']['empty_table'] = 0; + $handler->display->display_options['style_options']['operations'] = array( -+ 'node_assign_owner_action' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'views_bulk_operations_delete_node_action' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'node_mass_update-a27b9efabcd054685a549378b174ad11' => array( -+ 'selected' => 0, ++ 'hosting_task_operation-1ba8dfdca72110c3d78b76f9b18bf909' => array( ++ 'selected' => 1, + 'skip_confirmation' => 0, + 'label' => '', + ), @@ -720,112 +1804,22 @@ index 0000000..08b49c4 + 'skip_confirmation' => 0, + 'label' => '', + ), -+ 'system_message_action' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), + 'hosting_task_operation-2b33c2655429ff68933d62ef1c2c5dbf' => array( + 'selected' => 1, + 'skip_confirmation' => 0, + 'label' => '', + ), -+ 'views_bulk_operations_ruleset_action_rules_set_1' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'views_bulk_operations_action' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'views_bulk_operations_script_action' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'node_make_sticky_action' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'node_make_unsticky_action' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'node_mass_update-c4d3b28efb86fd703619a50b74d43794' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'views_bulk_operations_argument_selector_action' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'node_promote_action' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'node_mass_update-14de7d028b4bffdf2b4a266562ca18ac' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'node_mass_update-9c585624b9b3af0b4687d5f97f35e047' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'node_publish_action' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'system_goto_action' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'node_unpromote_action' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'node_mass_update-8ce21b08bb8e773d10018b484fe4815e' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'node_save_action' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'system_send_email_action' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'node_mass_update-0ccad85c1ebe4c9ceada1aa64293b080' => array( -+ 'selected' => 0, -+ 'skip_confirmation' => 0, -+ 'label' => '', -+ ), -+ 'node_unpublish_action' => array( -+ 'selected' => 0, ++ 'hosting_task_operation-d5753f4149333e6bb163b78489af62a7' => array( ++ 'selected' => 1, + 'skip_confirmation' => 0, + 'label' => '', + ), -+ 'node_unpublish_by_keyword_action' => array( -+ 'selected' => 0, ++ 'hosting_task_operation-62832bfa32dda6f49c47986802958a8d' => array( ++ 'selected' => 1, + 'skip_confirmation' => 0, + 'label' => '', + ), -+ 'hosting_task_operation-1ba8dfdca72110c3d78b76f9b18bf909' => array( ++ 'hosting_task_operation-cbcdb2f1b1694e48f1d2a1956d5b34aa' => array( + 'selected' => 1, + 'skip_confirmation' => 0, + 'label' => '', @@ -1021,6 +2015,7 @@ index 0000000..08b49c4 + + /* Display: Page */ + $handler = $view->new_display('page', 'Page', 'page_1'); ++ $handler->display->display_options['exposed_block'] = TRUE; + $handler->display->display_options['path'] = 'hosting/sites'; + + $views[$view->name] = $view; @@ -1111,11 +2106,48 @@ index 930a876..0000000 -set_display('block'); ++ $view->pre_execute(); ++ $return['markup'] = $view->render('block'); ++ + drupal_json($return); + exit(); + } +@@ -375,6 +379,16 @@ function hosting_add_task($nid, $type, $args = null, $status = HOSTING_TASK_QUEU return $task; } @@ -1132,7 +2164,7 @@ index 3ad22ba..d903de3 100644 /** * Implementation of hook_form(). */ -@@ -1191,7 +1201,7 @@ function hosting_task_status_class($status = null) { +@@ -1231,7 +1245,26 @@ function hosting_task_status_class($status = null) { */ function hosting_task_views_api() { return array( @@ -1141,8 +2173,27 @@ index 3ad22ba..d903de3 100644 'path' => drupal_get_path('module', 'hosting_task'), ); } ++ ++/** ++ * Implements hook_preprocess_views_view_table(). ++ */ ++function hosting_task_preprocess_views_view_table(&$vars) { ++ $id = "{$vars['view']->name}-{$vars['view']->current_display}"; ++ ++ switch ($id) { ++ case 'hosting_task_list-block': ++ modalframe_parent_js(); ++ drupal_add_js(drupal_get_path('module','hosting_task') . '/hosting_task.js'); ++ ++ $settings['hostingTaskRefresh'] = array( ++ 'queueBlock' => 1 ++ ); ++ drupal_add_js($settings, 'setting'); ++ break; ++ } ++} diff --git a/modules/hosting/task/hosting_task.views.inc b/modules/hosting/task/hosting_task.views.inc -index 161be54..3b6aea5 100644 +index 161be54..d898707 100644 --- a/modules/hosting/task/hosting_task.views.inc +++ b/modules/hosting/task/hosting_task.views.inc @@ -4,15 +4,17 @@ @@ -1166,87 +2217,118 @@ index 161be54..3b6aea5 100644 'hosting_task_handler_filter_hosting_task_type' => array( 'parent' => 'views_handler_filter_in_operator', ), -@@ -20,7 +22,7 @@ function hosting_task_views_handlers() { - ); - } - --/** -+/** +@@ -24,55 +26,58 @@ 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( +- $data['hosting_task'] = array( +- 'table' => array( +- 'group' => 'Hosting Task', +- 'title' => 'Task', +- 'join' => array( - 'node' => array( - 'left_field' => 'vid', - 'field' => 'vid', -+ 'node' => array( -+ 'left_field' => 'vid', -+ 'field' => 'vid', - ), +- ), ++ $data['hosting_task']['table'] = array( ++ 'group' => 'Hosting Task', ++ 'title' => 'Task', ++ 'join' => array( ++ 'node' => array( ++ 'left_field' => 'vid', ++ 'field' => 'vid', ), ), -@@ -43,13 +45,13 @@ function hosting_task_views_data() { - 'click sortable' => TRUE, - ), - 'filter' => array( +- 'task_type' => array( +- 'title' => t('Type'), +- 'help' => t(''), +- 'field' => array( +- 'handler' => 'views_handler_field', +- 'click sortable' => TRUE, +- ), +- 'filter' => array( - 'handler' => 'hosting_task_handler_filter_hosting_task_type', -+ 'handler' => 'hosting_task_handler_filter_hosting_task_type', - ), +- ), ++ ); ++ ++ $data['hosting_task']['task_type'] = array( ++ 'title' => t('Type'), ++ 'help' => t(''), ++ 'field' => array( ++ 'handler' => 'views_handler_field', ++ 'click sortable' => TRUE, ), - '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( +- 'rid' => array( +- 'title' => t('Reference'), +- 'help' => t(''), ++ 'filter' => array( ++ 'handler' => 'hosting_task_handler_filter_hosting_task_type', ++ ), ++ ); ++ ++ $data['hosting_task']['rid'] = array( ++ 'title' => t('Reference'), ++ 'help' => t(''), + 'relationship' => array( +- 'handler' => 'views_handler_relationship', +- 'base' => 'node', +- 'field' => 'nid', +- 'label' => t('Reference'), +- ), ++ 'handler' => 'views_handler_relationship', ++ 'base' => 'node', ++ 'field' => 'rid', ++ 'label' => t('Reference'), + ), +- 'task_status' => array( +- '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, - ), +- 'click sortable' => TRUE, +- ), ++ ); ++ ++ $data['hosting_task']['task_status'] = array( ++ 'title' => t('Status'), ++ 'help' => t('Current status of the task.'), ++ 'field' => array( ++ 'handler' => 'hosting_task_handler_field_hosting_task_status', ++ 'click sortable' => TRUE, ), +- 'executed' => array( +- 'title' => t('Executed'), +- 'help' => t('Date this task was executed.'), +- 'field' => array( +- 'handler' => 'views_handler_field_date', +- 'click sortable' => TRUE, +- ), ++ ); ++ ++ $data['hosting_task']['executed'] = array( ++ 'title' => t('Executed'), ++ 'help' => t('Date this task was executed.'), ++ 'field' => array( ++ 'handler' => 'views_handler_field_date', ++ 'click sortable' => TRUE, + ), + ); ++ + return $data; + } + diff --git a/modules/hosting/task/hosting_task.views_default.inc b/modules/hosting/task/hosting_task.views_default.inc new file mode 100644 -index 0000000..cadf12c +index 0000000..6767c33 --- /dev/null +++ b/modules/hosting/task/hosting_task.views_default.inc -@@ -0,0 +1,314 @@ +@@ -0,0 +1,294 @@ +name}-{$vars['view']->current_display}"; -+ -+ switch ($id) { -+ case 'hosting_task_list-block_1': -+ drupal_add_js(drupal_get_path('module','hosting_task') . '/hosting_task.js'); -+ -+ $settings['hostingTaskRefresh'] = array( -+ 'queueBlock' => 1 -+ ); -+ drupal_add_js($settings, 'setting'); -+ -+ // Add ID. -+ $vars['attributes_array']['id'] = 'hosting-task-queue-block'; -+ $vars['attributes'] = drupal_attributes($vars['attributes_array']); -+ break; -+ } -+} -+ -+/** + * Implementation of hook_views_default_views(). + */ +function hosting_task_views_default_views() { @@ -1269,7 +2351,8 @@ index 0000000..cadf12c + $handler->display->display_options['use_ajax'] = TRUE; + $handler->display->display_options['use_more'] = TRUE; + $handler->display->display_options['use_more_text'] = 'More tasks'; -+ $handler->display->display_options['access']['type'] = 'none'; ++ $handler->display->display_options['access']['type'] = 'perm'; ++ $handler->display->display_options['access']['perm'] = 'access task logs'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; @@ -1399,7 +2482,7 @@ index 0000000..cadf12c + $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE; + + /* Display: Block */ -+ $handler = $view->new_display('block', 'Block', 'block_1'); ++ $handler = $view->new_display('block', 'Block', 'block'); + + /* Display: Page */ + $handler = $view->new_display('page', 'Page', 'page_1'); @@ -1428,6 +2511,7 @@ index 0000000..cadf12c + $handler->display->display_options['fields']['task_status']['alter']['strip_tags'] = 0; + $handler->display->display_options['fields']['task_status']['alter']['trim'] = 0; + $handler->display->display_options['fields']['task_status']['alter']['html'] = 0; ++ $handler->display->display_options['fields']['task_status']['alter']['status_mode'] = 'class'; + $handler->display->display_options['fields']['task_status']['element_label_colon'] = 1; + $handler->display->display_options['fields']['task_status']['element_default_classes'] = 1; + $handler->display->display_options['fields']['task_status']['hide_empty'] = 0;