Commit 912718e8 authored by merlinofchaos's avatar merlinofchaos

Patch 70158 by webcheck: Remove extraneous whitespace

parent 3f79b421
......@@ -7,7 +7,7 @@
12/8/2005 Added options varchar(255) to view_argument as well.
12/10/2005 Added block_more int(1) to view_view
12/21/2005 Renamed 'sql' to 'query' and 'countsql' to 'countquery' for consistency
1/2/2006 SCHEMA CHANGES SCHEMA CHANGES
1/2/2006 SCHEMA CHANGES SCHEMA CHANGES
Too drastic to easily deal with. Before you install this version of
Views, you should export all your old views as a backup, then drop the
views_view table and re-import. Sorry. I hope to not do something like
......
......@@ -2,13 +2,13 @@
OVERVIEW
The views module provides a flexible method for Drupal administrators to control
how lists of content are presented. Traditionally, Drupal has hard-coded most of
The views module provides a flexible method for Drupal administrators to control
how lists of content are presented. Traditionally, Drupal has hard-coded most of
this, particularly in how taxonomy and tracker lists are formatted.
This tool is essentially a sort-of smart query builder that, given enough
information, can build the proper query, execute it, and display the results. It
has four modes, plus a special mode, and provides an impressive amount of
This tool is essentially a sort-of smart query builder that, given enough
information, can build the proper query, execute it, and display the results. It
has four modes, plus a special mode, and provides an impressive amount of
functionality from these modes.
INSTALLING VIEWS
......
......@@ -64,14 +64,14 @@ function book_views_tables() {
),
),
);
return $tables;
}
function book_views_arguments() {
$arguments = array(
'book_parent' => array(
'name' => t("Book: Parent Node ID"),
'name' => t("Book: Parent Node ID"),
'handler' => "views_handler_arg_book_parent",
),
);
......
......@@ -633,6 +633,6 @@ function views_handler_sort_random($action, &$query, $sortinfo, $sort) {
}
}
......@@ -266,7 +266,7 @@ function theme_views_view_popular_recent($view, $type, $nodes) {
}
$items[] = $item;
}
$output = theme('item_list', $items);
return "<div class='view' id='view-$view->name'>$output</div>\n";
}
......@@ -290,7 +290,7 @@ function theme_views_view_popular_alltime($view, $type, $nodes) {
}
$items[] = $item;
}
$output = theme('item_list', $items);
return "<div class='view' id='view-$view->name'>$output</div>\n";
}
......
......@@ -277,7 +277,7 @@ function views_handler_arg_taxid($op, &$query, $argtype, $arg = '') {
}
list($type, $info) = _views_break_phrase($query);
$tids = implode(',', $info); // only does numbers so safe
$result = db_query("SELECT name FROM {term_data} WHERE tid IN (%s)", $tids);
while ($term = db_fetch_object($result)) {
$title .= ($title ? ($type == 'or' ? ' + ' : ', ') : '') . check_plain($term->name);
......@@ -387,7 +387,7 @@ function views_handler_filter_tid_by_voc($op, $filterinfo) {
function views_handler_filter_tid_custom($op, $filter, $filterinfo, &$query) {
// When filtering via depth, we have to add a chain. If it's an or query
// we add 1 chain, but in an and query we actually basically have to add
// a 2 dimensional array.
// a 2 dimensional array.
_views_add_taxonomy($filter['operator'], $filter['value'], $filter['options'], $query);
......@@ -412,8 +412,8 @@ function views_handler_filter_vid() {
function _views_add_taxonomy($op, $value, $depth, &$query) {
// When filtering via depth, we have to add a chain. If it's an or query
// we add 1 chain, but in an and query we actually basically have to add
// a 2 dimensional array.
// a 2 dimensional array.
// $query->ensure_table('term_data'); // this is to make sure the views_get_title table comes first.
if ($op == 'OR') {
......
......@@ -219,7 +219,7 @@ function views_handler_arg_uid($op, &$query, $argtype, $arg = '') {
case 'title':
if (!$query) {
return variable_get('anonymous', 'Anonymous');
}
}
$user = db_fetch_object(db_query("SELECT name FROM {users} WHERE uid = '%d'", $query));
return $user->name;
}
......@@ -254,7 +254,7 @@ function views_handler_arg_uid_touch($op, &$query, $argtype, $arg = '') {
case 'title':
if (!$query) {
return variable_get('anonymous', 'Anonymous');
}
}
$user = db_fetch_object(db_query("SELECT name FROM {users} WHERE uid = '%d'", $query));
return $user->name;
}
......
......@@ -230,7 +230,7 @@
else {
drupal_set_message(t('The installation of views module was unsuccessful.'), 'error');
}
}
}
/*
* update module for UTF.
......
......@@ -617,7 +617,7 @@ function views_build_view($type, $view, $args = array(), $use_pager = false, $li
foreach ($replacements as $src => $dest) {
$info['query'] = str_replace($src, $dest, $info['query']);
$info['countquery'] = str_replace($src, $dest, $info['countquery']);
if (is_array($info['args'])) {
foreach ($info['args'] as $id => $arg) {
$info['args'][$id] = str_replace($src, $dest, $arg);
......@@ -1104,7 +1104,7 @@ function views_create_view($name, $description, $access = array()) {
$view->name = $name;
$view->description = $description;
$view->access = $access;
// ensure some things are numerically 0.
$view->nodes_per_page = 0;
$view->nodes_per_block = 0;
......@@ -1223,7 +1223,7 @@ function views_view_add_sort(&$view, $table, $field, $order, $option) {
* Figure out how to display the data of a field. Many fields simply display
* the data as-is, but many fields have to massage that data, which is
* done through handlers.
*
*
* DEPRECATED. Left in for backward compatibility.
*/
function _views_handle_field($fields, $field, $data) {
......@@ -1359,7 +1359,7 @@ function views_filters_process($form) {
}
function theme_views_filters($form) {
$view = $form['view']['#value'];
foreach ($view->exposed_filter as $count => $expose) {
$row[] = form_render($form["op$count"]) . form_render($form["filter$count"]);
$label[] = $expose['label'];
......@@ -1418,7 +1418,7 @@ function theme_views_view_table($view, $nodes) {
* Display the nodes of a view as teasers.
*/
function theme_views_view_teasers($view, $nodes) {
return views_theme('views_view_nodes', $view, $nodes, true);
return views_theme('views_view_nodes', $view, $nodes, true);
}
/**
......@@ -1775,23 +1775,23 @@ function views_handler_filter_like($op, $filter, $filterinfo, &$query) {
$query->ensure_table($filterinfo['table']);
switch ($filter['operator']) {
case 'contains':
$query->add_where("UPPER(%s) LIKE UPPER('%%%s%%')",
$query->add_where("UPPER(%s) LIKE UPPER('%%%s%%')",
$filter['field'], $filter['value']);
break;
case 'starts':
$query->add_where("UPPER(%s) LIKE UPPER('%s%%')",
$query->add_where("UPPER(%s) LIKE UPPER('%s%%')",
$filter['field'], $filter['value']);
break;
case 'ends':
$query->add_where("UPPER(%s) LIKE UPPER('%%%s')",
$query->add_where("UPPER(%s) LIKE UPPER('%%%s')",
$filter['field'], $filter['value']);
break;
case 'not':
$query->add_where("UPPER(%s) NOT LIKE UPPER('%%%s%%')",
$query->add_where("UPPER(%s) NOT LIKE UPPER('%%%s%%')",
$filter['field'], $filter['value']);
break;
case '=':
$query->add_where("UPPER(%s) = '%%%s%%'",
$query->add_where("UPPER(%s) = '%%%s%%'",
$filter['field'], $filter['value']);
break;
}
......
......@@ -9,7 +9,7 @@ function _views_build_query(&$view, $args = array()) {
// Process static filters
_views_view_build_filters($query, $view);
// Process arguments.
$view->args = $args; // we'll need these later.
......@@ -17,7 +17,7 @@ function _views_build_query(&$view, $args = array()) {
if ($args[$i] != NULL && $args[$i] != '') {
_views_view_build_arg($query, $args[$i], $argument);
}
else {
else {
// This is what we do if we expected an arg but we didn't get it.
switch ($argument['argdefault']) {
case 1:
......@@ -28,7 +28,7 @@ function _views_build_query(&$view, $args = array()) {
$self_sort = "ASC";
case 5:
// the if is a kind of a hack to make this case fall-thru fluid
if (!$self_sort) {
if (!$self_sort) {
$self_sort = "DESC";
}
case 6:
......@@ -39,14 +39,14 @@ function _views_build_query(&$view, $args = array()) {
$sort = true;
}
break 2; // switch and for
}
}
}
}
}
if (!$summary || $sort) {
_views_view_build_sorts($query, $view);
$plugins = _views_get_style_plugins();
if (($view->page && ($plugins[$view->page_type]['needs_fields'])) ||
if (($view->page && ($plugins[$view->page_type]['needs_fields'])) ||
($view->block && ($plugins[$view->block_type]['needs_fields']))) {
_views_view_build_fields($query, $view);
}
......@@ -67,7 +67,7 @@ function _views_build_query(&$view, $args = array()) {
*/
function _views_view_build_filters(&$query, &$view) {
$filters = _views_get_filters();
foreach ($view->filter as $i => $filter) {
$filterinfo = $filters[$filter['field']]; // shortcut
$field = $filterinfo['field'];
......@@ -84,11 +84,11 @@ function _views_view_build_filters(&$query, &$view) {
$filter['operator'] = check_plain($_GET["op$count"]);
}
if ($expose['optional']) {
if ($expose['optional']) {
if (!isset($_GET["filter$count"]) && !$expose['is_default']) {
continue 2; // skip
}
if ($_GET["filter$count"] == '**ALL**' ||
if ($_GET["filter$count"] == '**ALL**' ||
(is_array($_GET["filter$count"]) && in_array('**ALL**', $_GET["filter$count"]))) {
continue 2; // skip this filter entirely.
}
......@@ -187,7 +187,7 @@ function _views_view_build_sorts(&$query, $view) {
*/
function _views_view_build_fields(&$query, &$view) {
$fields = _views_get_fields();
$fields = _views_get_fields();
foreach ($view->field as $field) {
// Some fields are not actually fields but require special handlers
......@@ -195,17 +195,17 @@ function _views_view_build_fields(&$query, &$view) {
$fieldname = $field['fullname']; // combined table & fieldname
$fieldinfo = $fields[$fieldname]; // laziness + readability
if (isset($fieldinfo['query_handler']) && function_exists($fieldinfo['query_handler'])) {
$fieldinfo['query_handler']($field, $fieldinfo, $query);
}
if (!$fieldinfo['notafield']) {
$query->add_field($field['field'], $field['tablename'], $field['queryname']);
}
// special handling
if (is_array($fieldinfo['addlfields'])) {
foreach ($fieldinfo['addlfields'] as $name)
foreach ($fieldinfo['addlfields'] as $name)
$query->add_field($name, $field['tablename'], "$field[tablename]_$name");
}
}
......@@ -268,7 +268,7 @@ class _views_query {
}
/*
* Add a field to the query table, possibly with an alias. This will
* Add a field to the query table, possibly with an alias. This will
* automatically call ensure_table to make sure the required table
* exists, *unless* $table is unset.
*/
......@@ -288,7 +288,7 @@ class _views_query {
$this->fields[] = "$table$field$a";
}
/*
/*
* Set the base field to be distinct.
*/
function set_distinct() {
......@@ -368,7 +368,7 @@ class _views_query {
/*
* This function will ensure a table exists; if it already exists it won't
* do anything, but if it doesn't it will add the table queue. It will ensure
* do anything, but if it doesn't it will add the table queue. It will ensure
* a path leads back to the views_get_title table.
*/
function ensure_table($table) {
......@@ -391,7 +391,7 @@ class _views_query {
* If true, it will ensure that a path back to views_get_title_table exists. If false, it
* assumes the caller is already sure about this and does not repeat it.
* @param $howmany
* How many instances of the table to add? (Useful for interesting join
* How many instances of the table to add? (Useful for interesting join
* combos)
* @param $joininfo
* In some join configurations this table may actually join back through
......@@ -407,7 +407,7 @@ class _views_query {
if ($ensure_path && !$this->ensure_path($table)) {
return false;
}
$this->tables[$table] += $howmany;
for ($i = $this->tables[$table] - $howmany + 1; $i <= $this->tables[$table]; $i++) {
......@@ -515,13 +515,13 @@ class _views_query {
$table_num = $tinfo['num'];
$table_alias = $this->get_table_name($table, $table_num);
$joininfo = (!$this->joins[$table][$table_num] ?
$joininfo = (!$this->joins[$table][$table_num] ?
$table_data[$table]['join'] : $this->joins[$table][$table_num]);
// the { is a special character which seems to be treated differently
// in PHP5 than PHP4 so we do this a little oddly.
$join_type = $joininfo['type'] == 'inner' ? 'INNER' : 'LEFT';
$joins .= " $join_type JOIN {" . $table_real . "} $table_alias ON " . $joininfo['left']['table'] . "." .
$joins .= " $join_type JOIN {" . $table_real . "} $table_alias ON " . $joininfo['left']['table'] . "." .
$joininfo['left']['field'] . " = $table_alias." . $joininfo['right']['field'];
if (isset($joininfo['extra'])) {
......@@ -557,7 +557,7 @@ class _views_query {
$this->orderby[] = str_replace('ORDER BY ', '', $result);
}
}
if ($this->orderby) {
$orderby = "ORDER BY " . implode(', ', $this->orderby);
}
......
......@@ -93,51 +93,51 @@ function views_ui_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array('path' => 'admin/views',
$items[] = array('path' => 'admin/views',
'title' => t('views'),
'callback' => 'views_ui_admin_page',
'access' => user_access('administer views'),
'type' => MENU_NORMAL_ITEM);
$items[] = array('path' => 'admin/views/list',
$items[] = array('path' => 'admin/views/list',
'title' => t('list'),
'callback' => 'views_ui_admin_page',
'access' => user_access('administer views'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => '-1');
$items[] = array('path' => 'admin/views/add',
$items[] = array('path' => 'admin/views/add',
'title' => t('add'),
'callback' => 'views_ui_admin_add_page',
'access' => user_access('administer views'),
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/views/edit',
$items[] = array('path' => 'admin/views/edit',
'title' => t('edit view'),
'callback' => 'views_ui_admin_edit_page',
'access' => user_access('administer views'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/views/import',
$items[] = array('path' => 'admin/views/import',
'title' => t('import'),
'callback' => 'views_ui_admin_import_page',
'access' => user_access('administer views'),
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/views/export',
$items[] = array('path' => 'admin/views/export',
'title' => t('export view'),
'callback' => 'views_ui_admin_export_page',
'access' => user_access('administer views'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/views/delete',
$items[] = array('path' => 'admin/views/delete',
'title' => t('edit view'),
'callback' => 'views_ui_admin_delete_page',
'access' => user_access('administer views'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/views/enable',
$items[] = array('path' => 'admin/views/enable',
'callback' => 'views_ui_admin_enable_page',
'access' => user_access('administer views'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/views/disable',
$items[] = array('path' => 'admin/views/disable',
'callback' => 'views_ui_admin_disable_page',
'access' => user_access('administer views'),
'type' => MENU_CALLBACK);
}
return $items;
}
......@@ -314,7 +314,7 @@ function views_ui_admin_import_page() {
'#rows' => 6,
'#description' => t('Cut and paste the results of an Export View here.'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t("Submit"),
......@@ -417,10 +417,10 @@ function views_ui_admin_delete_page($vid = '') {
$form['vid'] = array('#type' => 'value', '#value' => $view->vid);
return confirm_form('views_delete_confirm', $form,
t('Are you sure you want to delete %title?', array('%title' => $view->name)),
$_GET['destination'] ? $_GET['destination'] : 'admin/views',
t('Are you sure you want to delete %title?', array('%title' => $view->name)),
$_GET['destination'] ? $_GET['destination'] : 'admin/views',
t('This action cannot be undone.'),
t('Delete'), t('Cancel')
t('Delete'), t('Cancel')
);
}
......@@ -445,7 +445,7 @@ function _views_get_default_view($template = '') {
$view = $default_views[$template];
}
}
if (!$view) {
if (!$view) {
$view = new stdClass();
$view->use_pager = true;
$view->nodes_per_page = variable_get('default_nodes_main', 10);
......@@ -1468,9 +1468,9 @@ function theme_views_edit_view($form) {
// arguments
$collapsed = $allbut && $allbut != 'argument';
$group = views_ui_render_section($form['argument'], array('name', 'argdefault', 'title', 'options'), array(t('Argument Type'), t('Default'), t('Title'), t('Option')), 'arguments', $collapsed);
$group .= views_ui_render_section_add($form['argument']['add'], array('id', 'button'), 'Add Argument');
$group .= form_render($form['view_args_php_fieldset']);
$group .= '<p>'. t('Arguments are parsed directly from the URL. They are not necessary to any given view, but allow flexibility.') .'</p>';
......@@ -1480,7 +1480,7 @@ function theme_views_edit_view($form) {
// filter
$collapsed = $allbut && $allbut != 'filter';
$group = views_ui_render_section($form['filter'], array('name', 'operator', 'value', 'options', 'expose'), array(t('Field'), t('Operator'), t('Value'), t('Option'), ''), 'filters', $collapsed);
$group .= views_ui_render_section_add($form['filter']['add'], array('id', 'button'), 'Add Filter');
$group .= '<p>'. t('Filters allow you to select a subset of all the nodes to display. All Filters are ANDed together.') .'</p>';
......@@ -1491,8 +1491,8 @@ function theme_views_edit_view($form) {
// exposed exposed_filter
$collapsed = $allbut && $allbut != 'exposed_filter';
$group = views_ui_render_section($form['exposed_filter'], array('name', 'label', 'optional', 'is_default', 'single', 'operator'), array(t('Field'), t('Label'), t('Optional'), t('Filter settings Default'), t('Force Single'), t('Lock Operator')), 'exposed_filters', $collapsed);
// $group .= views_ui_render_section_add($form['exposed_filter']['add'], array('id', 'button'), 'Expose Filter');
$group .= '<p>'. t('Exposed filters will be presented to the viewer. If not set required, then filters will include a "&lt;None&gt;" Value if possible. If set default, filters will default as set here, otherwise filter settings will be ignored. If Lock Operator is set, no operator will be made available to the user.') .'</p>';
......@@ -1503,7 +1503,7 @@ function theme_views_edit_view($form) {
// sort
$collapsed = $allbut && $allbut != 'sort';
$group = views_ui_render_section($form['sort'], array('name', 'sortorder', 'options'), array(t('Field'), t('Order'), t('Option')), 'sort criteria', $collapsed);
$group .= views_ui_render_section_add($form['sort']['add'], array('id', 'button'), 'Add criteria');
$output .= theme('fieldset', array('#title' => t('Sort Criteria'), '#children' => $group,
'#collapsible' => true, '#collapsed' => $collapsed,));
......@@ -1521,14 +1521,14 @@ function views_ui_render_section(&$form, $items, $header, $section, &$collapsed)
$num_items = count($items);
$order = ($form['order']['#value'] != ''
? explode(',', $form['order']['#value'])
? explode(',', $form['order']['#value'])
: array());
$count = count($order) - 1;
foreach ($order as $key => $i) {
$row = array();
foreach ($items as $item) {
if (($key == 0 && ($item == 'up' || $item == 'top')) ||
if (($key == 0 && ($item == 'up' || $item == 'top')) ||
($key == $count && ($item == 'down' || $item == 'bottom'))) {
$form[$i][$item]['#printed'] = true;
$row[] = '&nbsp;'; // array('data' => '&nbsp;', 'width' => 16);
......@@ -1622,7 +1622,7 @@ function views_edit_view_validate($form_id, $view, $form) {
$info = $function();
if (is_array($view->$type)) {
foreach ($view->$type as $key => $data) {
if (!is_numeric($key)) {
if (!is_numeric($key)) {
continue; // some non-data data is in here.
}
$validator = $info[$data['id']]['validate'];
......@@ -1695,7 +1695,7 @@ function views_ui_plugin_validate_table($type, $view, $form) {
return views_ui_plugin_validate_list($type, $view, $form);
}
// ---------------------------------------------------------------------------
// View creator tool
// View creator tool
/*
* Get a true/false.
......
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