Commit 55653f86 authored by B_man's avatar B_man Committed by drumm
Browse files

Issue #3275509 by B_man: Drush make distribution release page views are causing issues with display

parent fd2ea16a
/* Package items table */
.view-project-package-local-items .release-update-status-1 {
background-color: #ffd;
}
.view-project-package-local-items .release-update-status-2 {
background-color: #fdd;
}
.view-project-package-local-items .update-status-1 {
background-image: url(/misc/watchdog-warning.png);
background-repeat: no-repeat;
padding-left: 22px;
}
.view-project-package-local-items .update-status-2 {
background-image: url(/misc/watchdog-error.png);
background-repeat: no-repeat;
padding-left: 22px;
}
......@@ -15,24 +15,6 @@ function project_package_views_api() {
);
}
/**
* Implements hook_preprocess_views_view_table().
*
* Add dynamic css classes to project package tables.
*/
function project_package_preprocess_views_view_table(&$variables) {
$view = $variables['view'];
if ($view->name == 'project_package_local_items') {
foreach ($view->result as $num => $result) {
if (isset($result->field_field_release_update_status[0]['raw']['value'])) {
// View of content.
$variables['row_classes'][$num][] = 'release-update-status-' . drupal_clean_css_identifier(drupal_strtolower($result->field_field_release_update_status[0]['raw']['value']));
}
}
$variables['classes_array'][] = 'project-release';
}
}
/**
* Implements hook_project_release_update_status_alter().
*/
......@@ -43,60 +25,6 @@ function project_package_project_release_update_status_alter(&$update_status, $r
}
}
/**
* Implements hook_node_view().
*/
function project_package_node_view($node, $view_mode, $langcode) {
if (project_release_node_is_release($node) && $view_mode === 'full') {
// If this release has any packaged local items, embed the view of those.
if (db_query_range("SELECT 1 FROM {project_package_local_release_item} WHERE package_nid = :nid", 0, 1, [':nid' => $node->nid])->fetchField()) {
$view_info = variable_get('project_package_release_items_view', 'project_package_local_items:default');
list($view_name, $display_name) = explode(':', $view_info);
$node->content['release_package_items'] = array(
'#prefix' => '<h3>' . t('In this package') . '</h3>',
'#markup' => '<div class="project-release-package-items">' . views_embed_view($view_name, $display_name, $node->nid) . '</div>',
'#weight' => 2,
);
}
// Embed a view into the release node output for local patches.
$has_local_patches = db_query("SELECT 1 FROM {project_package_local_patch} WHERE package_nid = :nid LIMIT 1", array(':nid' => $node->nid))->fetchField();
if (!empty($has_local_patches)) {
$view_info = variable_get('project_package_local_patches_view', 'project_package_local_patches:default');
list($view_name, $display_name) = explode(':', $view_info);
$node->content['release_package_local_patches'] = array(
'#prefix' => '<h3>' . t('Patches applied in this package') . '</h3>',
'#markup' => '<div class="project-release-package-local-patches">' . views_embed_view($view_name, $display_name, $node->nid) . '</div>',
'#weight' => 3,
);
}
// Embed a view into the release node output for remote items.
$has_remote_items = db_query("SELECT 1 FROM {project_package_remote_item} WHERE package_nid = :nid LIMIT 1", array(':nid' => $node->nid))->fetchField();
if (!empty($has_remote_items)) {
$view_info = variable_get('project_package_remote_items_view', 'project_package_remote_items:default');
list($view_name, $display_name) = explode(':', $view_info);
$node->content['release_package_remote_items'] = array(
'#prefix' => '<h3>' . t('External code in this package') . '</h3>',
'#markup' => '<div class="project-release-package-remote-items">' . views_embed_view($view_name, $display_name, $node->nid) . '</div>',
'#weight' => 4,
);
}
// Embed a view into the release node output for remote patches.
$has_remote_patches = db_query("SELECT 1 FROM {project_package_remote_patch} WHERE package_nid = :nid LIMIT 1", array(':nid' => $node->nid))->fetchField();
if (!empty($has_remote_patches)) {
$view_info = variable_get('project_package_remote_patches_view', 'project_package_remote_patches:default');
list($view_name, $display_name) = explode(':', $view_info);
$node->content['release_package_remote_patches'] = array(
'#prefix' => '<h3>' . t('Patches applied to external code in this package') . '</h3>',
'#markup' => '<div class="project-release-package-remote-patches">' . views_embed_view($view_name, $display_name, $node->nid) . '</div>',
'#weight' => 5,
);
}
}
}
/**
* Fix the update status whenever the status changes on items.
*/
......
<?php
/**
* @file
* Exported View project_package_remote_items.
*/
$view = new view();
$view->name = 'project_package_remote_items';
$view->description = 'Table of remote items (e.g. external libraries) included in a given packaged release.';
$view->tag = 'Project package';
$view->base_table = 'project_package_remote_item';
$view->human_name = 'Project package - remote items';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$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'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
'name' => 'name',
'url' => 'url',
);
$handler->display->display_options['style_options']['default'] = 'name';
$handler->display->display_options['style_options']['info'] = array(
'name' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'url' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
);
/* Field: Project package remote items: Remote item name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'project_package_remote_item';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['label'] = 'Name';
/* Field: Project package remote items: Remote item URL */
$handler->display->display_options['fields']['url']['id'] = 'url';
$handler->display->display_options['fields']['url']['table'] = 'project_package_remote_item';
$handler->display->display_options['fields']['url']['field'] = 'url';
$handler->display->display_options['fields']['url']['label'] = 'URL';
$handler->display->display_options['fields']['url']['display_as_link'] = FALSE;
/* Contextual filter: Project package remote items: Package node */
$handler->display->display_options['arguments']['package_nid']['id'] = 'package_nid';
$handler->display->display_options['arguments']['package_nid']['table'] = 'project_package_remote_item';
$handler->display->display_options['arguments']['package_nid']['field'] = 'package_nid';
$handler->display->display_options['arguments']['package_nid']['default_action'] = 'not found';
$handler->display->display_options['arguments']['package_nid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['package_nid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['package_nid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['package_nid']['summary_options']['items_per_page'] = '25';
/* Display: Content pane */
$handler = $view->new_display('panel_pane', 'Content pane', 'remote_items_pane');
$handler->display->display_options['allow']['use_pager'] = 0;
$handler->display->display_options['allow']['items_per_page'] = 0;
$handler->display->display_options['allow']['offset'] = 0;
$handler->display->display_options['allow']['link_to_view'] = 0;
$handler->display->display_options['allow']['more_link'] = 0;
$handler->display->display_options['allow']['path_override'] = 0;
$handler->display->display_options['allow']['title_override'] = 'title_override';
$handler->display->display_options['allow']['exposed_form'] = 0;
$handler->display->display_options['allow']['fields_override'] = 0;
$handler->display->display_options['argument_input'] = array(
'package_nid' => array(
'type' => 'context',
'context' => 'entity:node.nid',
'context_optional' => 0,
'panel' => '0',
'fixed' => '',
'label' => 'Project package remote items: Package node',
),
);
$translatables['project_package_remote_items'] = array(
t('Master'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('Name'),
t('URL'),
t('All'),
t('Content pane'),
t('View panes'),
);
<?php
/**
* @file
* Exported View project_package_remote_patches.
*/
$view = new view();
$view->name = 'project_package_remote_patches';
$view->description = 'Table of remote patches to a given packaged release.';
$view->tag = 'Project package';
$view->base_table = 'project_package_remote_item';
$view->human_name = 'Project package - remote patches';
$view->core = 7;
$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['use_more_always'] = FALSE;
$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['style_plugin'] = 'table';
$handler->display->display_options['style_options']['grouping'] = '';
$handler->display->display_options['style_options']['columns'] = array(
'name' => 'name',
'patch_nid' => 'patch_nid',
'title' => 'title',
'patch_file_url' => 'patch_file_url',
);
$handler->display->display_options['style_options']['default'] = 'name';
$handler->display->display_options['style_options']['info'] = array(
'name' => array(
'sortable' => 1,
'separator' => '',
),
'patch_nid' => array(
'sortable' => 0,
'separator' => '',
),
'title' => array(
'sortable' => 1,
'separator' => '',
),
'patch_file_url' => array(
'sortable' => 1,
'separator' => '',
),
);
/* Relationship: Project package remote patches: Patch node */
$handler->display->display_options['relationships']['patch_nid']['id'] = 'patch_nid';
$handler->display->display_options['relationships']['patch_nid']['table'] = 'project_package_remote_patch';
$handler->display->display_options['relationships']['patch_nid']['field'] = 'patch_nid';
/* Field: Project package remote items: Remote item name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'project_package_remote_item';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['label'] = 'Name';
/* Field: Project package remote patches: Patch node */
$handler->display->display_options['fields']['patch_nid']['id'] = 'patch_nid';
$handler->display->display_options['fields']['patch_nid']['table'] = 'project_package_remote_patch';
$handler->display->display_options['fields']['patch_nid']['field'] = 'patch_nid';
$handler->display->display_options['fields']['patch_nid']['relationship'] = 'remote_id';
$handler->display->display_options['fields']['patch_nid']['exclude'] = TRUE;
/* Field: Content: 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']['relationship'] = 'patch_nid';
$handler->display->display_options['fields']['title']['label'] = 'Patch issue';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = TRUE;
$handler->display->display_options['fields']['title']['alter']['text'] = '#[patch_nid]: [title]';
$handler->display->display_options['fields']['title']['alter']['make_link'] = TRUE;
$handler->display->display_options['fields']['title']['alter']['path'] = 'node/[patch_nid]';
$handler->display->display_options['fields']['title']['link_to_node'] = FALSE;
/* Field: Project package remote patches: Patch URL */
$handler->display->display_options['fields']['patch_file_url']['id'] = 'patch_file_url';
$handler->display->display_options['fields']['patch_file_url']['table'] = 'project_package_remote_patch';
$handler->display->display_options['fields']['patch_file_url']['field'] = 'patch_file_url';
$handler->display->display_options['fields']['patch_file_url']['relationship'] = 'remote_id';
$handler->display->display_options['fields']['patch_file_url']['label'] = 'URL';
/* Contextual filter: Project package remote patches: Package node */
$handler->display->display_options['arguments']['package_nid_1']['id'] = 'package_nid_1';
$handler->display->display_options['arguments']['package_nid_1']['table'] = 'project_package_remote_patch';
$handler->display->display_options['arguments']['package_nid_1']['field'] = 'package_nid';
$handler->display->display_options['arguments']['package_nid_1']['default_action'] = 'not found';
$handler->display->display_options['arguments']['package_nid_1']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['package_nid_1']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['package_nid_1']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['package_nid_1']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['package_nid_1']['specify_validation'] = TRUE;
$handler->display->display_options['arguments']['package_nid_1']['validate']['type'] = 'node';
$handler->display->display_options['arguments']['package_nid_1']['validate_options']['types'] = array(
'project_release' => 'project_release',
);
$handler->display->display_options['arguments']['package_nid_1']['validate_options']['access'] = TRUE;
/* Display: Content pane */
$handler = $view->new_display('panel_pane', 'Content pane', 'remote_patches_pane');
$handler->display->display_options['allow']['use_pager'] = 0;
$handler->display->display_options['allow']['items_per_page'] = 0;
$handler->display->display_options['allow']['offset'] = 0;
$handler->display->display_options['allow']['link_to_view'] = 0;
$handler->display->display_options['allow']['more_link'] = 0;
$handler->display->display_options['allow']['path_override'] = 0;
$handler->display->display_options['allow']['title_override'] = 'title_override';
$handler->display->display_options['allow']['exposed_form'] = 0;
$handler->display->display_options['allow']['fields_override'] = 0;
$handler->display->display_options['argument_input'] = array(
'package_nid_1' => array(
'type' => 'context',
'context' => 'entity:node.nid',
'context_optional' => 0,
'panel' => '0',
'fixed' => '',
'label' => 'Project package remote patches: Package node',
),
);
$translatables['project_package_remote_patches'] = array(
t('Defaults'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('Patch file node'),
t('Name'),
t('Patch node'),
t('Patch issue'),
t('#[patch_nid]: [title]'),
t('URL'),
t('All'),
t('Content pane'),
t('View panes'),
);
......@@ -89,81 +89,6 @@ function project_package_views_data() {
),
);
// Fields for {project_package_remote_item}.
// Define the base group of this table. Fields that don't
// have a group defined will go into this group by default.
$data['project_package_remote_item']['table']['group'] = t('Project package remote items');
// Advertise this table as a possible base table.
$data['project_package_remote_item']['table']['base'] = array(
'field' => 'id',
'title' => t('Package remote items'),
'help' => t("Remote items (or libraries) included in a release package."),
);
$data['project_package_remote_item']['package_nid'] = array(
'title' => t('Package node'),
'help' => t('The node ID of the package release node.'),
'field' => array(
'handler' => 'views_handler_field_node',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_node_nid',
'name field' => 'title',
'numeric' => TRUE,
'validate type' => 'nid',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'relationship' => array(
'help' => t('Add a relationship to gain access to more node data for the package release.'),
'base' => 'node',
'handler' => 'views_handler_relationship',
'label' => t('Package release node'),
),
);
$data['project_package_remote_item']['name'] = array(
'title' => t('Remote item name'),
'help' => t('The name of the remote item.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['project_package_remote_item']['url'] = array(
'title' => t('Remote item URL'),
'help' => t('The URL of the remote item.'),
'field' => array(
'handler' => 'views_handler_field_url',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
// Fields for {project_package_local_patch}.
// Define the base group of this table. Fields that don't
// have a group defined will go into this group by default.
......@@ -310,150 +235,5 @@ function project_package_views_data() {
'handler' => 'views_handler_sort',
),
);
// Fields for {project_package_remote_patch}.
// Define the base group of this table. Fields that don't
// have a group defined will go into this group by default.
$data['project_package_remote_patch']['table']['group'] = t('Project package remote patches');
// Allow implicit relationship to {node} for the remote patches in a package.
// To work with the package_nid, you should add an explicit relationship.
$data['project_package_remote_patch']['table']['join'] = array(
'project_package_remote_item' => array(
'type' => 'INNER',
'left_field' => 'id',
'field' => 'remote_id',
),
);
$data['project_package_remote_patch']['package_nid'] = array(
'title' => t('Package node'),
'help' => t('The node ID of the package release node.'),
'field' => array(
'handler' => 'views_handler_field_node',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_node_nid',
'name field' => 'title',
'numeric' => TRUE,
'validate type' => 'nid',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'relationship' => array(
'help' => t('Add a relationship to gain access to more node data for the package release.'),
'base' => 'node',
'handler' => 'views_handler_relationship',
'label' => t('Package release node'),
),
);
$data['project_package_remote_patch']['remote_id'] = array(
'title' => t('Remote item'),
'help' => t('The remote item ID of an item patched in a package.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_node_nid',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'relationship' => array(
'help' => t('Add a relationship to gain access to more node data for the remote item.'),
'base' => 'project_package_remote_item',
'handler' => 'views_handler_relationship',
'label' => t('Remote item'),
),
);
$data['project_package_remote_patch']['patch_file_url'] = array(
'title' => t('Patch URL'),
'help' => t('The URL of the patch file.'),
'field' => array(
'handler' => 'views_handler_field_url',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['project_package_remote_patch']['patch_description_url'] = array(
'title' => t('Patch description URL'),
'help' => t('The URL that describes the patch file.'),
'field' => array(
'handler' => 'views_handler_field_url',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['project_package_remote_patch']['patch_nid'] = array(
'title' => t('Patch node'),
'help' => t('The node ID associated with the patch file.'),
'field' => array(
'handler' => 'views_handler_field_node',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_node_nid',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'relationship' => array(
'help' => t('Add a relationship to gain access to more node data for the node associated with the patch file.'),
'base' => 'node',
'handler' => 'views_handler_relationship',
'label' => t('Patch file node'),
),
);
$data['project_package_remote_patch']['patch_comment_id'] = array(
'title' => t('Patch comment ID'),
'help' => t('The comment ID associated with the patch file.'),
'field' => array(
'handler' => 'views_handler_field_comment',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
return $data;
}