Commit 5795fe91 authored by merlinofchaos's avatar merlinofchaos

Tracker view, adjustments to convert, minor bug fixes

parent 578539c6
......@@ -29,6 +29,11 @@ html.js span.views-throbbing {
div.view div.views-admin-links {
font-size: xx-small;
margin-right: 1em;
padding-top: 1em;
}
.block div.view div.views-admin-links {
padding-top: 0;
}
div.view div.views-admin-links ul {
......@@ -77,4 +82,5 @@ div.view:hover div.views-hide {
/* Remove the border on tbody that system puts in */
.views-view-grid tbody {
border-top: none;
}
\ No newline at end of file
}
......@@ -179,6 +179,13 @@ function template_preprocess_views_ui_list_views(&$vars) {
* Provide a form for sorting and filtering the list of views.
*/
function views_ui_list_views_form(&$form_state) {
if (!variable_get('clean_url', FALSE)) {
$form['q'] = array(
'#type' => 'hidden',
'#value' => $_GET['q'],
);
}
$all = array('all' => t('<All>'));
$none = array('none' => t('<None>'));
......
......@@ -233,35 +233,53 @@ function views1_import($imported) {
// then see if any other modules want to adapt it using hook_views_convert().
foreach ($imported->field as $field) {
$id = NULL;
if (views_get_handler($field['tablename'], $field['field'], 'field')) {
$view->add_item('default', 'field', $field['tablename'], $field['field']);
$id = $view->add_item('default', 'field', $field['tablename'], $field['field']);
}
if ($view->display_handler->get_option('style_plugin') == 'table') {
$options = $view->display_handler->get_option('style_options');
if (!empty($field['defaultsort'])) {
$options['default'] = $id;
}
if (!empty($field['sortable'])) {
$options['info'][$id]['sortable'] = TRUE;
}
$view->display_handler->set_option('style_options', $options);
}
if (!empty($field['label'])) {
$item = $view->get_item('default', 'field', $id);
$item['label'] = $field['label'];
$view->set_item('default', 'field', $id, $item);
}
foreach (module_implements('views_convert') as $module) {
module_invoke($module, 'views_convert', 'default', 'field', $view, $field);
module_invoke($module, 'views_convert', 'default', 'field', $view, $field, $id);
}
}
foreach ($imported->sort as $field) {
$id = NULL;
if (views_get_handler($field['tablename'], $field['field'], 'sort')) {
$view->add_item('default', 'sort', $field['tablename'], $field['field']);
$id = $view->add_item('default', 'sort', $field['tablename'], $field['field']);
}
foreach (module_implements('views_convert') as $module) {
module_invoke($module, 'views_convert', 'default', 'sort', $view, $field);
module_invoke($module, 'views_convert', 'default', 'sort', $view, $field, $id);
}
}
foreach ($imported->argument as $field) {
if (views_get_handler($field['tablename'], $field['field'], 'argument')) {
$view->add_item('default', 'argument', $field['tablename'], $field['field']);
}
// Arguments didn't used to be identified by table.name so we just have to
// leave that out.
foreach (module_implements('views_convert') as $module) {
module_invoke($module, 'views_convert', 'default', 'argument', $view, $field);
module_invoke($module, 'views_convert', 'default', 'argument', $view, $field, NULL);
}
}
foreach ($imported->filter as $field) {
$id = NULL;
if (views_get_handler($field['tablename'], $field['field'], 'filter')) {
$view->add_item('default', 'filter', $field['tablename'], $field['field']);
$id = $view->add_item('default', 'filter', $field['tablename'], $field['field']);
}
foreach (module_implements('views_convert') as $module) {
module_invoke($module, 'views_convert', 'default', 'filter', $view, $field);
module_invoke($module, 'views_convert', 'default', 'filter', $view, $field, $id);
}
}
// Exposed filters now get added to the filter array, not as a separate array.
......@@ -279,7 +297,7 @@ function views1_import($imported) {
}
$count++;
foreach (module_implements('views_convert') as $module) {
module_invoke($module, 'views_convert', 'default', 'exposed_filter', $view, $field);
module_invoke($module, 'views_convert', 'default', 'exposed_filter', $view, $field, $field['field']);
}
}
......@@ -302,7 +320,15 @@ function views1_convert_style(&$view, &$handler, $type) {
$handler->set_option('row_options', array('teaser' => true));
break;
case 'table':
$options = array();
$options['columns'] = array();
$options['default'] = '';
$options['info'] = array();
$options['override'] = FALSE;
$options['order'] = 'asc';
$handler->set_option('style_plugin', 'table');
$handler->set_option('style_options', $options);
break;
default:
// Ask around if anybody else knows.
......
......@@ -225,12 +225,12 @@ class views_plugin extends views_object {
/**
* Validate the options form.
*/
function options_form_validate(&$form, &$form_state) { }
function options_validate(&$form, &$form_state) { }
/**
* Handle any special handling on the validate form.
*/
function options_form_submit(&$form, &$form_state) { }
function options_submit(&$form, &$form_state) { }
/**
* Add anything to the query that we might need to.
......
<?php
// $Id$
/**
* @file
* Contains default views on behalf of the comment module.
*/
/**
* Implementation of hook views_default_views().
*/
function comment_views_default_views() {
$views = array();
$view = new view;
$view->name = 'tracker';
$view->description = t('Shows all new activity on system.');
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = '0';
$view->api_version = 2;
$view->disabled = TRUE;
$view->display = array();
$display = new views_display;
$display->id = 'default';
$display->display_title = t('Defaults');
$display->display_plugin = 'default';
$display->position = '1';
$display->display_options = array (
'style_plugin' => 'table',
'style_options' =>
array (
'override' => 1,
'order' => 'desc',
'columns' =>
array (
'type' => 'type',
'title' => 'title',
'name' => 'name',
'comment_count' => 'comment_count',
'last_comment_timestamp' => 'last_comment_timestamp',
'timestamp' => 'title',
'new_comments' => 'comment_count',
),
'info' =>
array (
'type' =>
array (
'sortable' => 1,
'separator' => '',
),
'title' =>
array (
'sortable' => 1,
'separator' => '&nbsp;',
),
'name' =>
array (
'sortable' => 1,
'separator' => '',
),
'comment_count' =>
array (
'sortable' => 1,
'separator' => '<br />',
),
'last_comment_timestamp' =>
array (
'sortable' => 1,
'separator' => '&nbsp;',
),
'timestamp' =>
array (
'separator' => '',
),
'new_comments' =>
array (
'separator' => '',
),
),
'default' => 'last_comment_timestamp',
),
'row_plugin' => 'fields',
'row_options' =>
array (
),
'relationships' =>
array (
),
'fields' =>
array (
'type' =>
array (
'id' => 'type',
'table' => 'node',
'field' => 'type',
'label' => t('Type'),
),
'title' =>
array (
'id' => 'title',
'table' => 'node',
'field' => 'title',
'label' => t('Title'),
'link_to_node' => TRUE,
),
'name' =>
array (
'id' => 'name',
'table' => 'users',
'field' => 'name',
'label' => t('Author'),
'link_to_user' => true,
),
'comment_count' =>
array (
'id' => 'comment_count',
'table' => 'node_comment_statistics',
'field' => 'comment_count',
'label' => t('Replies'),
'set_precision' => false,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
'prefix' => '',
'suffix' => '',
),
'last_comment_timestamp' =>
array (
'id' => 'last_comment_timestamp',
'table' => 'node_comment_statistics',
'field' => 'last_comment_timestamp',
'label' => t('Last Post'),
'date_format' => 'small',
'custom_date_format' => '',
),
'timestamp' =>
array (
'id' => 'timestamp',
'table' => 'history_user',
'field' => 'timestamp',
'label' => '',
'comments' => 1,
'relationship' => 'none',
'link_to_node' => 0,
'comment' => 1,
),
'new_comments' =>
array (
'id' => 'new_comments',
'table' => 'node',
'field' => 'new_comments',
'label' => '',
'set_precision' => false,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
'prefix' => '',
'suffix' => t(' new'),
'link_to_comment' => 1,
'no_empty' => 1,
'relationship' => 'none',
),
),
'sorts' =>
array (
'last_comment_timestamp' =>
array (
'id' => 'last_comment_timestamp',
'table' => 'node_comment_statistics',
'field' => 'last_comment_timestamp',
'order' => 'ASC',
'granularity' => 'second',
),
),
'arguments' =>
array (
'uid' =>
array (
'id' => 'uid',
'table' => 'users',
'field' => 'uid',
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' =>
array (
'count' => true,
'override' => false,
'items_per_page' => 25,
),
'wildcard' => 'all',
'wildcard_substitution' => t('All'),
'title' => t('Recent posts for %1'),
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'relationship' => 'none',
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' =>
array (
'album' => 0,
'artist' => 0,
'book' => 0,
'page' => 0,
'story' => 0,
'track' => 0,
),
'validate_argument_php' => '',
),
),
'filters' =>
array (
'status' =>
array (
'id' => 'status',
'table' => 'node',
'field' => 'status',
'operator' => '=',
'value' => '1',
'group' => 0,
'exposed' => false,
'expose' =>
array (
'operator' => false,
'label' => '',
),
),
),
'items_per_page' => '25',
'title' => t('Recent posts'),
'header' => NULL,
'header_format' => NULL,
'footer' => NULL,
'footer_format' => NULL,
'empty' => NULL,
'empty_format' => NULL,
'use_pager' => true,
'pager_element' => 0,
'offset' => 0,
'access' =>
array (
'type' => 'none',
'role' =>
array (
),
'perm' => '',
),
);
$view->display['default'] = $display;
$display = new views_display;
$display->id = 'page';
$display->display_title = t('Page');
$display->display_plugin = 'page';
$display->position = '2';
$display->display_options = array (
'defaults' =>
array (
'access' => true,
'title' => true,
'header' => true,
'header_format' => true,
'header_empty' => true,
'footer' => true,
'footer_format' => true,
'footer_empty' => true,
'empty' => true,
'empty_format' => true,
'use_ajax' => true,
'items_per_page' => true,
'offset' => true,
'use_pager' => true,
'pager_element' => true,
'use_more' => true,
'distinct' => true,
'link_display' => true,
'style_plugin' => true,
'style_options' => true,
'row_plugin' => true,
'row_options' => true,
'relationships' => true,
'fields' => true,
'sorts' => true,
'arguments' => true,
'filters' => true,
),
'relationships' =>
array (
),
'fields' =>
array (
),
'sorts' =>
array (
),
'arguments' =>
array (
),
'filters' =>
array (
),
'path' => 'tracker',
'menu' =>
array (
'type' => 'normal',
'title' => t('Recent posts'),
),
'tab_options' =>
array (
'title' => NULL,
'weight' => NULL,
),
);
$view->display['page'] = $display;
$views[$view->name] = $view;
return $views;
}
......@@ -768,7 +768,7 @@ class views_handler_field_history_user_timestamp extends views_handler_field_nod
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
if (module_exists('comment')) {
$form['comment'] = array(
$form['comments'] = array(
'#type' => 'checkbox',
'#title' => t('Check for new comments as well'),
'#default_value' => !empty($this->options['comments']),
......
<?php
// $Id$
/**
* @file
* Contains default views on behalf of the node module.
*/
/**
* Implementation of hook views_default_views().
*/
function node_views_default_views() {
$views = array();
......
......@@ -101,6 +101,7 @@ function template_preprocess_views_view(&$vars) {
),
);
$vars['admin_links'] = theme('links', $vars['admin_links_raw']);
views_add_css('views');
}
else {
$vars['admin_links'] = '';
......
......@@ -89,10 +89,12 @@ function views_ui_menu() {
$items['admin/build/views/export/%views_ui_cache'] = $callback + array(
'page callback' => 'drupal_get_form',
'page arguments' => array('views_ui_export_page', 4),
'type' => MENU_LOCAL_TASK
);
$items['admin/build/views/clone/%views_ui_cache'] = $callback + array(
'page callback' => 'views_ui_clone_page',
'page arguments' => array(4),
'type' => MENU_LOCAL_TASK
);
$items['admin/build/views/enable/%views_ui_default'] = $callback + array(
'page callback' => 'views_ui_enable_page',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment