Commit 946e6a5c authored by merlinofchaos's avatar merlinofchaos

Add base table to view list info and filter

parent 9fe6b0ce
......@@ -32,12 +32,12 @@ body form#views-ui-list-views-form {
#views-ui-list-views-form .form-item {
padding-right: 1em;
float: left;
margin-top: 0;
}
#views-ui-list-views-form .form-submit {
clear: left;
position: relative;
top: .65em;
margin-top: 1.65em;
}
.views-entry .advanced-help-link {
......
......@@ -34,6 +34,8 @@ function template_preprocess_views_ui_list_views(&$vars) {
$vars['help_type_icon'] = theme('advanced_help_topic', 'views', 'view-type');
$base_tables = views_fetch_base_tables();
foreach ($views as $view) {
if ($form_state['values']['tag'] != 'all') {
if ($form_state['values']['tag'] == 'none') {
......@@ -49,6 +51,10 @@ function template_preprocess_views_ui_list_views(&$vars) {
continue;
}
if ($form_state['values']['base'] != 'all' && $form_state['values']['base'] != $view->base_table) {
continue;
}
if ($form_state['values']['display'] != 'all' && empty($view->display[$form_state['values']['display']])) {
continue;
}
......@@ -90,6 +96,7 @@ function template_preprocess_views_ui_list_views(&$vars) {
}
$item->title = $view->get_title();
$item->base = !empty($base_tables[$view->base_table]['title']) ? $base_tables[$view->base_table]['title'] : t('Broken');
$item->displays = array();
foreach ($view->display as $display) {
......@@ -188,9 +195,21 @@ function views_ui_list_views_form(&$form_state) {
'#default_value' => 'all',
);
$bases = array();
foreach (views_fetch_base_tables() as $table => $info) {
$bases[$table] = $info['title'];
}
$form['base'] = array(
'#type' => 'select',
'#title' => t('Type'),
'#options' => array_merge($all, $bases),
'#default_value' => 'all',
);
$form['type'] = array(
'#type' => 'select',
'#title' => t('View type'),
'#title' => t('Storage'),
'#options' => array(
'all' => t('<All>'),
t('Normal') => t('Normal'),
......@@ -218,8 +237,8 @@ function views_ui_list_views_form(&$form_state) {
'#type' => 'select',
'#title' => t('Order'),
'#options' => array(
'asc' => t('Ascending'),
'desc' => t('Descending'),
'asc' => t('Up'),
'desc' => t('Down'),
),
'#default_value' => 'asc',
);
......@@ -459,12 +478,17 @@ function views_ui_add_form(&$form_state) {
// TODO: This should be an autocomplete field.
);
$base_tables = array();
foreach (views_fetch_base_tables() as $table => $info) {
$base_tables[$table] = $info['title'] . '<div class="description">' . $info['description'] . '</div>';
}
$form['base_table'] = array(
'#type' => 'radios',
'#title' => t('View type'),
'#description' => t('The view type is the primary table for which information is being retrieved. The view type controls what arguments, fields, sort criteria and filters are available, so once this is set it <strong>cannot be changed</strong>.'),
'#default_value' => $view ? $view->base_table : 'node',
'#options' => views_fetch_base_table_names(),
'#options' => $base_tables,
);
if ($view) {
......@@ -1619,10 +1643,6 @@ function views_ui_edit_display_form_submit($form, &$form_state) {
$display->handler->options_submit($form, $form_state);
views_ui_cache_set($form_state['view']);
// @todo: Need a safe function to use for drupal_set_message in an ajax environ.
// This function would check $form_state for the ajax flag and, if set, simply
// discard the message. That way we could set some success messages for the
// non-jsy types here.
$form_state['redirect'] = 'admin/build/views/edit/' . $form_state['view']->name;
}
......
......@@ -388,11 +388,6 @@ class views_handler_field_prerender_list extends views_handler_field {
'#dependency' => array('radio:options[type]' => array('separator')),
);
if (empty($this->options['empty'])) {
// @todo: remove this. IT's just to remove notices for alpha4 users
$this->options['empty'] = '';
}
$form['empty'] = array(
'#type' => 'textfield',
'#title' => t('Empty list text'),
......
......@@ -1242,10 +1242,6 @@ class views_handler_filter_date extends views_handler_filter_numeric {
* The construct method needs to be overridden to provide a list of options;
* alternately, the value_form and admin_summary methods need to be overriden
* to provide something that isn't just a select list.
*
* @todo Should this handler allow an option as to whether or not to avoid
* duplicates? That would have an effect on the join, but if you're not
* concerned about duplicates you'll get more efficient queries.
*/
class views_handler_filter_many_to_one extends views_handler_filter_in_operator {
function init(&$view, &$options) {
......
......@@ -1958,22 +1958,6 @@ class views_plugin_display_block extends views_plugin_display {
}
}
/**
* Validate the options form.
*/
function options_validate($form, &$form_state) {
// It is very important to call the parent function here:
parent::options_validate($form, $form_state);
switch ($form_state['section']) {
case 'block_description':
// @todo: validate the block_description against other views
// @todo: validate the block_description against aliases.
break;
}
}
/**
* Perform any necessary changes to the form values prior to storage.
* There is no need for this function to actually store the data.
......
......@@ -220,7 +220,7 @@ class view extends views_db_object {
if (empty($this->display[$display_id])) {
$display_id = 'default';
if (empty($this->display[$display_id])) {
// @todo: Log an error here?
vpr(t('set_display called with invalid display id @display', array('@display' => $display_id)));
return FALSE;
}
}
......@@ -355,7 +355,6 @@ class view extends views_db_object {
$argument['handler']->set_relationship();
if (!is_object($argument['handler'])) {
// @todo: Set some kind of warning.
continue;
}
......@@ -537,7 +536,6 @@ class view extends views_db_object {
function _build($key) {
$array = &$this->$key;
foreach ($array as $id => $data) {
// @todo: we should report an error here if this is not an object.
if (!empty($array[$id]['handler']) && is_object($array[$id]['handler'])) {
// Give this handler access to the exposed filter input.
if (!empty($this->exposed_data)) {
......@@ -950,7 +948,6 @@ class view extends views_db_object {
* much faster.
*/
function load_views() {
// @todo: Integrate this in with caching.
$result = db_query("SELECT DISTINCT v.* FROM {views_view} v");
$views = array();
$vids = array();
......
......@@ -234,9 +234,6 @@ function node_views_data() {
'handler' => 'views_handler_field_node_link_delete',
),
);
// @todo: feed selector field -- hold for RSS.
// @todo: Filter by uid -- this will go in user.
// @todo: filter by authored or commented (this should be in comment.views.inc -- maybe)
......@@ -1034,11 +1031,6 @@ class views_handler_filter_node_type extends views_handler_filter_in_operator {
* @ingroup views_filter_handlers
*/
class views_handler_filter_history_user_timestamp extends views_handler_filter {
function options_form(&$form, &$form_state) {
// Remove all the normal options, including exposing.
// @todo: make it so we can expose this filter as a checkbox.
}
function query() {
global $user;
// This can only work if we're logged in.
......
......@@ -181,7 +181,6 @@ function profile_views_fetch_field($field) {
'handler' => 'views_handler_sort',
),
'filter' => array(
// @todo
'handler' => 'views_handler_filter_profile_selection',
'fid' => $field->fid,
),
......
......@@ -212,7 +212,6 @@ function taxonomy_views_data() {
);
// @todo: term_relation
// @todo: term_synonym
// ----------------------------------------------------------------------
// term_hierarchy table
......
......@@ -69,7 +69,7 @@ function upload_views_data() {
'title' => t('Description'),
'help' => t('The description of the uploaded file.'),
'field' => array(
'handler' => 'views_handler_field_upload_description', // @todo -- make this linkable, but it's a bit tough
'handler' => 'views_handler_field_upload_description',
'click sortable' => TRUE,
),
'sort' => array(
......
......@@ -277,7 +277,6 @@ function user_views_data() {
),
);
// @todo: tracker default view (in users.default_views.inc -- This really should go in comment)
return $data;
}
......
......@@ -15,7 +15,7 @@
<tr>
<td class="view-name">
<?php print $help_type_icon; ?>
<?php print t('<em>@type</em> view: <strong>@view</strong>', array('@type' => $view->type, '@view' => $view->name)); ?>
<?php print t('<em>@type</em> @base view: <strong>@view</strong>', array('@type' => $view->type, '@view' => $view->name, '@base' => $view->base)); ?>
<?php if (!empty($view->tag)): ?>
&nbsp;(<?php print $view->tag; ?>)
<?php endif; ?>
......
......@@ -536,7 +536,7 @@ function _views_weight_sort($a, $b) {
* @return
* A keyed array of in the form of 'base_table' => 'Description'.
*/
function views_fetch_base_table_names() {
function views_fetch_base_tables() {
static $base_tables = array();
if (empty($base_tables)) {
$weights = array();
......@@ -545,15 +545,14 @@ function views_fetch_base_table_names() {
foreach ($data as $table => $info) {
if (!empty($info['table']['base'])) {
$tables[$table] = array(
'title' => $info['table']['base']['title'] . '<div class="description">' . $info['table']['base']['help'] . "</div>\n",
'title' => $info['table']['base']['title'],
'description' => $info['table']['base']['help'],
'weight' => !empty($info['table']['base']['weight']) ? $info['table']['base']['weight'] : 0,
);
}
}
uasort($tables, '_views_weight_sort');
foreach ($tables as $table => $info) {
$base_tables[$table] = $info['title'];
}
$base_tables = $tables;
}
return $base_tables;
......
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