Commit 1ed6cc93 authored by merlinofchaos's avatar merlinofchaos

Sync from DRUPAL-5 branch

parent eca2dcd5
......@@ -86,7 +86,6 @@ Views 5.x-1.3-beta-1
just when the module is enabled.
Views 5.x-1.4-rc1
Bugs fixed:
o All the date-based arguments were broken due to changes in $query->add_orderby
o 103475: updated rss feed to match fixes in Drupal core.
......@@ -101,7 +100,7 @@ Views 5.x-1.4-rc1
o 89421: New last changed sort / filter / field
o 103649: allow customizing date interval granularity
Views --dev
Views 5.x-1.4-rc1
Bugs fixed:
o 109456: Match API documentation on 'field' definition on fields.
o 104459: Correct theme wizard field names.
......@@ -115,7 +114,12 @@ Views --dev
o 107218: 107217: Fixed some E_NOTICE errors.
o 106464: Taxonomy links showed up as Array | Array | Array rather than the taxonomy terms.
o 110212: Text patch to clarify date fields.
o 110299: Change nodes per block max size from 2 chars wide to 3, as it was meant to be.
o 110648: Block title not showing up in admin if view only provides block.
o 110462: set_distinct didn't properly check to see if the query was already distinct.
o Distinct filter could mess up summary queries by making them distinct on nid which isn't what is supposed to happen there.
New features:
o 107471: Spiffy new theme wizard features. Thanks Crell!!
o 105081: Save and edit button to save but not go change screens.
Views --dev
......@@ -141,7 +141,8 @@ function comment_views_tables() {
'value' => views_handler_filter_date_value_form(),
'handler' => 'views_handler_filter_timestamp',
'option' => 'string',
'help' => t('This filter allows nodes to be filtered by the timestamp for the last comment or node edit. The "Value" can either be a date in the format: CCYY-MM-DD HH:MM:SS or the word "NOW" to use the current time. You may enter a positive or negative number in the "Option" field that will represent the amount of seconds that will be added or substracted to the time; this is most useful when combined with "NOW". If you have the jscalendar module from jstools installed, you can use a popup date picker here.'),
'help' => t('This filter allows nodes to be filtered by the timestamp for the last comment or node edit.')
.' '. views_t_strings('filter date'),
),
'last_changed' => array(
'name' => t('Comment: Last Changed Time'),
......@@ -149,7 +150,8 @@ function comment_views_tables() {
'value' => views_handler_filter_date_value_form(),
'handler' => 'views_handler_filter_last_changed',
'option' => 'string',
'help' => t('This filter allows nodes to be filtered by the timestamp for the last comment or node edit. The "Value" can either be a date in the format: CCYY-MM-DD HH:MM:SS or the word "NOW" to use the current time. You may enter a positive or negative number in the "Option" field that will represent the amount of seconds that will be added or substracted to the time; this is most useful when combined with "NOW". If you have the jscalendar module from jstools installed, you can use a popup date picker here.'),
'help' => t('This filter allows nodes to be filtered by the timestamp for the last comment or node edit.')
.' '. views_t_strings('filter date'),
),
),
......
......@@ -211,7 +211,8 @@ function node_views_tables() {
'value' => views_handler_filter_date_value_form(),
'handler' => 'views_handler_filter_timestamp',
'option' => 'string',
'help' => t('This filter allows nodes to be filtered by their creation date. Enter dates in the format: CCYY-MM-DD HH:MM:SS. Enter \'now\' to use the current time. You may enter a delta (in seconds) to the option that will be added to the time; this is most useful when combined with now. If you have the jscalendar module from jstools installed, you can use a popup date picker here.'),
'help' => t('This filter allows nodes to be filtered by their creation date.')
.' '. views_t_strings('filter date'),
),
'changed' => array(
'name' => t('Node: Updated Time'),
......@@ -219,7 +220,8 @@ function node_views_tables() {
'value' => views_handler_filter_date_value_form(),
'handler' => 'views_handler_filter_timestamp',
'option' => 'string',
'help' => t('This filter allows nodes to be filtered by their creation date. Enter dates in the format: CCYY-MM-DD HH:MM:SS. Enter \'now\' to use the current time. You may enter a delta (in seconds) to the option that will be added to the time; this is most useful when combined with now. If you have the jscalendar module from jstools installed, you can use a popup date picker here.'),
'help' => t('This filter allows nodes to be filtered by the time they were updated.')
.' '. views_t_strings('filter date'),
),
'body' => array(
'name' => t('Node: Body'),
......@@ -718,8 +720,10 @@ function views_handler_filter_nodetype($op) {
* Set a query to be distinct as a filter handler
*/
function views_handler_filter_distinct($op, $filter, $filterinfo, &$query) {
$query->set_distinct();
$query->add_groupby('node.nid');
if (!$query->no_distinct) {
$query->set_distinct();
$query->add_groupby('node.nid');
}
}
/*
......
......@@ -170,7 +170,8 @@ function profile_views_add_filter(&$table, $field) {
);
break;
case 'date':
$help = t('This filter allows nodes to be filtered by their creation date. Enter dates in the format: CCYY-MM-DD HH:MM:SS. Enter \'now\' to use the current time. You may enter a delta (in seconds) to the option that will be added to the time; this is most useful when combined with now. If you have the jscalendar module from jstools installed, you can use a popup date picker here.');
$help = t('This filter allows nodes to be filtered by their creation date.')
.' '. views_t_strings('filter date');
$others = array(
'operator' => 'views_handler_operator_gtlt',
//'value' => views_handler_filter_date_value_form(),
......
......@@ -618,7 +618,7 @@ function views_get_url($view, $args) {
* Figure out what the title of a view should be.
*/
function views_get_title($view, $context = 'menu', $args = NULL) {
if ($context == 'menu' && $view->menu_title)
if (($context == 'menu' || $context == 'admin' )&& $view->menu_title)
return $view->menu_title;
if ($context == 'block-info') {
......@@ -640,11 +640,11 @@ function views_get_title($view, $context = 'menu', $args = NULL) {
}
}
if (!$title && ($context == 'menu' || $context == 'page')) {
if (!$title && ($context == 'menu' || $context == 'page' || $context == 'admin')) {
$title = $view->page_title;
}
if (!$title && $context == 'block') {
if (!$title && $context == 'block' || $context == 'admin') {
$title = $view->block_title;
}
......@@ -1858,3 +1858,16 @@ function theme_view($view_name, $limit = NULL, $use_pager = NULL, $type = 'embed
}
}
/**
* This function is used as a central place to manage some translatable text strings
* that are used in different places.
* @param $text
* which string to return.
*/
function views_t_strings($text) {
switch ($text) {
case 'filter date':
return t('The "Value" can either be a date in the format: CCYY-MM-DD HH:MM:SS or the word "now" to use the current time. You may enter a positive or negative number in the "Option" field that will represent the amount of seconds that will be added or substracted to the time; this is most useful when combined with "now". If you have the jscalendar module from jstools installed, you can use a popup date picker here.');
}
}
......@@ -249,7 +249,6 @@ function _views_view_build_fields(&$query, &$view) {
* this calls handlers.
*/
function _views_build_summary(&$query, $argtype, $option, $self_sort) {
$arginfo = _views_get_arguments();
if (!function_exists($arginfo[$argtype]['handler'])) {
return false;
......@@ -268,6 +267,7 @@ function _views_build_summary(&$query, $argtype, $option, $self_sort) {
if ($self_sort) {
$arginfo[$argtype]['handler']('sort', $query, $self_sort);
}
$query->no_distinct = TRUE; // prevent DISTINCT from mucking up summaries.
}
// ---------------------------------------------------------------------------
......@@ -332,7 +332,7 @@ class _views_query {
* Set the base field to be distinct.
*/
function set_distinct() {
if (count($this->fields) && substr($this->fields[0], 0, 7) != 'DISTINCT') {
if (count($this->fields) && substr($this->fields[0], 0, 8) != 'DISTINCT') {
$field = $this->fields[0];
$this->fields[0] = "DISTINCT($field)";
$this->count_field = "DISTINCT($field)";
......
......@@ -178,7 +178,7 @@ function views_ui_admin_page() {
}
$items[] = array(
$view->name,
views_get_title($view, 'menu'),
views_get_title($view, 'admin'),
$view->description,
implode(', ', $provides),
$url,
......@@ -937,8 +937,8 @@ function views_edit_view($view, $op = '') {
'#type' => 'textfield',
'#title' => t('Nodes per Block'),
'#default_value' => $view->nodes_per_block,
'#size' => 2,
'#maxlength' => 2,
'#size' => 3,
'#maxlength' => 3,
'#description' => t('If using a block, the maximum number of items to display in the block. Pagers are not used in blocks.'),
'#attributes' => NULL,
);
......@@ -1055,6 +1055,10 @@ function views_edit_view($view, $op = '') {
'#type' => 'submit',
'#value' => t('Save'),
);
$form['save_and_edit'] = array(
'#type' => 'submit',
'#value' => t('Save and edit'),
);
if ($view->vid) {
$form['delete'] = array(
'#type' => 'submit',
......@@ -1602,8 +1606,9 @@ function views_ui_render_section_add(&$form, $items, $label) {
* Validate that a view sent via form is OK.
*/
function views_edit_view_validate($form_id, $view, $form) {
$op = $_POST['op'];
if ($op != t('Save')) {
$op = $view['op'];
if ($op != t('Save') && $op != t('Save and edit')) {
return; // only validate on saving!
}
......@@ -1711,7 +1716,10 @@ function views_edit_view_submit($form_id, $form) {
drupal_set_message(t('View successfully added.'));
}
return 'admin/build/views';
if ($form['op'] == t('Save')) {
return 'admin/build/views';
}
}
/**
......
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