Merge remote-tracking branch 'core/8.x' into 8.x-file-config

8.0.x
Greg Dunlap 2012-02-12 11:24:16 -05:00
commit a8313cf422
78 changed files with 1590 additions and 304 deletions

View File

@ -2504,7 +2504,8 @@ function drupal_valid_test_ua() {
}
}
return FALSE;
$test_prefix = FALSE;
return $test_prefix;
}
/**
@ -2709,6 +2710,41 @@ function language_list($only_enabled = FALSE) {
return $only_enabled ? $languages['enabled'] : $languages['all'];
}
/**
* Loads a language object from the database.
*
* @param $langcode
* The language code.
*
* @return
* A fully-populated language object or FALSE.
*/
function language_load($langcode) {
$languages = language_list();
return isset($languages[$langcode]) ? $languages[$langcode] : FALSE;
}
/**
* Produced the printed name for a language for display.
*
* @param $langcode
* The language code.
*
* @return
* The printed name of the language.
*/
function language_name($langcode) {
if ($langcode == LANGUAGE_NONE) {
return t('None');
}
if ($language = language_load($langcode)) {
return $language->name;
}
return t('Unknown (@langcode)', array('@langcode' => $langcode));
}
/**
* Returns the default language used on the site.
*
@ -2716,16 +2752,13 @@ function language_list($only_enabled = FALSE) {
* A language object.
*/
function language_default() {
$default = variable_get(
'language_default',
(object) array(
'langcode' => 'en',
'name' => 'English',
'direction' => 0,
'enabled' => 1,
'weight' => 0,
)
);
$default = variable_get('language_default', (object) array(
'langcode' => 'en',
'name' => 'English',
'direction' => 0,
'enabled' => 1,
'weight' => 0,
));
$default->default = TRUE;
return $default;
}

View File

@ -5344,9 +5344,24 @@ function drupal_system_listing($mask, $directory, $key = 'name', $min_depth = 1)
// themes as provided by a distribution. It is pristine in the same way that
// the 'core/modules' directory is pristine for core; users should avoid
// any modification by using the sites/all or sites/<domain> directories.
$profiles = array();
$profile = drupal_get_profile();
if (file_exists("profiles/$profile/$directory")) {
$searchdir[] = "profiles/$profile/$directory";
// For SimpleTest to be able to test modules packaged together with a
// distribution we need to include the profile of the parent site (in which
// test runs are triggered).
if (drupal_valid_test_ua()) {
$testing_profile = variable_get('simpletest_parent_profile', FALSE);
if ($testing_profile && $testing_profile != $profile) {
$profiles[] = $testing_profile;
}
}
// In case both profile directories contain the same extension, the actual
// profile always has precedence.
$profiles[] = $profile;
foreach ($profiles as $profile) {
if (file_exists("profiles/$profile/$directory")) {
$searchdir[] = "profiles/$profile/$directory";
}
}
// Always search sites/all/* as well as the global directories.

View File

@ -213,11 +213,6 @@ function install_begin_request(&$install_state) {
// Add any installation parameters passed in via the URL.
$install_state['parameters'] += $_GET;
// @todo: remove this testbot compatibility layer once the testbot is fixed.
if (isset($_GET['locale'])) {
$install_state['parameters']['langcode'] = $_GET['locale'];
}
// Validate certain core settings that are used throughout the installation.
if (!empty($install_state['parameters']['profile'])) {
$install_state['parameters']['profile'] = preg_replace('/[^a-zA-Z_0-9]/', '', $install_state['parameters']['profile']);

View File

@ -9,33 +9,33 @@
* The language is determined using a URL language indicator:
* path prefix or domain according to the configuration.
*/
const LOCALE_LANGUAGE_NEGOTIATION_URL = 'locale-url';
const LANGUAGE_NEGOTIATION_URL = 'locale-url';
/**
* The language is set based on the browser language settings.
*/
const LOCALE_LANGUAGE_NEGOTIATION_BROWSER = 'locale-browser';
const LANGUAGE_NEGOTIATION_BROWSER = 'locale-browser';
/**
* The language is determined using the current interface language.
*/
const LOCALE_LANGUAGE_NEGOTIATION_INTERFACE = 'locale-interface';
const LANGUAGE_NEGOTIATION_INTERFACE = 'locale-interface';
/**
* If no URL language is available language is determined using an already
* detected one.
*/
const LOCALE_LANGUAGE_NEGOTIATION_URL_FALLBACK = 'locale-url-fallback';
const LANGUAGE_NEGOTIATION_URL_FALLBACK = 'locale-url-fallback';
/**
* The language is set based on the user language settings.
*/
const LOCALE_LANGUAGE_NEGOTIATION_USER = 'locale-user';
const LANGUAGE_NEGOTIATION_USER = 'locale-user';
/**
* The language is set based on the request/session parameters.
*/
const LOCALE_LANGUAGE_NEGOTIATION_SESSION = 'locale-session';
const LANGUAGE_NEGOTIATION_SESSION = 'locale-session';
/**
* Regular expression pattern used to localize JavaScript strings.
@ -88,13 +88,13 @@ const LOCALE_IMPORT_KEEP = 1;
* URL language negotiation: use the path prefix as URL language
* indicator.
*/
const LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX = 0;
const LANGUAGE_NEGOTIATION_URL_PREFIX = 0;
/**
* URL language negotiation: use the domain as URL language
* indicator.
*/
const LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN = 1;
const LANGUAGE_NEGOTIATION_URL_DOMAIN = 1;
/**
* @defgroup locale-languages-negotiation Language negotiation options
@ -264,12 +264,12 @@ function locale_language_from_session($languages) {
function locale_language_from_url($languages) {
$language_url = FALSE;
if (!language_negotiation_get_any(LOCALE_LANGUAGE_NEGOTIATION_URL)) {
if (!language_negotiation_get_any(LANGUAGE_NEGOTIATION_URL)) {
return $language_url;
}
switch (variable_get('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX)) {
case LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX:
switch (variable_get('locale_language_negotiation_url_part', LANGUAGE_NEGOTIATION_URL_PREFIX)) {
case LANGUAGE_NEGOTIATION_URL_PREFIX:
// $_GET['q'] might not be available at this time, because
// path initialization runs after the language bootstrap phase.
list($language, $_GET['q']) = language_url_split_prefix(isset($_GET['q']) ? $_GET['q'] : NULL, $languages);
@ -278,7 +278,7 @@ function locale_language_from_url($languages) {
}
break;
case LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN:
case LANGUAGE_NEGOTIATION_URL_DOMAIN:
$domains = locale_language_negotiation_url_domains();
foreach ($languages as $language) {
// Skip check if the language doesn't have a domain.
@ -333,7 +333,7 @@ function locale_language_from_url($languages) {
*/
function locale_language_url_fallback($language = NULL, $language_type = LANGUAGE_TYPE_INTERFACE) {
$default = language_default();
$prefix = (variable_get('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX) == LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX);
$prefix = (variable_get('locale_language_negotiation_url_part', LANGUAGE_NEGOTIATION_URL_PREFIX) == LANGUAGE_NEGOTIATION_URL_PREFIX);
// If the default language is not configured to convey language information,
// a missing URL language information indicates that URL language should be
@ -433,17 +433,27 @@ function locale_language_url_rewrite_url(&$path, &$options) {
}
if (isset($options['language'])) {
switch (variable_get('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX)) {
case LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN:
switch (variable_get('locale_language_negotiation_url_part', LANGUAGE_NEGOTIATION_URL_PREFIX)) {
case LANGUAGE_NEGOTIATION_URL_DOMAIN:
$domains = locale_language_negotiation_url_domains();
if (!empty($domains[$options['language']->langcode])) {
// Ask for an absolute URL with our modified base_url.
global $is_https;
$url_scheme = ($is_https) ? 'https://' : 'http://';
$options['absolute'] = TRUE;
$options['base_url'] = $domains[$options['language']->langcode];
$options['base_url'] = $url_scheme . $domains[$options['language']->langcode];
if (isset($options['https']) && variable_get('https', FALSE)) {
if ($options['https'] === TRUE) {
$options['base_url'] = str_replace('http://', 'https://', $options['base_url']);
}
elseif ($options['https'] === FALSE) {
$options['base_url'] = str_replace('https://', 'http://', $options['base_url']);
}
}
}
break;
case LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX:
case LANGUAGE_NEGOTIATION_URL_PREFIX:
$prefixes = locale_language_negotiation_url_prefixes();
if (!empty($prefixes[$options['language']->langcode])) {
$options['prefix'] = $prefixes[$options['language']->langcode] . '/';
@ -496,7 +506,7 @@ function locale_language_url_rewrite_session(&$path, &$options) {
$languages = language_list(TRUE);
$query_param = check_plain(variable_get('locale_language_negotiation_session_param', 'language'));
$query_value = isset($_GET[$query_param]) ? check_plain($_GET[$query_param]) : NULL;
$query_rewrite = isset($languages[$query_value]) && language_negotiation_get_any(LOCALE_LANGUAGE_NEGOTIATION_SESSION);
$query_rewrite = isset($languages[$query_value]) && language_negotiation_get_any(LANGUAGE_NEGOTIATION_SESSION);
}
else {
$query_rewrite = FALSE;

View File

@ -2123,7 +2123,7 @@ function menu_contextual_links($module, $parent_path, $args) {
$links = array();
// Performance: In case a previous invocation for the same parent path did not
// return any links, we immediately return here.
if (isset($path_empty[$parent_path])) {
if (isset($path_empty[$parent_path]) && strpos($parent_path, '%') !== FALSE) {
return $links;
}
// Construct the item-specific parent path.

View File

@ -178,6 +178,30 @@ function system_list($type) {
$lists['filepaths'][] = array('type' => $record->type, 'name' => $record->name, 'filepath' => $record->filename);
}
}
foreach ($lists['theme'] as $key => $theme) {
if (!empty($theme->info['base theme'])) {
// Make a list of the theme's base themes.
$lists['theme'][$key]->base_themes = drupal_find_base_themes($lists['theme'], $key);
// Don't proceed if there was a problem with the root base theme.
if (!current($lists['theme'][$key]->base_themes)) {
continue;
}
// Determine the root base theme.
$base_key = key($lists['theme'][$key]->base_themes);
// Add to the list of sub-themes for each of the theme's base themes.
foreach (array_keys($lists['theme'][$key]->base_themes) as $base_theme) {
$lists['theme'][$base_theme]->sub_themes[$key] = $lists['theme'][$key]->info['name'];
}
// Add the base theme's theme engine info.
$lists['theme'][$key]->info['engine'] = $lists['theme'][$base_key]->info['engine'];
}
else {
// A plain theme is its own base theme.
$base_key = $key;
}
// Set the theme engine prefix.
$lists['theme'][$key]->prefix = ($lists['theme'][$key]->info['engine'] == 'theme') ? $base_key : $lists['theme'][$key]->info['engine'];
}
cache('bootstrap')->set('system_list', $lists);
}
// To avoid a separate database lookup for the filepath, prime the

View File

@ -630,7 +630,13 @@ function theme_pager_link($variables) {
}
}
return l($text, $_GET['q'], array('attributes' => $attributes, 'query' => $query));
// @todo l() cannot be used here, since it adds an 'active' class based on the
// path only (which is always the current path for pager links). Apparently,
// none of the pager links is active at any time - but it should still be
// possible to use l() here.
// @see http://drupal.org/node/1410574
$attributes['href'] = url($_GET['q'], array('query' => $query));
return '<a' . drupal_attributes($attributes) . '>' . check_plain($text) . '</a>';
}
/**

View File

@ -431,21 +431,27 @@ function path_load($conditions) {
* - langcode: (optional) The language code of the alias.
*/
function path_save(&$path) {
$path += array('pid' => NULL, 'langcode' => LANGUAGE_NONE);
$path += array('langcode' => LANGUAGE_NONE);
// Insert or update the alias.
$status = drupal_write_record('url_alias', $path, (!empty($path['pid']) ? 'pid' : array()));
// Verify that a record was written.
if ($status) {
if ($status === SAVED_NEW) {
module_invoke_all('path_insert', $path);
}
else {
module_invoke_all('path_update', $path);
}
drupal_clear_path_cache($path['source']);
// Load the stored alias, if any.
if (!empty($path['pid']) && !isset($path['original'])) {
$path['original'] = path_load($path['pid']);
}
if (empty($path['pid'])) {
drupal_write_record('url_alias', $path);
module_invoke_all('path_insert', $path);
}
else {
drupal_write_record('url_alias', $path, array('pid'));
module_invoke_all('path_update', $path);
}
// Clear internal properties.
unset($path['original']);
// Clear the static alias cache.
drupal_clear_path_cache($path['source']);
}
/**

View File

@ -723,7 +723,7 @@ function _theme_build_registry($theme, $base_theme, $theme_engine) {
* names of the themes and the values are objects having the following
* properties:
* - 'filename': The name of the .info file.
* - 'name': The name of the theme.
* - 'name': The machine name of the theme.
* - 'status': 1 for enabled, 0 for disabled themes.
* - 'info': The contents of the .info file.
* - 'stylesheets': A two dimensional array, using the first key for the
@ -733,7 +733,10 @@ function _theme_build_registry($theme, $base_theme, $theme_engine) {
* - 'scripts': An associative array of JavaScripts, using the filename as key
* and the complete filepath as value.
* - 'engine': The name of the theme engine.
* - 'base theme': The name of the base theme.
* - 'base_theme': The name of the base theme.
* - 'base_themes': An ordered array of all the base themes. If the first item
* is NULL, a base theme is missing for this theme.
* - 'sub_themes': An unordered array of sub-themes of this theme.
*/
function list_themes($refresh = FALSE) {
$list = &drupal_static(__FUNCTION__, array());
@ -789,6 +792,47 @@ function list_themes($refresh = FALSE) {
return $list;
}
/**
* Find all the base themes for the specified theme.
*
* Themes can inherit templates and function implementations from earlier themes.
*
* @param $themes
* An array of available themes.
* @param $key
* The name of the theme whose base we are looking for.
* @param $used_keys
* A recursion parameter preventing endless loops.
* @return
* Returns an array of all of the theme's ancestors; the first element's value
* will be NULL if an error occurred.
*/
function drupal_find_base_themes($themes, $key, $used_keys = array()) {
$base_key = $themes[$key]->info['base theme'];
// Does the base theme exist?
if (!isset($themes[$base_key])) {
return array($base_key => NULL);
}
$current_base_theme = array($base_key => $themes[$base_key]->info['name']);
// Is the base theme itself a child of another theme?
if (isset($themes[$base_key]->info['base theme'])) {
// Do we already know the base themes of this theme?
if (isset($themes[$base_key]->base_themes)) {
return $themes[$base_key]->base_themes + $current_base_theme;
}
// Prevent loops.
if (!empty($used_keys[$base_key])) {
return array($base_key => NULL);
}
$used_keys[$base_key] = TRUE;
return drupal_find_base_themes($themes, $base_key, $used_keys) + $current_base_theme;
}
// If we get here, then this is our parent theme.
return $current_base_theme;
}
/**
* Generates themed output.
*

View File

@ -101,6 +101,12 @@ function update_prepare_d8_bootstrap() {
),
);
if ($has_required_schema) {
// Bootstrap variables so we can update theme while preparing the update
// process.
drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES);
// Update the dynamic include paths that might be used before running the
// proper update functions.
update_prepare_stored_includes();
// Update the environment for the language bootstrap if needed.
update_prepare_d8_language();
@ -113,7 +119,7 @@ function update_prepare_d8_bootstrap() {
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'default' => '',
);
$langcode_indexes = array('indexes' =>
array(
@ -127,6 +133,22 @@ function update_prepare_d8_bootstrap() {
}
}
/**
* Fix stored include paths to match the "/core" migration.
*/
function update_prepare_stored_includes() {
// Update language negotiation settings.
foreach (language_types() as $language_type) {
$negotiation = variable_get("language_negotiation_$language_type", array());
foreach ($negotiation as $id => &$provider) {
if (isset($negotiation[$id]['file']) && $negotiation[$id]['file'] == 'includes/locale.inc') {
$negotiation[$id]['file'] = 'core/includes/locale.inc';
}
}
variable_set("language_negotiation_$language_type", $negotiation);
}
}
/**
* Prepare Drupal 8 language changes for the bootstrap if needed.
*/
@ -161,17 +183,6 @@ function update_prepare_d8_language() {
db_drop_field('languages', 'domain');
db_drop_field('languages', 'native');
// Rename language column to langcode and set it again as the primary key.
db_drop_primary_key('languages');
$langcode_spec = array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'description' => "Language code, e.g. 'de' or 'en-US'.",
);
db_change_field('languages', 'language', 'langcode', $langcode_spec, array('primary key' => array('langcode')));
// Rename the languages table to language.
db_rename_table('languages', 'language');
@ -181,6 +192,10 @@ function update_prepare_d8_language() {
$modules = array('language');
update_module_add_to_system($modules);
update_module_enable($modules);
// Rename 'language' column to 'langcode'.
require_once DRUPAL_ROOT . '/core/modules/language/language.install';
language_update_8000();
}
}

View File

@ -330,7 +330,7 @@ class Updater {
}
catch (FileTransferException $e) {
$message = t($e->getMessage(), $e->arguments);
$throw_message = t('Unable to create %directory due to the following: %reason', array('%directory' => $install_location, '%reason' => $message));
$throw_message = t('Unable to create %directory due to the following: %reason', array('%directory' => $directory, '%reason' => $message));
throw new UpdaterException($throw_message);
}
}

View File

@ -494,7 +494,7 @@ $(document).bind('state:disabled', function(e) {
$(e.target)
.attr('disabled', e.value)
.filter('.form-element')
.closest('.form-item, .form-submit, .form-wrapper')[e.value ? 'addClass' : 'removeClass']('form-disabled');
.closest('.form-item, .form-submit, .form-wrapper').toggleClass('form-disabled', e.value);
// Note: WebKit nightlies don't reflect that change correctly.
// See https://bugs.webkit.org/show_bug.cgi?id=23789
@ -514,7 +514,7 @@ $(document).bind('state:required', function(e) {
$(document).bind('state:visible', function(e) {
if (e.trigger) {
$(e.target).closest('.form-item, .form-submit, .form-wrapper')[e.value ? 'show' : 'hide']();
$(e.target).closest('.form-item, .form-submit, .form-wrapper').toggle(e.value);
}
});

View File

@ -397,12 +397,12 @@ Drupal.tableDrag.prototype.makeDraggable = function (item) {
if ($(item).is('.tabledrag-root')) {
// Swap with the next group (necessarily a top-level one).
var groupHeight = 0;
nextGroup = new self.row(nextRow, 'keyboard', self.indentEnabled, self.maxDepth, false);
var nextGroup = new self.row(nextRow, 'keyboard', self.indentEnabled, self.maxDepth, false);
if (nextGroup) {
$(nextGroup.group).each(function () {
groupHeight += $(this).is(':hidden') ? 0 : this.offsetHeight;
});
nextGroupRow = $(nextGroup.group).filter(':last').get(0);
var nextGroupRow = $(nextGroup.group).filter(':last').get(0);
self.rowObject.swap('after', nextGroupRow);
// No need to check for indentation, 0 is the only valid one.
window.scrollBy(0, parseInt(groupHeight, 10));

View File

@ -2,7 +2,8 @@
Drupal.behaviors.tableSelect = {
attach: function (context, settings) {
$('table:has(th.select-all)', context).once('table-select', Drupal.tableSelect);
// Select the inner-most table in case of nested tables.
$('th.select-all', context).closest('table').once('table-select', Drupal.tableSelect);
}
};
@ -69,7 +70,7 @@ Drupal.tableSelectRange = function (from, to, state) {
}
// Either add or remove the selected class based on the state of the target checkbox.
$(i)[ state ? 'addClass' : 'removeClass' ]('selected');
$(i).toggleClass('selected', state);
$('input:checkbox', i).each(function () {
this.checked = state;
});

View File

@ -25,15 +25,6 @@
* @ingroup themeable
*/
?>
<?php
// Add table javascript.
drupal_add_js('core/misc/tableheader.js');
drupal_add_js(drupal_get_path('module', 'block') . '/block.js');
foreach ($block_regions as $region => $title) {
drupal_add_tabledrag('blocks', 'match', 'sibling', 'block-region-select', 'block-region-' . $region, NULL, FALSE);
drupal_add_tabledrag('blocks', 'order', 'sibling', 'block-weight', 'block-weight-' . $region);
}
?>
<table id="blocks" class="sticky-enabled">
<thead>
<tr>

View File

@ -20,7 +20,6 @@ a.block-demo-backlink:link,
a.block-demo-backlink:visited {
background-color: #B4D7F0;
-moz-border-radius: 0 0 10px 10px;
-webkit-border-radius: 0 0 10px 10px;
border-radius: 0 0 10px 10px;
color: #000;
font-family: "Lucida Grande", Verdana, sans-serif;

View File

@ -84,13 +84,22 @@ function block_admin_display_prepare_blocks($theme) {
* @see block_admin_display_form_submit()
*/
function block_admin_display_form($form, &$form_state, $blocks, $theme, $block_regions = NULL) {
$form['#attached']['css'] = array(drupal_get_path('module', 'block') . '/block.admin.css');
$path = drupal_get_path('module', 'block');
$form['#attached']['css'][] = $path . '/block.admin.css';
$form['#attached']['js'][] = 'core/misc/tableheader.js';
$form['#attached']['js'][] = $path . '/block.js';
// Get a list of block regions if one was not provided.
if (!isset($block_regions)) {
$block_regions = system_region_list($theme, REGIONS_VISIBLE);
}
// Add a last region for disabled blocks.
$block_regions_with_disabled = $block_regions + array(BLOCK_REGION_NONE => BLOCK_REGION_NONE);
foreach ($block_regions_with_disabled as $region => $title) {
$form['#attached']['drupal_add_tabledrag'][] = array('blocks', 'match', 'sibling', 'block-region-select', 'block-region-' . $region, NULL, FALSE);
$form['#attached']['drupal_add_tabledrag'][] = array('blocks', 'order', 'sibling', 'block-weight', 'block-weight-' . $region);
}
// Weights range from -delta to +delta, so delta should be at least half
// of the amount of blocks present. This makes sure all blocks in the same
@ -104,8 +113,7 @@ function block_admin_display_form($form, &$form_state, $blocks, $theme, $block_r
);
$form['block_regions'] = array(
'#type' => 'value',
// Add a last region for disabled blocks.
'#value' => $block_regions + array(BLOCK_REGION_NONE => BLOCK_REGION_NONE),
'#value' => $block_regions_with_disabled,
);
$form['blocks'] = array();
$form['#tree'] = TRUE;

View File

@ -1,10 +1,10 @@
(function ($) {
Drupal.behaviors.bookFieldsetSummaries = {
attach: function (context) {
$('fieldset.book-form', context).drupalSetSummary(function (context) {
var val = $('.form-item-book-bid select').val();
$('fieldset.book-outline-form', context).drupalSetSummary(function (context) {
var $select = $('.form-item-book-bid select');
var val = $select.val();
if (val === '0') {
return Drupal.t('Not in book');
@ -13,7 +13,7 @@ Drupal.behaviors.bookFieldsetSummaries = {
return Drupal.t('New book');
}
else {
return Drupal.checkPlain($('.form-item-book-bid select :selected').text());
return Drupal.checkPlain($select.find(':selected').text());
}
});
}

View File

@ -9,8 +9,6 @@ div.contextual-links-wrapper {
}
div.contextual-links-wrapper ul.contextual-links {
-moz-border-radius: 0 4px 4px 4px;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 4px;
border-radius: 0 4px 4px 4px;
left: 0;
right: auto;

View File

@ -40,7 +40,6 @@ a.contextual-links-trigger {
width: 28px;
overflow: hidden;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
a.contextual-links-trigger:hover,
@ -54,8 +53,6 @@ div.contextual-links-active a.contextual-links-trigger {
position: relative;
z-index: 1;
-moz-border-radius: 4px 4px 0 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
border-radius: 4px 4px 0 0;
}
div.contextual-links-wrapper ul.contextual-links {
@ -70,10 +67,6 @@ div.contextual-links-wrapper ul.contextual-links {
top: 18px;
white-space: nowrap;
-moz-border-radius: 4px 0 4px 4px; /* LTR */
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
-webkit-border-top-right-radius: 0; /* LTR */
-webkit-border-top-left-radius: 4px; /* LTR */
border-radius: 4px 0 4px 4px; /* LTR */
}
.contextual-links-region:hover a.contextual-links-trigger,

View File

@ -3,3 +3,4 @@ description = Provides contextual links to perform actions related to elements o
package = Core
version = VERSION
core = 8.x
files[] = contextual.test

View File

@ -0,0 +1,47 @@
<?php
/**
* @file
* Tests for contextual.module.
*/
/**
* Tests accessible links after inaccessible links on dynamic context.
*/
class ContextualDynamicContextTestCase extends DrupalWebTestCase {
protected $profile = 'testing';
public static function getInfo() {
return array(
'name' => 'Contextual links on node lists',
'description' => 'Tests if contextual links are showing on the front page depending on permissions.',
'group' => 'Contextual',
);
}
function setUp() {
parent::setUp(array('contextual', 'node'));
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
$this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
$web_user = $this->drupalCreateUser(array('access content', 'access contextual links', 'edit any article content'));
$this->drupalLogin($web_user);
}
/**
* Tests contextual links on node lists with different permissions.
*/
function testNodeLinks() {
// Promote nodes to the front page. One article node the user can edit, one
// page node he can not edit and another article node he can edit.
$node1 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));
$node2 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1));
$node3 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));
// Now, on the front page, all article nodes should have contextual edit
// links. The page node in between should not.
$this->drupalGet('node');
$this->assertRaw('node/' . $node1->nid . '/edit', 'Edit link for oldest article node showing.');
$this->assertNoRaw('node/' . $node2->nid . '/edit', 'No edit link for page nodes.');
$this->assertRaw('node/' . $node3->nid . '/edit', 'Edit link for most recent article node showing.');
}
}

View File

@ -34,7 +34,6 @@
#dashboard .block-placeholder {
background: #E2E1DC;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
float: left; /* LTR */
margin: 3px 3px 3px 0; /* LTR */

View File

@ -377,12 +377,12 @@ function number_field_widget_validate($element, &$form_state) {
switch ($type) {
case 'float':
case 'decimal':
$regexp = '@[^-0-9\\' . $field['settings']['decimal_separator'] . ']@';
$regexp = '@([^-0-9\\' . $field['settings']['decimal_separator'] . '])|(.-)@';
$message = t('Only numbers and the decimal separator (@separator) allowed in %field.', array('%field' => $instance['label'], '@separator' => $field['settings']['decimal_separator']));
break;
case 'integer':
$regexp = '@[^-0-9]@';
$regexp = '@([^-0-9])|(.-)@';
$message = t('Only numbers are allowed in %field.', array('%field' => $instance['label']));
break;
}

View File

@ -92,6 +92,28 @@ class NumberFieldTestCase extends DrupalWebTestCase {
t('Correctly failed to save decimal value with more than one decimal point.')
);
}
// Try to create entries with minus sign not in the first position.
$wrong_entries = array(
'3-3',
'4-',
'1.3-',
'1.2-4',
'-10-10',
);
foreach ($wrong_entries as $wrong_entry) {
$this->drupalGet('test-entity/add/test-bundle');
$edit = array(
"{$this->field['field_name']}[$langcode][0][value]" => $wrong_entry,
);
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertText(
t('Only numbers and the decimal separator (@separator) allowed in ',
array('@separator' => $this->field['settings']['decimal_separator'])),
'Correctly failed to save decimal value with minus sign in the wrong position.'
);
}
}
/**

View File

@ -310,7 +310,7 @@ function image_file_download($uri) {
*/
function image_file_move($file, $source) {
// Delete any image derivatives at the original image path.
image_path_flush($file->uri);
image_path_flush($source->uri);
}
/**

View File

@ -73,3 +73,31 @@ function language_schema() {
);
return $schema;
}
/**
* Rename {language}.language to {language}.langcode.
*
* @see update_prepare_d8_language()
*/
function language_update_8000() {
// Rename language column to langcode and set it again as the primary key.
if (db_field_exists('language', 'language')) {
db_drop_primary_key('language');
$langcode_spec = array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'description' => "Language code, e.g. 'de' or 'en-US'.",
);
db_change_field('language', 'language', 'langcode', $langcode_spec, array('primary key' => array('langcode')));
}
// Update the 'language_default' system variable, if configured.
$language_default = variable_get('language_default');
if (!empty($language_default) && isset($language_default->language)) {
$language_default->langcode = $language_default->language;
unset($language_default->language);
variable_set('language_default', $language_default);
}
}

View File

@ -100,20 +100,6 @@ function language_theme() {
);
}
/**
* Loads a language object from the database.
*
* @param $langcode
* The language code.
*
* @return
* A fully-populated language object or FALSE.
*/
function language_load($langcode) {
$languages = language_list();
return isset($languages[$langcode]) ? $languages[$langcode] : FALSE;
}
/**
* API function to add or update a language.
*

View File

@ -223,10 +223,10 @@ function locale_language_providers_url_form($form, &$form_state) {
'#title' => t('Part of the URL that determines language'),
'#type' => 'radios',
'#options' => array(
LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX => t('Path prefix'),
LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN => t('Domain'),
LANGUAGE_NEGOTIATION_URL_PREFIX => t('Path prefix'),
LANGUAGE_NEGOTIATION_URL_DOMAIN => t('Domain'),
),
'#default_value' => variable_get('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX),
'#default_value' => variable_get('locale_language_negotiation_url_part', LANGUAGE_NEGOTIATION_URL_PREFIX),
);
$form['prefix'] = array(
@ -237,7 +237,7 @@ function locale_language_providers_url_form($form, &$form_state) {
'#states' => array(
'visible' => array(
':input[name="locale_language_negotiation_url_part"]' => array(
'value' => (string) LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX,
'value' => (string) LANGUAGE_NEGOTIATION_URL_PREFIX,
),
),
),
@ -250,7 +250,7 @@ function locale_language_providers_url_form($form, &$form_state) {
'#states' => array(
'visible' => array(
':input[name="locale_language_negotiation_url_part"]' => array(
'value' => (string) LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN,
'value' => (string) LANGUAGE_NEGOTIATION_URL_DOMAIN,
),
),
),
@ -303,7 +303,7 @@ function locale_language_providers_url_form_validate($form, &$form_state) {
$value = $form_state['values']['prefix'][$langcode];
if ($value === '') {
if (!$language->default && $form_state['values']['locale_language_negotiation_url_part'] == LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX) {
if (!$language->default && $form_state['values']['locale_language_negotiation_url_part'] == LANGUAGE_NEGOTIATION_URL_PREFIX) {
// Validation error if the prefix is blank for a non-default language, and value is for selected negotiation type.
form_error($form['prefix'][$langcode], t('The prefix may only be left blank for the default language.'));
}
@ -320,7 +320,7 @@ function locale_language_providers_url_form_validate($form, &$form_state) {
$value = $form_state['values']['domain'][$langcode];
if ($value === '') {
if (!$language->default && $form_state['values']['locale_language_negotiation_url_part'] == LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN) {
if (!$language->default && $form_state['values']['locale_language_negotiation_url_part'] == LANGUAGE_NEGOTIATION_URL_DOMAIN) {
// Validation error if the domain is blank for a non-default language, and value is for selected negotiation type.
form_error($form['domain'][$langcode], t('The domain may only be left blank for the default language.'));
}

View File

@ -17,14 +17,14 @@ function locale_install() {
// We cannot rely on language negotiation hooks here, because locale module is
// not enabled yet. Therefore language_negotiation_set() cannot be used.
$info = locale_language_negotiation_info();
$provider = $info[LOCALE_LANGUAGE_NEGOTIATION_URL];
$provider = $info[LANGUAGE_NEGOTIATION_URL];
$provider_fields = array('callbacks', 'file', 'cache');
$negotiation = array();
// Store only the needed data.
foreach ($provider_fields as $field) {
if (isset($provider[$field])) {
$negotiation[LOCALE_LANGUAGE_NEGOTIATION_URL][$field] = $provider[$field];
$negotiation[LANGUAGE_NEGOTIATION_URL][$field] = $provider[$field];
}
}

View File

@ -297,7 +297,6 @@ function locale_form_alter(&$form, &$form_state, $form_id) {
function locale_form_node_form_alter(&$form, &$form_state) {
if (isset($form['#node']->type) && locale_multilingual_node_type($form['#node']->type)) {
$languages = language_list(TRUE);
$language_options = array(LANGUAGE_NONE => t('Language neutral'));
foreach ($languages as $langcode => $language) {
$language_options[$langcode] = $language->name;
}
@ -306,6 +305,8 @@ function locale_form_node_form_alter(&$form, &$form_state) {
'#title' => t('Language'),
'#default_value' => (isset($form['#node']->language) ? $form['#node']->language : ''),
'#options' => $language_options,
'#empty_value' => LANGUAGE_NONE,
'#empty_option' => t('- None -'),
);
}
// Node type without language selector: assign the default for new nodes
@ -449,10 +450,10 @@ function locale_language_types_info() {
LANGUAGE_TYPE_CONTENT => array(
'name' => t('Content'),
'description' => t('Order of language detection methods for content. If a version of content is available in the detected language, it will be displayed.'),
'fixed' => array(LOCALE_LANGUAGE_NEGOTIATION_INTERFACE),
'fixed' => array(LANGUAGE_NEGOTIATION_INTERFACE),
),
LANGUAGE_TYPE_URL => array(
'fixed' => array(LOCALE_LANGUAGE_NEGOTIATION_URL, LOCALE_LANGUAGE_NEGOTIATION_URL_FALLBACK),
'fixed' => array(LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_URL_FALLBACK),
),
);
}
@ -465,7 +466,7 @@ function locale_language_negotiation_info() {
$file = '/core/includes/locale.inc';
$providers = array();
$providers[LOCALE_LANGUAGE_NEGOTIATION_URL] = array(
$providers[LANGUAGE_NEGOTIATION_URL] = array(
'types' => array(LANGUAGE_TYPE_CONTENT, LANGUAGE_TYPE_INTERFACE, LANGUAGE_TYPE_URL),
'callbacks' => array(
'language' => 'locale_language_from_url',
@ -479,7 +480,7 @@ function locale_language_negotiation_info() {
'config' => 'admin/config/regional/language/configure/url',
);
$providers[LOCALE_LANGUAGE_NEGOTIATION_SESSION] = array(
$providers[LANGUAGE_NEGOTIATION_SESSION] = array(
'callbacks' => array(
'language' => 'locale_language_from_session',
'switcher' => 'locale_language_switcher_session',
@ -492,7 +493,7 @@ function locale_language_negotiation_info() {
'config' => 'admin/config/regional/language/configure/session',
);
$providers[LOCALE_LANGUAGE_NEGOTIATION_USER] = array(
$providers[LANGUAGE_NEGOTIATION_USER] = array(
'callbacks' => array('language' => 'locale_language_from_user'),
'file' => $file,
'weight' => -4,
@ -500,7 +501,7 @@ function locale_language_negotiation_info() {
'description' => t("Follow the user's language preference."),
);
$providers[LOCALE_LANGUAGE_NEGOTIATION_BROWSER] = array(
$providers[LANGUAGE_NEGOTIATION_BROWSER] = array(
'callbacks' => array('language' => 'locale_language_from_browser'),
'file' => $file,
'weight' => -2,
@ -509,7 +510,7 @@ function locale_language_negotiation_info() {
'description' => t("Determine the language from the browser's language settings."),
);
$providers[LOCALE_LANGUAGE_NEGOTIATION_INTERFACE] = array(
$providers[LANGUAGE_NEGOTIATION_INTERFACE] = array(
'types' => array(LANGUAGE_TYPE_CONTENT),
'callbacks' => array('language' => 'locale_language_from_interface'),
'file' => $file,
@ -518,7 +519,7 @@ function locale_language_negotiation_info() {
'description' => t('Use the detected interface language.'),
);
$providers[LOCALE_LANGUAGE_NEGOTIATION_URL_FALLBACK] = array(
$providers[LANGUAGE_NEGOTIATION_URL_FALLBACK] = array(
'types' => array(LANGUAGE_TYPE_URL),
'callbacks' => array('language' => 'locale_language_url_fallback'),
'file' => $file,
@ -768,15 +769,6 @@ function locale_get_plural($count, $langcode = NULL) {
}
/**
* Returns a language name.
*/
function locale_language_name($langcode) {
// Consider enabled languages only.
$languages = language_list(TRUE);
return ($langcode && isset($languages[$langcode])) ? $languages[$langcode]->name : t('All');
}
/**
* Implements hook_modules_installed().
*/

View File

@ -1134,7 +1134,7 @@ class LocaleUninstallFunctionalTest extends DrupalWebTestCase {
variable_set('language_negotiation_' . LANGUAGE_TYPE_URL, locale_language_negotiation_info());
// Change language providers settings.
variable_set('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX);
variable_set('locale_language_negotiation_url_part', LANGUAGE_NEGOTIATION_URL_PREFIX);
variable_set('locale_language_negotiation_session_param', TRUE);
// Uninstall Locale.
@ -2059,7 +2059,7 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
$tests = array(
// Default, browser preference should have no influence.
array(
'language_negotiation' => array(LOCALE_LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_DEFAULT),
'language_negotiation' => array(LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_DEFAULT),
'path' => 'admin/config',
'expect' => $default_string,
'expected_provider' => LANGUAGE_NEGOTIATION_DEFAULT,
@ -2068,34 +2068,34 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
),
// Language prefix.
array(
'language_negotiation' => array(LOCALE_LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_DEFAULT),
'language_negotiation' => array(LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_DEFAULT),
'path' => "$langcode/admin/config",
'expect' => $language_string,
'expected_provider' => LOCALE_LANGUAGE_NEGOTIATION_URL,
'expected_provider' => LANGUAGE_NEGOTIATION_URL,
'http_header' => $http_header_browser_fallback,
'message' => 'URL (PATH) > DEFAULT: with language prefix, UI language is switched based on path prefix',
),
// Default, go by browser preference.
array(
'language_negotiation' => array(LOCALE_LANGUAGE_NEGOTIATION_URL, LOCALE_LANGUAGE_NEGOTIATION_BROWSER),
'language_negotiation' => array(LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_BROWSER),
'path' => 'admin/config',
'expect' => $language_browser_fallback_string,
'expected_provider' => LOCALE_LANGUAGE_NEGOTIATION_BROWSER,
'expected_provider' => LANGUAGE_NEGOTIATION_BROWSER,
'http_header' => $http_header_browser_fallback,
'message' => 'URL (PATH) > BROWSER: no language prefix, UI language is determined by browser language preference',
),
// Prefix, switch to the language.
array(
'language_negotiation' => array(LOCALE_LANGUAGE_NEGOTIATION_URL, LOCALE_LANGUAGE_NEGOTIATION_BROWSER),
'language_negotiation' => array(LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_BROWSER),
'path' => "$langcode/admin/config",
'expect' => $language_string,
'expected_provider' => LOCALE_LANGUAGE_NEGOTIATION_URL,
'expected_provider' => LANGUAGE_NEGOTIATION_URL,
'http_header' => $http_header_browser_fallback,
'message' => 'URL (PATH) > BROWSER: with langage prefix, UI language is based on path prefix',
),
// Default, browser language preference is not one of site's lang.
array(
'language_negotiation' => array(LOCALE_LANGUAGE_NEGOTIATION_URL, LOCALE_LANGUAGE_NEGOTIATION_BROWSER, LANGUAGE_NEGOTIATION_DEFAULT),
'language_negotiation' => array(LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_BROWSER, LANGUAGE_NEGOTIATION_DEFAULT),
'path' => 'admin/config',
'expect' => $default_string,
'expected_provider' => LANGUAGE_NEGOTIATION_DEFAULT,
@ -2122,8 +2122,8 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
$tests = array(
// Default domain, browser preference should have no influence.
array(
'language_negotiation' => array(LOCALE_LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_DEFAULT),
'locale_language_negotiation_url_part' => LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN,
'language_negotiation' => array(LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_DEFAULT),
'locale_language_negotiation_url_part' => LANGUAGE_NEGOTIATION_URL_DOMAIN,
'path' => 'admin/config',
'expect' => $default_string,
'expected_provider' => LANGUAGE_NEGOTIATION_DEFAULT,
@ -2133,12 +2133,12 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
// Language domain specific URL, we set the $_SERVER['HTTP_HOST'] in
// locale_test.module hook_boot() to simulate this.
array(
'language_negotiation' => array(LOCALE_LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_DEFAULT),
'locale_language_negotiation_url_part' => LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN,
'language_negotiation' => array(LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_DEFAULT),
'locale_language_negotiation_url_part' => LANGUAGE_NEGOTIATION_URL_DOMAIN,
'locale_test_domain' => $language_domain,
'path' => 'admin/config',
'expect' => $language_string,
'expected_provider' => LOCALE_LANGUAGE_NEGOTIATION_URL,
'expected_provider' => LANGUAGE_NEGOTIATION_URL,
'http_header' => $http_header_browser_fallback,
'message' => 'URL (DOMAIN) > DEFAULT: domain example.cn should switch to Chinese',
),
@ -2212,6 +2212,60 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
$fields = $this->xpath('//div[@id="site-name"]//a[@rel="home" and @href=:url]//span', $args);
$this->assertTrue($fields[0] == 'Drupal', t('URLs are rewritten using the browser language.'));
}
/**
* Test if the url function returns the right url when using different domains for different languages.
*/
function testLanguageDomain() {
// Add the Italian language.
$langcode = 'it';
$language = (object) array(
'langcode' => $langcode,
);
language_save($language);
$languages = language_list();
// Enable browser and URL language detection.
$edit = array(
'language[enabled][locale-url]' => TRUE,
'language[weight][locale-url]' => -10,
);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
// Change the domain for the Italian language.
$edit = array(
'locale_language_negotiation_url_part' => 1,
'domain[it]' => 'it.example.com',
);
$this->drupalPost('admin/config/regional/language/configure/url', $edit, t('Save configuration'));
// Build the link we're going to test based on the clean url setting.
$link = (!empty($GLOBALS['conf']['clean_url'])) ? 'it.example.com/admin' : 'it.example.com/?q=admin';
global $is_https;
// Test URL in another language: http://it.example.com/?q=admin.
// Base path gives problems on the testbot, so $correct_link is hard-coded.
// @see UrlAlterFunctionalTest::assertUrlOutboundAlter (path.test).
$italian_url = url('admin', array('language' => $languages['it']));
$url_scheme = ($is_https) ? 'https://' : 'http://';
$correct_link = $url_scheme . $link;
$this->assertTrue($italian_url == $correct_link, t('The url() function returns the right url (@url) in accordance with the chosen language', array('@url' => $italian_url)));
// Test https via options.
variable_set('https', TRUE);
$italian_url = url('admin', array('https' => TRUE, 'language' => $languages['it']));
$correct_link = 'https://' . $link;
$this->assertTrue($italian_url == $correct_link, t('The url() function returns the right https url (via options) (@url) in accordance with the chosen language', array('@url' => $italian_url)));
variable_set('https', FALSE);
// Test https via current url scheme.
$temp_https = $is_https;
$is_https = TRUE;
$italian_url = url('admin', array('language' => $languages['it']));
$correct_link = 'https://' . $link;
$this->assertTrue($italian_url == $correct_link, t('The url() function returns the right url (via current url scheme) (@url) in accordance with the chosen language', array('@url' => $italian_url)));
$is_https = $temp_https;
}
}
/**
@ -2381,7 +2435,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
$this->assertTrue($assert, t('Field language correctly changed.'));
// Enable content language URL detection.
language_negotiation_set(LANGUAGE_TYPE_CONTENT, array(LOCALE_LANGUAGE_NEGOTIATION_URL => 0));
language_negotiation_set(LANGUAGE_TYPE_CONTENT, array(LANGUAGE_NEGOTIATION_URL => 0));
// Test multilingual field language fallback logic.
$this->drupalGet("it/node/$node->nid");
@ -2628,7 +2682,7 @@ class LocaleLanguageNegotiationInfoFunctionalTest extends DrupalWebTestCase {
// Enable some core and custom language providers. The test language type is
// supposed to be configurable.
$test_type = 'test_language_type';
$provider = LOCALE_LANGUAGE_NEGOTIATION_INTERFACE;
$provider = LANGUAGE_NEGOTIATION_INTERFACE;
$test_provider = 'test_language_provider';
$form_field = $type . '[enabled]['. $provider .']';
$edit = array(

View File

@ -85,7 +85,7 @@ function locale_test_language_negotiation_info() {
*/
function locale_test_language_negotiation_info_alter(array &$language_providers) {
if (variable_get('locale_test_language_negotiation_info_alter', FALSE)) {
unset($language_providers[LOCALE_LANGUAGE_NEGOTIATION_INTERFACE]);
unset($language_providers[LANGUAGE_NEGOTIATION_INTERFACE]);
}
}

View File

@ -107,14 +107,14 @@ function node_filters() {
// Language filter if the site is multilingual.
if (language_multilingual()) {
$languages = language_list(TRUE);
$language_options = array(LANGUAGE_NONE => t('Language neutral'));
$language_options = array(LANGUAGE_NONE => t('- None -'));
foreach ($languages as $langcode => $language) {
$language_options[$langcode] = $language->name;
}
$filters['language'] = array(
'title' => t('language'),
'options' => array(
'[any]' => t('any'),
'[any]' => t('- Any -'),
) + $language_options,
);
}
@ -173,7 +173,7 @@ function node_filter_form() {
$value = $value->name;
}
elseif ($type == 'language') {
$value = $value == LANGUAGE_NONE ? t('Language neutral') : module_invoke('locale', 'language_name', $value);
$value = language_name($value);
}
else {
$value = $filters[$type]['options'][$value];
@ -446,7 +446,7 @@ function node_admin_nodes() {
'changed' => array('data' => t('Updated'), 'field' => 'n.changed', 'sort' => 'desc')
);
if ($multilanguage) {
$header['language'] = array('data' => t('Language'), 'field' => 'n.language');
$header['language_name'] = array('data' => t('Language'), 'field' => 'n.language');
}
$header['operations'] = array('data' => t('Operations'));
@ -498,12 +498,7 @@ function node_admin_nodes() {
'changed' => format_date($node->changed, 'short'),
);
if ($multilanguage) {
if ($node->language == LANGUAGE_NONE || isset($languages[$node->language])) {
$options[$node->nid]['language'] = $node->language == LANGUAGE_NONE ? t('Language neutral') : $languages[$node->language]->name;
}
else {
$options[$node->nid]['language'] = t('Undefined language (@langcode)', array('@langcode' => $node->language));
}
$options[$node->nid]['language_name'] = language_name($node->language);
}
// Build a list of all the accessible operations for the current node.
$operations = array();

View File

@ -19,7 +19,6 @@ html {
#overlay-close:hover {
background: transparent url(images/close-rtl.png) no-repeat;
-moz-border-radius-topright: 0;
-webkit-border-top-right-radius: 0;
border-top-right-radius: 0;
}

View File

@ -65,7 +65,6 @@
#overlay-close:hover {
background: transparent url(images/close.png) no-repeat; /* LTR */
-moz-border-radius-topleft: 0; /* LTR */
-webkit-border-top-left-radius: 0; /* LTR */
border-top-left-radius: 0; /* LTR */
display: block;
height: 26px;
@ -98,8 +97,6 @@
#overlay-tabs li a:hover {
background-color: #a6a7a2;
-moz-border-radius: 8px 8px 0 0;
-webkit-border-top-left-radius: 8px;
-webkit-border-top-right-radius: 8px;
border-radius: 8px 8px 0 0;
color: #000;
display: inline-block;
@ -142,8 +139,6 @@
margin: -20px auto 20px;
width: 80%;
-moz-border-radius: 0 0 8px 8px;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
border-radius: 0 0 8px 8px;
}
.overlay-disable-message-focused {

View File

@ -14,9 +14,10 @@
function path_admin_overview($keys = NULL) {
// Add the filter form above the overview table.
$build['path_admin_filter_form'] = drupal_get_form('path_admin_filter_form', $keys);
// Enable language column if locale is enabled or if we have any alias with language
// Enable language column if language.module is enabled or if we have any
// alias with a language.
$alias_exists = (bool) db_query_range('SELECT 1 FROM {url_alias} WHERE langcode <> :langcode', 0, 1, array(':langcode' => LANGUAGE_NONE))->fetchField();
$multilanguage = (module_exists('locale') || $alias_exists);
$multilanguage = (module_exists('language') || $alias_exists);
$header = array();
$header[] = array('data' => t('Alias'), 'field' => 'alias', 'sort' => 'asc');
@ -44,7 +45,7 @@ function path_admin_overview($keys = NULL) {
$row['data']['alias'] = l($data->alias, $data->source);
$row['data']['source'] = l($data->source, $data->source, array('alias' => TRUE));
if ($multilanguage) {
$row['data']['langcode'] = module_invoke('locale', 'language_name', $data->langcode);
$row['data']['language_name'] = language_name($data->langcode);
}
$operations = array();
@ -130,10 +131,9 @@ function path_admin_form($form, &$form_state, $path = array('source' => '', 'ali
'#required' => TRUE,
);
// A hidden value unless locale module is enabled.
if (module_exists('locale')) {
// A hidden value unless language.module is enabled.
if (module_exists('language')) {
$languages = language_list(TRUE);
$language_options = array(LANGUAGE_NONE => t('All languages'));
foreach ($languages as $langcode => $language) {
$language_options[$langcode] = $language->name;
}
@ -142,9 +142,11 @@ function path_admin_form($form, &$form_state, $path = array('source' => '', 'ali
'#type' => 'select',
'#title' => t('Language'),
'#options' => $language_options,
'#empty_value' => LANGUAGE_NONE,
'#empty_option' => t('- None -'),
'#default_value' => $path['langcode'],
'#weight' => -10,
'#description' => t('A path alias set for a specific language will always be used when displaying this page in that language, and takes precedence over path aliases set for <em>All languages</em>.'),
'#description' => t('A path alias set for a specific language will always be used when displaying this page in that language, and takes precedence over path aliases set as <em>- None -</em>.'),
);
}
else {
@ -194,7 +196,8 @@ function path_admin_form_validate($form, &$form_state) {
$source = drupal_get_normal_path($source);
$alias = $form_state['values']['alias'];
$pid = isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0;
// Language is only set if locale module is enabled, otherwise save for all languages.
// Language is only set if language.module is enabled, otherwise save for all
// languages.
$langcode = isset($form_state['values']['langcode']) ? $form_state['values']['langcode'] : LANGUAGE_NONE;
$has_alias = db_query("SELECT COUNT(alias) FROM {url_alias} WHERE pid <> :pid AND alias = :alias AND langcode = :langcode", array(

View File

@ -800,3 +800,75 @@ class PollDeleteChoiceTestCase extends PollTestCase {
$this->assertText('Third choice', t('Third choice remains.'));
}
}
/**
* Tests poll translation logic.
*/
class PollTranslateTestCase extends PollTestCase {
public static function getInfo() {
return array(
'name' => 'Poll translation',
'description' => 'Test the poll translation logic.',
'group' => 'Poll',
);
}
function setUp() {
parent::setUp('poll', 'translation');
}
/**
* Tests poll creation and translation.
*
* Checks that the choice names get copied from the original poll and that
* the vote count values are set to 0.
*/
function testPollTranslate() {
$admin_user = $this->drupalCreateUser(array('administer content types', 'administer languages', 'edit any poll content', 'create poll content', 'administer nodes', 'translate content'));
// Set up a poll with two choices.
$title = $this->randomName();
$choices = array($this->randomName(), $this->randomName());
$poll_nid = $this->pollCreate($title, $choices, FALSE);
$this->assertTrue($poll_nid, t('Poll for translation logic test created.'));
$this->drupalLogout();
$this->drupalLogin($admin_user);
// Enable a second language.
$this->drupalGet('admin/config/regional/language');
$edit = array();
$edit['predefined_langcode'] = 'nl';
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
$this->assertRaw(t('The language %language has been created and can now be used.', array('%language' => 'Dutch')), t('Language Dutch has been created.'));
// Set "Poll" content type to use multilingual support with translation.
$this->drupalGet('admin/structure/types/manage/poll');
$edit = array();
$edit['language_content_type'] = 2;
$this->drupalPost('admin/structure/types/manage/poll', $edit, t('Save content type'));
$this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Poll')), t('Poll content type has been updated.'));
// Edit poll.
$this->drupalGet("node/$poll_nid/edit");
$edit = array();
// Set the poll's first choice count to 200.
$edit['choice[chid:1][chvotes]'] = 200;
// Set the language to Dutch.
$edit['language'] = 'nl';
$this->drupalPost(NULL, $edit, t('Save'));
// Translate the Dutch poll.
$this->drupalGet('node/add/poll', array('query' => array('translation' => $poll_nid, 'target' => 'en')));
$dutch_poll = node_load($poll_nid);
// Check that the vote count values didn't get copied from the Dutch poll
// and are set to 0.
$this->assertFieldByName('choice[chid:1][chvotes]', '0', ('Found choice with vote count 0'));
$this->assertFieldByName('choice[chid:2][chvotes]', '0', ('Found choice with vote count 0'));
// Check that the choice names got copied from the Dutch poll.
$this->assertFieldByName('choice[chid:1][chtext]', $dutch_poll->choice[1]['chtext'], t('Found choice with text @text', array('@text' => $dutch_poll->choice[1]['chtext'])));
$this->assertFieldByName('choice[chid:2][chtext]', $dutch_poll->choice[2]['chtext'], t('Found choice with text @text', array('@text' => $dutch_poll->choice[2]['chtext'])));
}
}

View File

@ -31,8 +31,6 @@
.add-or-remove-shortcuts a:focus span.text,
.add-or-remove-shortcuts a:hover span.text {
-moz-border-radius: 5px 0 0 5px;
-webkit-border-top-left-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
border-radius: 5px 0 0 5px;
padding-left: 6px;
}

View File

@ -52,7 +52,7 @@ Drupal.behaviors.shortcutDrag = {
// status to be disabled and mark it also as changed.
var changedRowObject = new tableDrag.row(changedRow, 'mouse', self.indentEnabled, self.maxDepth, true);
changedRowObject.markChanged();
rowStatusChange(changedRowObject);
tableDrag.rowStatusChange(changedRowObject);
}
}
else if (total != visibleLength) {
@ -71,18 +71,18 @@ Drupal.behaviors.shortcutDrag = {
// Add a handler so when a row is dropped, update fields dropped into new regions.
tableDrag.onDrop = function () {
rowStatusChange(this.rowObject);
tableDrag.rowStatusChange(this.rowObject);
return true;
};
function rowStatusChange(rowObject) {
tableDrag.rowStatusChange = function (rowObject) {
// Use "status-message" row instead of "status" row because
// "status-{status_name}-message" is less prone to regexp match errors.
var statusRow = $(rowObject.element).prevAll('tr.shortcut-status').get(0);
var statusName = statusRow.className.replace(/([^ ]+[ ]+)*shortcut-status-([^ ]+)([ ]+[^ ]+)*/, '$2');
var statusField = $('select.shortcut-status-select', rowObject.element);
statusField.val(statusName);
}
};
tableDrag.restripeTable = function () {
// :even and :odd are reversed because jQuery counts from 0 and

View File

@ -23,7 +23,6 @@
padding: 0 5px 0 5px;
margin-right: 5px; /* LTR */
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
@ -45,7 +44,6 @@
height: 30px;
margin-right: 5px; /* LTR */
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
@ -90,8 +88,6 @@
padding-right: 6px; /* LTR */
cursor: pointer;
-moz-border-radius: 0 5px 5px 0; /* LTR */
-webkit-border-top-right-radius: 5px; /* LTR */
-webkit-border-bottom-right-radius: 5px; /* LTR */
border-radius: 0 5px 5px 0; /* LTR */
}

View File

@ -1372,6 +1372,12 @@ class DrupalWebTestCase extends DrupalTestCase {
variable_set('file_private_path', $private_files_directory);
variable_set('file_temporary_path', $temp_files_directory);
// Set the 'simpletest_parent_profile' variable to add the parent profile's
// search path to the child site's search paths.
// @see drupal_system_listing()
// @todo This may need to be primed like 'install_profile' above.
variable_set('simpletest_parent_profile', $this->originalProfile);
// Include the testing profile.
variable_set('install_profile', $this->profile);
$profile_details = install_profile_info($this->profile, 'en');

View File

@ -26,6 +26,7 @@ files[] = tests/lock.test
files[] = tests/mail.test
files[] = tests/menu.test
files[] = tests/module.test
files[] = tests/pager.test
files[] = tests/password.test
files[] = tests/path.test
files[] = tests/registry.test
@ -40,3 +41,4 @@ files[] = tests/xmlrpc.test
files[] = tests/upgrade/upgrade.test
files[] = tests/upgrade/upgrade_bare.test
files[] = tests/upgrade/upgrade_filled.test
files[] = tests/upgrade/upgrade.language.test

View File

@ -616,3 +616,91 @@ class SimpleTestMissingCheckedRequirements extends DrupalWebTestCase {
}
}
}
/**
* Verifies that tests bundled with installation profile modules are found.
*/
class SimpleTestInstallationProfileModuleTestsTestCase extends DrupalWebTestCase {
/**
* Use the Testing profile.
*
* The Testing profile contains drupal_system_listing_compatible_test.test,
* which attempts to:
* - run tests using the Minimal profile (which does not contain the
* drupal_system_listing_compatible_test.module)
* - but still install the drupal_system_listing_compatible_test.module
* contained in the Testing profile.
*
* @see DrupalSystemListingCompatibleTestCase
*/
protected $profile = 'testing';
public static function getInfo() {
return array(
'name' => 'Installation profile module tests',
'description' => 'Verifies that tests bundled with installation profile modules are found.',
'group' => 'SimpleTest',
);
}
function setUp() {
parent::setUp(array('simpletest'));
$this->admin_user = $this->drupalCreateUser(array('administer unit tests'));
$this->drupalLogin($this->admin_user);
}
/**
* Tests existence of test case located in an installation profile module.
*/
function testInstallationProfileTests() {
$this->drupalGet('admin/config/development/testing');
$this->assertText('Installation profile module tests helper');
$edit = array(
'DrupalSystemListingCompatibleTestCase' => TRUE,
);
$this->drupalPost(NULL, $edit, t('Run tests'));
$this->assertText('DrupalSystemListingCompatibleTestCase test executed.');
}
}
/**
* Verifies that tests in other installation profiles are not found.
*
* @see SimpleTestInstallationProfileModuleTestsTestCase
*/
class SimpleTestOtherInstallationProfileModuleTestsTestCase extends DrupalWebTestCase {
/**
* Use the Minimal profile.
*
* The Testing profile contains drupal_system_listing_compatible_test.test,
* which should not be found.
*
* @see SimpleTestInstallationProfileModuleTestsTestCase
* @see DrupalSystemListingCompatibleTestCase
*/
protected $profile = 'minimal';
public static function getInfo() {
return array(
'name' => 'Other Installation profiles',
'description' => 'Verifies that tests in other installation profiles are not found.',
'group' => 'SimpleTest',
);
}
function setUp() {
parent::setUp(array('simpletest'));
$this->admin_user = $this->drupalCreateUser(array('administer unit tests'));
$this->drupalLogin($this->admin_user);
}
/**
* Tests that tests located in another installation profile do not appear.
*/
function testOtherInstallationProfile() {
$this->drupalGet('admin/config/development/testing');
$this->assertNoText('Installation profile module tests helper');
}
}

View File

@ -462,3 +462,44 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
}
}
/**
* Tests the file move function for managed files.
*/
class ImageFileMoveTest extends ImageToolkitTestCase {
public static function getInfo() {
return array(
'name' => 'Image moving',
'description' => 'Tests the file move function for managed files.',
'group' => 'Image',
);
}
/**
* Tests moving a randomly generated image.
*/
function testNormal() {
// Pick a file for testing.
$file = current($this->drupalGetTestFiles('image'));
// Create derivative image.
$style = image_style_load(key(image_styles()));
$derivative_uri = image_style_path($style['name'], $file->uri);
image_style_create_derivative($style, $file->uri, $derivative_uri);
// Check if derivative image exists.
$this->assertTrue(file_exists($derivative_uri), 'Make sure derivative image is generated successfully.');
// Clone the object so we don't have to worry about the function changing
// our reference copy.
$desired_filepath = 'public://' . $this->randomName();
$result = file_move(clone $file, $desired_filepath, FILE_EXISTS_ERROR);
// Check if image has been moved.
$this->assertTrue(file_exists($result->uri), 'Make sure image is moved successfully.');
// Check if derivative image has been flushed.
$this->assertFalse(file_exists($derivative_uri), 'Make sure derivative image has been flushed.');
}
}

View File

@ -333,3 +333,49 @@ class PathLookupTest extends DrupalWebTestCase {
$this->assertEqual(drupal_lookup_path('source', $path['alias']), $path['source'], t('Newer alias record is returned when comparing two LANGUAGE_NONE paths with the same alias.'));
}
}
/**
* Tests the path_save() function.
*/
class PathSaveTest extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => t('Path save'),
'description' => t('Tests that path_save() exposes the previous alias value.'),
'group' => t('Path API'),
);
}
function setUp() {
// Enable a helper module that implements hook_path_update().
parent::setUp('path_test');
path_test_reset();
}
/**
* Tests that path_save() makes the original path available to modules.
*/
function testDrupalSaveOriginalPath() {
$account = $this->drupalCreateUser();
$uid = $account->uid;
$name = $account->name;
// Create a language-neutral alias.
$path = array(
'source' => "user/$uid",
'alias' => 'foo',
);
$path_original = $path;
path_save($path);
// Alter the path.
$path['alias'] = 'bar';
path_save($path);
// Test to see if the original alias is available to modules during
// hook_path_update().
$results = variable_get('path_test_results', array());
$this->assertIdentical($results['hook_path_update']['original']['alias'], $path_original['alias'], t('Old path alias available to modules during hook_path_update.'));
$this->assertIdentical($results['hook_path_update']['original']['source'], $path_original['source'], t('Old path alias available to modules during hook_path_update.'));
}
}

View File

@ -0,0 +1,6 @@
name = "Hook path tests"
description = "Support module for path hook testing."
package = Testing
version = VERSION
core = 8.x
hidden = TRUE

View File

@ -0,0 +1,22 @@
<?php
/**
* @file
* Helper module for the path tests.
*/
/**
* Resets the path test results.
*/
function path_test_reset() {
variable_set('path_test_results', array());
}
/**
* Implements hook_path_update().
*/
function path_test_path_update($path) {
$results = variable_get('path_test_results', array());
$results['hook_path_update'] = $path;
variable_set('path_test_results', $results);
}

View File

@ -117,6 +117,37 @@ class ThemeUnitTest extends DrupalWebTestCase {
$this->drupalGet('theme-test/template-test');
$this->assertText('Success: Template overridden.', t('Template overridden by defined \'template\' filename.'));
}
/**
* Test the list_themes() function.
*/
function testListThemes() {
$themes = list_themes();
// Check if drupal_theme_access() retrieves enabled themes properly from list_themes().
$this->assertTrue(drupal_theme_access('test_theme'), t('Enabled theme detected'));
// Check if list_themes() returns disabled themes.
$this->assertTrue(array_key_exists('test_basetheme', $themes), t('Disabled theme detected'));
// Check for base theme and subtheme lists.
$base_theme_list = array('test_basetheme' => 'Theme test base theme');
$sub_theme_list = array('test_subtheme' => 'Theme test subtheme');
$this->assertIdentical($themes['test_basetheme']->sub_themes, $sub_theme_list, t('Base theme\'s object includes list of subthemes.'));
$this->assertIdentical($themes['test_subtheme']->base_themes, $base_theme_list, t('Subtheme\'s object includes list of base themes.'));
// Check for theme engine in subtheme.
$this->assertIdentical($themes['test_subtheme']->engine, 'phptemplate', t('Subtheme\'s object includes the theme engine.'));
// Check for theme engine prefix.
$this->assertIdentical($themes['test_basetheme']->prefix, 'phptemplate', t('Base theme\'s object includes the theme engine prefix.'));
$this->assertIdentical($themes['test_subtheme']->prefix, 'phptemplate', t('Subtheme\'s object includes the theme engine prefix.'));
}
/**
* Test the theme_get_setting() function.
*/
function testThemeGetSetting() {
$GLOBALS['theme_key'] = 'test_theme';
$this->assertIdentical(theme_get_setting('theme_test_setting'), 'default value', t('theme_get_setting() uses the default theme automatically.'));
$this->assertNotEqual(theme_get_setting('subtheme_override', 'test_basetheme'), theme_get_setting('subtheme_override', 'test_subtheme'), t('Base theme\'s default settings values can be overridden by subtheme.'));
$this->assertIdentical(theme_get_setting('basetheme_only', 'test_subtheme'), 'base theme value', t('Base theme\'s default settings values are inherited by subtheme.'));
}
}
/**

View File

@ -19,6 +19,8 @@ function theme_test_theme($existing, $type, $theme, $path) {
*/
function theme_test_system_theme_info() {
$themes['test_theme'] = drupal_get_path('module', 'theme_test') . '/themes/test_theme/test_theme.info';
$themes['test_basetheme'] = drupal_get_path('module', 'theme_test') . '/themes/test_basetheme/test_basetheme.info';
$themes['test_subtheme'] = drupal_get_path('module', 'theme_test') . '/themes/test_subtheme/test_subtheme.info';
return $themes;
}

View File

@ -0,0 +1,7 @@
name = Theme test base theme
description = Test theme which acts as a base theme for other test subthemes.
core = 8.x
hidden = TRUE
settings[basetheme_only] = base theme value
settings[subtheme_override] = base theme value

View File

@ -0,0 +1,7 @@
name = Theme test subtheme
description = Test theme which uses test_basetheme as the base theme.
core = 8.x
base theme = test_basetheme
hidden = TRUE
settings[subtheme_override] = subtheme value

View File

@ -14,3 +14,5 @@ hidden = TRUE
; version from being loaded, and that errors aren't caused by the lack of this
; file within the theme folder.
stylesheets[all][] = system.base.css
settings[theme_test_setting] = default value

View File

@ -0,0 +1,522 @@
<?php
/**
* @file
* Database additions for language tests. Used in upgrade.language.test.
*
* This dump only contains data and schema components relevant for language
* functionality. The drupal-7.filled.database.php file is imported before
* this dump, so the two form the database structure expected in tests
* altogether.
*/
// Add blocks respective for language functionality.
db_insert('block')->fields(array(
'module',
'delta',
'theme',
'status',
'weight',
'region',
'custom',
'visibility',
'pages',
'title',
'cache',
))
->values(array(
'module' => 'locale',
'delta' => 'language',
'theme' => 'bartik',
'status' => '0',
'weight' => '0',
'region' => '-1',
'custom' => '0',
'visibility' => '0',
'pages' => '',
'title' => '',
'cache' => '-1',
))
->values(array(
'module' => 'locale',
'delta' => 'language',
'theme' => 'seven',
'status' => '0',
'weight' => '0',
'region' => '-1',
'custom' => '0',
'visibility' => '0',
'pages' => '',
'title' => '',
'cache' => '-1',
))
->execute();
// Add language table from locale.install schema and prefill with some default
// languages for testing.
db_create_table('languages', array(
'fields' => array(
'language' => array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
),
'name' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'native' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'direction' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'enabled' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'plurals' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'formula' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'domain' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'prefix' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'javascript' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
),
'primary key' => array(
'language',
),
'indexes' => array(
'list' => array(
'weight',
'name',
),
),
'module' => 'locale',
'name' => 'languages',
));
db_insert('languages')->fields(array(
'language',
'name',
'native',
'direction',
'enabled',
'plurals',
'formula',
'domain',
'prefix',
'weight',
'javascript',
))
->values(array(
'language' => 'ca',
'name' => 'Catalan',
'native' => 'Català',
'direction' => '0',
'enabled' => '1',
'plurals' => '2',
'formula' => '($n>1)',
'domain' => '',
'prefix' => 'ca',
'weight' => '0',
'javascript' => '',
))
->values(array(
'language' => 'cv',
'name' => 'Chuvash',
'native' => 'Chuvash',
'direction' => '0',
'enabled' => '1',
'plurals' => '0',
'formula' => '',
'domain' => '',
'prefix' => 'cv',
'weight' => '0',
'javascript' => '',
))
->values(array(
'language' => 'en',
'name' => 'English',
'native' => 'English',
'direction' => '0',
'enabled' => '1',
'plurals' => '0',
'formula' => '',
'domain' => '',
'prefix' => '',
'weight' => '0',
'javascript' => '',
))
->execute();
// Add locales_source table from locale.install schema and fill with some
// sample data for testing.
db_create_table('locales_source', array(
'fields' => array(
'lid' => array(
'type' => 'serial',
'not null' => TRUE,
),
'location' => array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
),
'textgroup' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => 'default',
),
'source' => array(
'type' => 'text',
'mysql_type' => 'blob',
'not null' => TRUE,
),
'context' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'version' => array(
'type' => 'varchar',
'length' => 20,
'not null' => TRUE,
'default' => 'none',
),
),
'primary key' => array(
'lid',
),
'indexes' => array(
'source_context' => array(
array(
'source',
30,
),
'context',
),
),
'module' => 'locale',
'name' => 'locales_source',
));
db_insert('locales_source')->fields(array(
'lid',
'location',
'textgroup',
'source',
'context',
'version',
))
->values(array(
'lid' => '1',
'location' => 'misc/drupal.js',
'textgroup' => 'default',
'source' => 'An AJAX HTTP error occurred.',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '2',
'location' => 'misc/drupal.js',
'textgroup' => 'default',
'source' => 'HTTP Result Code: !status',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '3',
'location' => 'misc/drupal.js',
'textgroup' => 'default',
'source' => 'An AJAX HTTP request terminated abnormally.',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '4',
'location' => 'misc/drupal.js',
'textgroup' => 'default',
'source' => 'Debugging information follows.',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '5',
'location' => 'misc/drupal.js',
'textgroup' => 'default',
'source' => 'Path: !uri',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '6',
'location' => 'misc/drupal.js',
'textgroup' => 'default',
'source' => 'StatusText: !statusText',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '7',
'location' => 'misc/drupal.js',
'textgroup' => 'default',
'source' => 'ResponseText: !responseText',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '8',
'location' => 'misc/drupal.js',
'textgroup' => 'default',
'source' => 'ReadyState: !readyState',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '9',
'location' => 'modules/overlay/overlay-parent.js',
'textgroup' => 'default',
'source' => '@title dialog',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '10',
'location' => 'modules/contextual/contextual.js',
'textgroup' => 'default',
'source' => 'Configure',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '11',
'location' => 'modules/toolbar/toolbar.js',
'textgroup' => 'default',
'source' => 'Show shortcuts',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '12',
'location' => 'modules/toolbar/toolbar.js',
'textgroup' => 'default',
'source' => 'Hide shortcuts',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '13',
'location' => 'modules/overlay/overlay-child.js',
'textgroup' => 'default',
'source' => 'Loading',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '14',
'location' => 'modules/overlay/overlay-child.js',
'textgroup' => 'default',
'source' => '(active tab)',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '15',
'location' => 'misc/tabledrag.js',
'textgroup' => 'default',
'source' => 'Re-order rows by numerical weight instead of dragging.',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '16',
'location' => 'misc/tabledrag.js',
'textgroup' => 'default',
'source' => 'Show row weights',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '17',
'location' => 'misc/tabledrag.js',
'textgroup' => 'default',
'source' => 'Hide row weights',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '18',
'location' => 'misc/tabledrag.js',
'textgroup' => 'default',
'source' => 'Drag to re-order',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '19',
'location' => 'misc/tabledrag.js',
'textgroup' => 'default',
'source' => 'Changes made in this table will not be saved until the form is submitted.',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '20',
'location' => 'misc/collapse.js',
'textgroup' => 'default',
'source' => 'Hide',
'context' => '',
'version' => 'none',
))
->values(array(
'lid' => '21',
'location' => 'misc/collapse.js',
'textgroup' => 'default',
'source' => 'Show',
'context' => '',
'version' => 'none',
))
->execute();
// Add locales_target table from locale.install schema.
db_create_table('locales_target', array(
'fields' => array(
'lid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'translation' => array(
'type' => 'text',
'mysql_type' => 'blob',
'not null' => TRUE,
),
'language' => array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
),
'plid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'plural' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'language',
'lid',
'plural',
),
'foreign keys' => array(
'locales_source' => array(
'table' => 'locales_source',
'columns' => array(
'lid' => 'lid',
),
),
),
'indexes' => array(
'lid' => array(
'lid',
),
'plid' => array(
'plid',
),
'plural' => array(
'plural',
),
),
'module' => 'locale',
'name' => 'locales_target',
));
// Set up variables needed for language support.
db_insert('variable')->fields(array(
'name',
'value',
))
->values(array(
'name' => 'javascript_parsed',
'value' => 'a:16:{i:0;s:14:"misc/drupal.js";i:1;s:14:"misc/jquery.js";i:2;s:19:"misc/jquery.once.js";s:10:"refresh:ca";s:7:"waiting";i:3;s:29:"misc/ui/jquery.ui.core.min.js";i:4;s:21:"misc/jquery.ba-bbq.js";i:5;s:33:"modules/overlay/overlay-parent.js";i:6;s:32:"modules/contextual/contextual.js";i:7;s:21:"misc/jquery.cookie.js";i:8;s:26:"modules/toolbar/toolbar.js";i:9;s:32:"modules/overlay/overlay-child.js";i:10;s:19:"misc/tableheader.js";i:11;s:17:"misc/tabledrag.js";i:12;s:12:"misc/form.js";i:13;s:16:"misc/collapse.js";s:10:"refresh:cv";s:7:"waiting";}',
))
->values(array(
'name' => 'language_count',
'value' => 'i:3;',
))
->values(array(
'name' => 'language_default',
'value' => 'O:8:"stdClass":7:{s:8:"langcode";s:2:"ca";s:4:"name";s:7:"Catalan";s:9:"direction";i:0;s:7:"enabled";b:1;s:6:"weight";i:0;s:7:"default";b:1;s:6:"is_new";b:1;}',
))
->values(array(
'name' => 'language_negotiation_language',
'value' => 'a:5:{s:10:"locale-url";a:2:{s:9:"callbacks";a:3:{s:8:"language";s:24:"locale_language_from_url";s:8:"switcher";s:28:"locale_language_switcher_url";s:11:"url_rewrite";s:31:"locale_language_url_rewrite_url";}s:4:"file";s:19:"includes/locale.inc";}s:14:"locale-session";a:2:{s:9:"callbacks";a:3:{s:8:"language";s:28:"locale_language_from_session";s:8:"switcher";s:32:"locale_language_switcher_session";s:11:"url_rewrite";s:35:"locale_language_url_rewrite_session";}s:4:"file";s:19:"includes/locale.inc";}s:11:"locale-user";a:2:{s:9:"callbacks";a:1:{s:8:"language";s:25:"locale_language_from_user";}s:4:"file";s:19:"includes/locale.inc";}s:14:"locale-browser";a:3:{s:9:"callbacks";a:1:{s:8:"language";s:28:"locale_language_from_browser";}s:4:"file";s:19:"includes/locale.inc";s:5:"cache";i:0;}s:16:"language-default";a:1:{s:9:"callbacks";a:1:{s:8:"language";s:21:"language_from_default";}}}',
))
->values(array(
'name' => 'language_negotiation_language_content',
'value' => 'a:1:{s:16:"locale-interface";a:2:{s:9:"callbacks";a:1:{s:8:"language";s:30:"locale_language_from_interface";}s:4:"file";s:19:"includes/locale.inc";}}',
))
->values(array(
'name' => 'language_negotiation_language_url',
'value' => 'a:2:{s:10:"locale-url";a:2:{s:9:"callbacks";a:3:{s:8:"language";s:24:"locale_language_from_url";s:8:"switcher";s:28:"locale_language_switcher_url";s:11:"url_rewrite";s:31:"locale_language_url_rewrite_url";}s:4:"file";s:19:"includes/locale.inc";}s:19:"locale-url-fallback";a:2:{s:9:"callbacks";a:1:{s:8:"language";s:28:"locale_language_url_fallback";}s:4:"file";s:19:"includes/locale.inc";}}',
))
->values(array(
'name' => 'language_types',
'value' => 'a:3:{s:8:"language";b:1;s:16:"language_content";b:0;s:12:"language_url";b:0;}',
))
->values(array(
'name' => 'locale_language_providers_weight_language',
'value' => 'a:5:{s:10:"locale-url";s:2:"-8";s:14:"locale-session";s:2:"-6";s:11:"locale-user";s:2:"-4";s:14:"locale-browser";s:2:"-2";s:16:"language-default";s:2:"10";}',
))
->execute();
// Enable the locale module.
db_update('system')->fields(array(
'status' => 1,
'schema_version' => '7001',
))
->condition('type', 'module')
->condition('name', 'locale')
->execute();

View File

@ -0,0 +1,44 @@
<?php
/**
* @file
* Upgrade tests for the Language module.
*/
/**
* Tests upgrading a filled database with language data.
*
* Loads a filled installation of Drupal 7 with language data and runs the
* upgrade process on it.
*/
class LanguageUpgradePathTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Language upgrade test',
'description' => 'Upgrade tests with language data.',
'group' => 'Upgrade path',
);
}
public function setUp() {
// Path to the database dump files.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.filled.database.php.gz',
drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.language.database.php',
);
parent::setUp();
}
/**
* Tests a successful upgrade.
*/
public function testLanguageUpgrade() {
$this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
// Ensure Catalan was properly upgraded to be the new default language.
$this->assertTrue(language_default()->langcode == 'ca', t('Catalan is the default language'));
$languages = language_list();
foreach ($languages as $language) {
$this->assertTrue($language->default == ($language->langcode == 'ca'), t('@language default property properly set', array('@language' => $language->name)));
}
}
}

View File

@ -243,9 +243,9 @@ abstract class UpgradePathTestCase extends DrupalWebTestCase {
* TRUE if the upgrade succeeded, FALSE otherwise.
*/
protected function performUpgrade($register_errors = TRUE) {
$update_url = $GLOBALS['base_url'] . '/core/update.php';
// Load the first update screen.
$update_url = $GLOBALS['base_url'] . '/core/update.php';
$this->drupalGet($update_url, array('external' => TRUE));
if (!$this->assertResponse(200)) {
return FALSE;

View File

@ -369,7 +369,7 @@ function system_theme_settings($form, &$form_state, $key = '') {
// Default settings are defined in theme_get_setting() in includes/theme.inc
if ($key) {
$var = 'theme_' . $key . '_settings';
$themes = system_rebuild_theme_data();
$themes = list_themes();
$features = $themes[$key]->info['features'];
}
else {

View File

@ -790,7 +790,8 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) {
* "default" task, which should display the same page as the parent item.
* If the "type" element is omitted, MENU_NORMAL_ITEM is assumed.
* - "options": An array of options to be passed to l() when generating a link
* from this menu item.
* from this menu item. Note that the "options" parameter has no effect on
* MENU_LOCAL_TASK, MENU_DEFAULT_LOCAL_TASK, and MENU_LOCAL_ACTION items.
*
* For a detailed usage example, see page_example.module.
* For comprehensive documentation on the menu system, see

View File

@ -2581,7 +2581,7 @@ function _system_rebuild_theme_data() {
// Now that we've established all our master themes, go back and fill in data
// for subthemes.
foreach ($sub_themes as $key) {
$themes[$key]->base_themes = system_find_base_themes($themes, $key);
$themes[$key]->base_themes = drupal_find_base_themes($themes, $key);
// Don't proceed if there was a problem with the root base theme.
if (!current($themes[$key]->base_themes)) {
continue;
@ -2673,47 +2673,6 @@ function _system_default_theme_features() {
);
}
/**
* Find all the base themes for the specified theme.
*
* Themes can inherit templates and function implementations from earlier themes.
*
* @param $themes
* An array of available themes.
* @param $key
* The name of the theme whose base we are looking for.
* @param $used_keys
* A recursion parameter preventing endless loops.
* @return
* Returns an array of all of the theme's ancestors; the first element's value
* will be NULL if an error occurred.
*/
function system_find_base_themes($themes, $key, $used_keys = array()) {
$base_key = $themes[$key]->info['base theme'];
// Does the base theme exist?
if (!isset($themes[$base_key])) {
return array($base_key => NULL);
}
$current_base_theme = array($base_key => $themes[$base_key]->info['name']);
// Is the base theme itself a child of another theme?
if (isset($themes[$base_key]->info['base theme'])) {
// Do we already know the base themes of this theme?
if (isset($themes[$base_key]->base_themes)) {
return $themes[$base_key]->base_themes + $current_base_theme;
}
// Prevent loops.
if (!empty($used_keys[$base_key])) {
return array($base_key => NULL);
}
$used_keys[$base_key] = TRUE;
return system_find_base_themes($themes, $base_key, $used_keys) + $current_base_theme;
}
// If we get here, then this is our parent theme.
return $current_base_theme;
}
/**
* Get a list of available regions from a specified theme.
*

View File

@ -2109,7 +2109,7 @@ class UpdateScriptFunctionalTest extends DrupalWebTestCase {
}
function setUp() {
parent::setUp('update_script_test');
parent::setUp(array('update_script_test', 'dblog'));
$this->update_url = $GLOBALS['base_url'] . '/core/update.php';
$this->update_user = $this->drupalCreateUser(array('administer software updates'));
}
@ -2210,6 +2210,56 @@ class UpdateScriptFunctionalTest extends DrupalWebTestCase {
$final_theme_data = db_query("SELECT * FROM {system} WHERE type = 'theme' ORDER BY name")->fetchAll();
$this->assertEqual($original_theme_data, $final_theme_data, t('Visiting update.php does not alter the information about themes stored in the database.'));
}
/**
* Tests update.php when there are no updates to apply.
*/
function testNoUpdateFunctionality() {
// Click through update.php with 'administer software updates' permission.
$this->drupalLogin($this->update_user);
$this->drupalPost($this->update_url, array(), t('Continue'), array('external' => TRUE));
$this->assertText(t('No pending updates.'));
$this->assertNoLink('Administration pages');
$this->clickLink('Front page');
$this->assertResponse(200);
// Click through update.php with 'access administration pages' permission.
$admin_user = $this->drupalCreateUser(array('administer software updates', 'access administration pages'));
$this->drupalLogin($admin_user);
$this->drupalPost($this->update_url, array(), t('Continue'), array('external' => TRUE));
$this->assertText(t('No pending updates.'));
$this->clickLink('Administration pages');
$this->assertResponse(200);
}
/**
* Tests update.php after performing a successful update.
*/
function testSuccessfulUpdateFunctionality() {
drupal_set_installed_schema_version('update_script_test', drupal_get_installed_schema_version('update_script_test') - 1);
// Click through update.php with 'administer software updates' permission.
$this->drupalLogin($this->update_user);
$this->drupalPost($this->update_url, array(), t('Continue'), array('external' => TRUE));
$this->drupalPost(NULL, array(), t('Apply pending updates'));
$this->assertText('Updates were attempted.');
$this->assertLink('site');
$this->assertNoLink('Administration pages');
$this->assertNoLink('logged');
$this->clickLink('Front page');
$this->assertResponse(200);
drupal_set_installed_schema_version('update_script_test', drupal_get_installed_schema_version('update_script_test') - 1);
// Click through update.php with 'access administration pages' and
// 'access site reports' permissions.
$admin_user = $this->drupalCreateUser(array('administer software updates', 'access administration pages', 'access site reports'));
$this->drupalLogin($admin_user);
$this->drupalPost($this->update_url, array(), t('Continue'), array('external' => TRUE));
$this->drupalPost(NULL, array(), t('Apply pending updates'));
$this->assertText('Updates were attempted.');
$this->assertLink('logged');
$this->clickLink('Administration pages');
$this->assertResponse(200);
}
}
/**

View File

@ -231,7 +231,6 @@ th.checkbox {
border-color: #666;
margin: 0 0.2em;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.progress .filled {

View File

@ -210,7 +210,7 @@ function taxonomy_field_extra_fields() {
* @param $limit
* Integer. The maximum number of nodes to find.
* Set to FALSE for no limit.
* @order
* @param $order
* An array of fields and directions.
*
* @return
@ -1483,6 +1483,10 @@ function taxonomy_field_formatter_info() {
'label' => t('Plain text'),
'field types' => array('taxonomy_term_reference'),
),
'taxonomy_term_reference_rss_category' => array(
'label' => t('RSS category'),
'field types' => array('taxonomy_term_reference'),
),
);
}
@ -1525,6 +1529,18 @@ function taxonomy_field_formatter_view($entity_type, $entity, $field, $instance,
);
}
break;
case 'taxonomy_term_reference_rss_category':
foreach ($items as $delta => $item) {
$entity->rss_elements[] = array(
'key' => 'category',
'value' => $item['tid'] != 'autocreate' ? $item['taxonomy_term']->name : $item['name'],
'attributes' => array(
'domain' => $item['tid'] != 'autocreate' ? url('taxonomy/term/' . $item['tid'], array('absolute' => TRUE)) : '',
),
);
}
break;
}
return $element;

View File

@ -108,7 +108,13 @@ function taxonomy_term_feed($term) {
* @see taxonomy_field_widget_info()
*/
function taxonomy_autocomplete($field_name, $tags_typed = '') {
$field = field_info_field($field_name);
// Make sure the field exists and is a taxonomy field.
if (!($field = field_info_field($field_name)) || $field['type'] !== 'taxonomy_term_reference') {
// Error string. The JavaScript handler will realize this is not JSON and
// will display it as debugging information.
print t('Taxonomy field @field_name not found.', array('@field_name' => $field_name));
exit;
}
// The user enters a comma-separated list of tags. We only autocomplete the last tag.
$tags_typed = drupal_explode_tags($tags_typed);

View File

@ -706,6 +706,14 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
$input = substr($term_objects['term4']->name, 0, 3);
$this->drupalGet('taxonomy/autocomplete/taxonomy_' . $this->vocabulary->machine_name . '/' . $input);
$this->assertRaw('{"' . $term_objects['term4']->name . '":"' . $term_objects['term4']->name . '"}', t('Autocomplete returns term %term_name after typing the first 3 letters.', array('%term_name' => $term_objects['term4']->name)));
// Test taxonomy autocomplete with a nonexistent field.
$field_name = $this->randomName();
$tag = $this->randomName();
$message = t("Taxonomy field @field_name not found.", array('@field_name' => $field_name));
$this->assertFalse(field_info_field($field_name), t('Field %field_name does not exist.', array('%field_name' => $field_name)));
$this->drupalGet('taxonomy/autocomplete/' . $field_name . '/' . $tag);
$this->assertRaw($message, t('Autocomplete returns correct error message when the taxonomy field does not exist.'));
}
/**
@ -928,6 +936,99 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
}
}
/**
* Tests the rendering of term reference fields in RSS feeds.
*/
class TaxonomyRSSTestCase extends TaxonomyWebTestCase {
public static function getInfo() {
return array(
'name' => 'Taxonomy RSS Content.',
'description' => 'Ensure that data added as terms appears in RSS feeds if "RSS Category" format is selected.',
'group' => 'Taxonomy',
);
}
function setUp() {
parent::setUp('taxonomy');
$this->admin_user = $this->drupalCreateUser(array('administer taxonomy', 'bypass node access', 'administer content types'));
$this->drupalLogin($this->admin_user);
$this->vocabulary = $this->createVocabulary();
$field = array(
'field_name' => 'taxonomy_' . $this->vocabulary->machine_name,
'type' => 'taxonomy_term_reference',
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
'settings' => array(
'allowed_values' => array(
array(
'vocabulary' => $this->vocabulary->machine_name,
'parent' => 0,
),
),
),
);
field_create_field($field);
$this->instance = array(
'field_name' => 'taxonomy_' . $this->vocabulary->machine_name,
'bundle' => 'article',
'entity_type' => 'node',
'widget' => array(
'type' => 'options_select',
),
'display' => array(
'default' => array(
'type' => 'taxonomy_term_reference_link',
),
),
);
field_create_instance($this->instance);
}
/**
* Tests that terms added to nodes are displayed in core RSS feed.
*
* Create a node and assert that taxonomy terms appear in rss.xml.
*/
function testTaxonomyRSS() {
// Create two taxonomy terms.
$term1 = $this->createTerm($this->vocabulary);
// RSS display must be added manually.
$this->drupalGet("admin/structure/types/manage/article/display");
$edit = array(
"view_modes_custom[rss]" => '1',
);
$this->drupalPost(NULL, $edit, t('Save'));
// Change the format to 'RSS category'.
$this->drupalGet("admin/structure/types/manage/article/display/rss");
$edit = array(
"fields[taxonomy_" . $this->vocabulary->machine_name . "][type]" => 'taxonomy_term_reference_rss_category',
);
$this->drupalPost(NULL, $edit, t('Save'));
// Post an article.
$edit = array();
$langcode = LANGUAGE_NONE;
$edit["title"] = $this->randomName();
$edit[$this->instance['field_name'] . '[' . $langcode .'][]'] = $term1->tid;
$this->drupalPost('node/add/article', $edit, t('Save'));
// Check that the term is displayed when the RSS feed is viewed.
$this->drupalGet('rss.xml');
$test_element = array(
'key' => 'category',
'value' => $term1->name,
'attributes' => array(
'domain' => url('taxonomy/term/' . $term1->tid, array('absolute' => TRUE)),
),
);
$this->assertRaw(format_xml_elements(array($test_element)), 'Term is displayed when viewing the rss feed.');
}
}
/**
* Tests the hook implementations that maintain the taxonomy index.
*/

View File

@ -109,7 +109,6 @@ body.toolbar-drawer {
#toolbar div.toolbar-menu ul li a {
padding: 0 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
}
#toolbar div.toolbar-menu ul li a:focus,

View File

@ -139,7 +139,7 @@ function translation_form_node_form_alter(&$form, &$form_state) {
// might need to distinguish between enabled and disabled languages, hence
// we divide them in two option groups.
if ($translator_widget) {
$options = array($groups[1] => array(LANGUAGE_NONE => t('Language neutral')));
$options = array($groups[1] => array(LANGUAGE_NONE => t('- None -')));
foreach (array(1, 0) as $status) {
$group = $groups[$status];
foreach ($grouped_languages[$status] as $langcode => $language) {

View File

@ -598,9 +598,9 @@ function simpletest_script_reporter_display_results() {
echo "\n\n---- $result->test_class ----\n\n\n";
$test_class = $result->test_class;
// Print table header.
echo "Status Group Filename Line Function \n";
echo "--------------------------------------------------------------------------------\n";
// Print table header.
echo "Status Group Filename Line Function \n";
echo "--------------------------------------------------------------------------------\n";
}
simpletest_script_format_result($result);

View File

@ -58,10 +58,8 @@
background: rgba(255, 255, 255, 0.7);
text-shadow: 0 1px #eee;
-moz-border-radius-topleft: 8px;
-webkit-border-top-left-radius: 8px;
border-top-left-radius: 8px;
-moz-border-radius-topright: 8px;
-webkit-border-top-right-radius: 8px;
border-top-right-radius: 8px;
}
#preview-main-menu-links a:hover,

View File

@ -16,7 +16,10 @@ blockquote:before {
blockquote:after {
content: "\201C";
}
tr td,
tr th {
text-align: right;
}
/* ------------------ List Styles ------------------ */
.region-content ul,

View File

@ -86,7 +86,6 @@ kbd {
display: inline-block;
padding: 0 6px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
pre {
@ -279,10 +278,6 @@ ul.tips {
padding: 1px 10px 2px 10px;
text-decoration: none;
-moz-border-radius: 0 0 10px 10px;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 10px;
-webkit-border-bottom-right-radius: 10px;
border-radius: 0 0 10px 10px;
}
#skip-link a:hover,
@ -480,8 +475,6 @@ h1#site-name {
text-shadow: 0 1px #eee;
-moz-border-radius-topleft: 8px;
-moz-border-radius-topright: 8px;
-webkit-border-top-left-radius: 8px;
-webkit-border-top-right-radius: 8px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
}
@ -979,10 +972,8 @@ ul.links {
margin: 0;
text-shadow: 0 1px 0 #fff;
-moz-border-radius-topleft: 6px;
-webkit-border-top-left-radius: 6px;
border-top-left-radius: 6px;
-moz-border-radius-topright: 6px;
-webkit-border-top-right-radius: 6px;
border-top-right-radius: 6px;
}
.tabs ul.primary li.active a {
@ -1009,7 +1000,6 @@ ul.links {
background: #f2f2f2;
border-bottom: none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
ul.action-links {
@ -1094,7 +1084,6 @@ a.button {
margin-right: 0.6em; /* LTR */
padding: 4px 17px;
-moz-border-radius: 20px;
-webkit-border-radius: 15px;
border-radius: 15px;
}
a.button:link,
@ -1117,7 +1106,6 @@ fieldset {
position: relative;
top: 12px; /* Offsets the negative margin of legends */
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.fieldset-wrapper {
@ -1131,8 +1119,6 @@ fieldset {
padding: 1em 0 0.2em;
-moz-border-radius-topright: 0;
-moz-border-radius-topleft: 0;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
@ -1152,7 +1138,6 @@ fieldset {
fieldset.collapsed {
background: transparent;
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
}
fieldset legend {
@ -1172,15 +1157,12 @@ fieldset legend {
top: -12px;
width: 100%;
-moz-border-radius-topleft: 4px;
-webkit-border-top-left-radius: 4px;
border-top-left-radius: 4px;
-moz-border-radius-topright: 4px;
-webkit-border-top-right-radius: 4px;
border-top-right-radius: 4px;
}
fieldset.collapsed legend {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
fieldset legend a {
@ -1251,27 +1233,22 @@ input.form-submit:focus {
.contact-form #edit-name {
width: 75%;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.contact-form #edit-mail {
width: 75%;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.contact-form #edit-subject {
width: 75%;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.contact-form #edit-message {
width: 76.3%;
-moz-border-radius-topleft: 4px;
-moz-border-radius-topright: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
@ -1279,8 +1256,6 @@ input.form-submit:focus {
width: 76%;
-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}
@ -1323,7 +1298,6 @@ input.form-button-disabled:active,
.comment-form .form-select {
margin: 0;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.comment-form .form-type-textarea label {
@ -1368,8 +1342,6 @@ input.form-button-disabled:active,
.comment-form .form-textarea {
-moz-border-radius-topleft: 4px;
-moz-border-radius-topright: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}

View File

@ -73,8 +73,12 @@ function bartik_process_page(&$variables) {
* Implements hook_preprocess_maintenance_page().
*/
function bartik_preprocess_maintenance_page(&$variables) {
// By default, site_name is set to Drupal if no db connection is available
// or during site installation. Setting site_name to an empty string makes
// the site and update pages look cleaner.
// @see template_preprocess_maintenance_page
if (!$variables['db_is_active']) {
unset($variables['site_name']);
$variables['site_name'] = '';
}
drupal_add_css(drupal_get_path('theme', 'bartik') . '/css/maintenance-page.css');
}

View File

@ -304,10 +304,8 @@
line-height: 20px;
border-bottom: solid 1px #ccc;
-moz-border-radius-bottomleft: 0;
-webkit-border-bottom-left-radius: 0;
border-bottom-left-radius: 0;
-moz-border-radius-bottomright: 0;
-webkit-border-bottom-right-radius: 0;
border-bottom-right-radius: 0;
}
.ui-tabs .ui-tabs-nav li {
@ -319,7 +317,6 @@
float: none;
padding: 0 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
}
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a {
@ -366,7 +363,6 @@
border-right-color: #D2D2D2;
background: url(images/buttons.png) 0 0 repeat-x;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px;
}
.ui-dialog .ui-dialog-buttonpane button:active {
@ -398,7 +394,6 @@
border-right-color: #D2D2D2;
background: url(images/buttons.png) 0 0 repeat-x;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.ui-slider a.ui-state-active,

View File

@ -166,10 +166,6 @@ pre {
padding: 1px 10px 2px 10px; /* LTR */
text-decoration: none;
-moz-border-radius: 0 0 10px 10px;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 10px;
-webkit-border-bottom-right-radius: 10px;
border-radius: 0 0 10px 10px;
}
#skip-link a:hover,
@ -288,8 +284,6 @@ ul.primary li.active a {
border-style: solid;
border-color: #a6a7a2;
-moz-border-radius: 8px 8px 0 0;
-webkit-border-top-left-radius: 8px;
-webkit-border-top-right-radius: 8px;
border-radius: 8px 8px 0 0;
}
ul.primary li.active a,
@ -331,7 +325,6 @@ ul.secondary li.active a,
ul.secondary li.active a.active {
padding: 2px 10px;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
}
ul.secondary li a:hover,
@ -368,7 +361,6 @@ ul.secondary li.active a.active {
width: 80px;
overflow: hidden;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
#secondary-links ul.links li a:hover {
@ -663,7 +655,6 @@ a.button {
border-right-color: #d2d2d2;
background: url(images/buttons.png) 0 0 repeat-x;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px;
}
a.button:link,
@ -1003,6 +994,5 @@ div.add-or-remove-shortcuts {
background-color: #59a0d8;
color: #fff;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
}

View File

@ -148,7 +148,9 @@ function update_helpful_links() {
// NOTE: we can't use l() here because the URL would point to
// 'core/update.php?q=admin'.
$links[] = '<a href="' . base_path() . '">Front page</a>';
$links[] = '<a href="' . base_path() . '?q=admin">Administration pages</a>';
if (user_access('access administration pages')) {
$links[] = '<a href="' . base_path() . '?q=admin">Administration pages</a>';
}
return $links;
}
@ -158,7 +160,7 @@ function update_results_page() {
update_task_list();
// Report end result.
if (module_exists('dblog')) {
if (module_exists('dblog') && user_access('access site reports')) {
$log_message = ' All errors have been <a href="' . base_path() . '?q=admin/reports/dblog">logged</a>.';
}
else {
@ -166,7 +168,7 @@ function update_results_page() {
}
if ($_SESSION['update_success']) {
$output = '<p>Updates were attempted. If you see no failures below, you may proceed happily to the <a href="' . base_path() . '?q=admin">administration pages</a>. Otherwise, you may need to update your database manually.' . $log_message . '</p>';
$output = '<p>Updates were attempted. If you see no failures below, you may proceed happily back to your <a href="' . base_path() . '">site</a>. Otherwise, you may need to update your database manually.' . $log_message . '</p>';
}
else {
list($module, $version) = array_pop(reset($_SESSION['updates_remaining']));

View File

@ -4,3 +4,4 @@ package = Testing
version = VERSION
core = 8.x
hidden = TRUE
files[] = drupal_system_listing_compatible_test.test

View File

@ -0,0 +1,37 @@
<?php
/**
* Helper to verify tests in installation profile modules.
*/
class DrupalSystemListingCompatibleTestCase extends DrupalWebTestCase {
/**
* Use the Minimal profile.
*
* This test needs to use a different installation profile than the test which
* asserts that this test is found.
*
* @see SimpleTestInstallationProfileModuleTestsTestCase
*/
protected $profile = 'minimal';
public static function getInfo() {
return array(
'name' => 'Installation profile module tests helper',
'description' => 'Verifies that tests in installation profile modules are found and may use another profile for running tests.',
'group' => 'Installation profile',
);
}
function setUp() {
// Attempt to install a module in Testing profile, while this test runs with
// a different profile.
parent::setUp(array('drupal_system_listing_compatible_test'));
}
/**
* Non-empty test* method required to executed the test case class.
*/
function testDrupalSystemListing() {
$this->pass(__CLASS__ . ' test executed.');
}
}

View File

@ -73,11 +73,13 @@
* webserver. For most other drivers, you must specify a
* username, password, host, and database name.
*
* Some database engines support transactions. In order to enable
* transaction support for a given database, set the 'transactions' key
* to TRUE. To disable it, set it to FALSE. Note that the default value
* varies by driver. For MySQL, the default is FALSE since MyISAM tables
* do not support transactions.
* Transaction support is enabled by default for all drivers that support it,
* including MySQL. To explicitly disable it, set the 'transactions' key to
* FALSE.
* Note that some configurations of MySQL, such as the MyISAM engine, don't
* support it and will proceed silently even if enabled. If you experience
* transaction related crashes with such configuration, set the 'transactions'
* key to FALSE.
*
* For each database, you may optionally specify multiple "target" databases.
* A target database allows Drupal to try to send certain queries to a