ran security updates on contrib modules
ctools, video_embed_field, migrate, views_bulk_operations
This commit is contained in:
@@ -6,9 +6,9 @@ package = Chaos tool suite
|
||||
version = CTOOLS_MODULE_VERSION
|
||||
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-03-18
|
||||
version = "7.x-1.7"
|
||||
; Information added by Drupal.org packaging script on 2015-08-19
|
||||
version = "7.x-1.9"
|
||||
core = "7.x"
|
||||
project = "ctools"
|
||||
datestamp = "1426696183"
|
||||
datestamp = "1440020680"
|
||||
|
||||
|
@@ -9,9 +9,9 @@ files[] = includes/math-expr.inc
|
||||
files[] = includes/stylizer.inc
|
||||
files[] = tests/css_cache.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-03-18
|
||||
version = "7.x-1.7"
|
||||
; Information added by Drupal.org packaging script on 2015-08-19
|
||||
version = "7.x-1.9"
|
||||
core = "7.x"
|
||||
project = "ctools"
|
||||
datestamp = "1426696183"
|
||||
datestamp = "1440020680"
|
||||
|
||||
|
@@ -23,7 +23,7 @@ define('CTOOLS_API_VERSION', '2.0.8');
|
||||
* ; Requires CTools v7.x-1.4 or newer.
|
||||
* dependencies[] = ctools (>=1.4)
|
||||
*/
|
||||
define('CTOOLS_MODULE_VERSION', '7.x-1.7');
|
||||
define('CTOOLS_MODULE_VERSION', '7.x-1.9');
|
||||
|
||||
/**
|
||||
* Test the CTools API version.
|
||||
@@ -617,6 +617,27 @@ function ctools_registry_files_alter(&$files, $indexed_modules) {
|
||||
return _ctools_registry_files_alter($files, $indexed_modules);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// FAPI hooks that must be in the .module file.
|
||||
|
||||
/**
|
||||
* Alter the comment form to get a little more control over it.
|
||||
*/
|
||||
function ctools_form_comment_form_alter(&$form, &$form_state) {
|
||||
if (!empty($form_state['ctools comment alter'])) {
|
||||
// Force the form to post back to wherever we are.
|
||||
$form['#action'] = url($_GET['q'], array('fragment' => 'comment-form'));
|
||||
if (empty($form['#submit'])) {
|
||||
$form['#submit'] = array('comment_form_submit');
|
||||
}
|
||||
$form['#submit'][] = 'ctools_node_comment_form_submit';
|
||||
}
|
||||
}
|
||||
|
||||
function ctools_node_comment_form_submit(&$form, &$form_state) {
|
||||
$form_state['redirect'][0] = $_GET['q'];
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// CTools hook implementations.
|
||||
|
||||
@@ -1018,3 +1039,50 @@ function ctools_ctools_entity_context_alter(&$plugin, &$entity, $plugin_id) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_field_create_field().
|
||||
*/
|
||||
function ctools_field_create_field($field) {
|
||||
ctools_flush_field_caches();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_field_create_instance().
|
||||
*/
|
||||
function ctools_field_create_instance($instance) {
|
||||
ctools_flush_field_caches();
|
||||
}
|
||||
/**
|
||||
* Implements hook_field_delete_field().
|
||||
*/
|
||||
function ctools_field_delete_field($field) {
|
||||
ctools_flush_field_caches();
|
||||
}
|
||||
/**
|
||||
* Implements hook_field_delete_instance().
|
||||
*/
|
||||
function ctools_field_delete_instance($instance) {
|
||||
ctools_flush_field_caches();
|
||||
}
|
||||
/**
|
||||
* Implements hook_field_update_field().
|
||||
*/
|
||||
function ctools_field_update_field($field, $prior_field, $has_data) {
|
||||
ctools_flush_field_caches();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_field_update_instance().
|
||||
*/
|
||||
function ctools_field_update_instance($instance, $prior_instance) {
|
||||
ctools_flush_field_caches();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear field related caches.
|
||||
*/
|
||||
function ctools_flush_field_caches() {
|
||||
// Clear caches of 'Entity field' content type plugin.
|
||||
cache_clear_all('ctools_entity_field_content_type_content_types', 'cache');
|
||||
}
|
||||
|
@@ -5,9 +5,9 @@ package = Chaos tool suite
|
||||
version = CTOOLS_MODULE_VERSION
|
||||
dependencies[] = ctools
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-03-18
|
||||
version = "7.x-1.7"
|
||||
; Information added by Drupal.org packaging script on 2015-08-19
|
||||
version = "7.x-1.9"
|
||||
core = "7.x"
|
||||
project = "ctools"
|
||||
datestamp = "1426696183"
|
||||
datestamp = "1440020680"
|
||||
|
||||
|
@@ -5,9 +5,9 @@ version = CTOOLS_MODULE_VERSION
|
||||
dependencies[] = ctools
|
||||
core = 7.x
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-03-18
|
||||
version = "7.x-1.7"
|
||||
; Information added by Drupal.org packaging script on 2015-08-19
|
||||
version = "7.x-1.9"
|
||||
core = "7.x"
|
||||
project = "ctools"
|
||||
datestamp = "1426696183"
|
||||
datestamp = "1440020680"
|
||||
|
||||
|
@@ -524,7 +524,7 @@ function ctools_ajax_sample_wizard_next(&$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the 'finish' click on teh add/edit pane form wizard.
|
||||
* Handle the 'finish' click on the add/edit pane form wizard.
|
||||
*
|
||||
* All we need to do is set a flag so the return can handle adding
|
||||
* the pane.
|
||||
|
@@ -5,9 +5,9 @@ package = Chaos tool suite
|
||||
version = CTOOLS_MODULE_VERSION
|
||||
dependencies[] = ctools
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-03-18
|
||||
version = "7.x-1.7"
|
||||
; Information added by Drupal.org packaging script on 2015-08-19
|
||||
version = "7.x-1.9"
|
||||
core = "7.x"
|
||||
project = "ctools"
|
||||
datestamp = "1426696183"
|
||||
datestamp = "1440020680"
|
||||
|
||||
|
@@ -8,9 +8,9 @@ dependencies[] = page_manager
|
||||
dependencies[] = advanced_help
|
||||
core = 7.x
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-03-18
|
||||
version = "7.x-1.7"
|
||||
; Information added by Drupal.org packaging script on 2015-08-19
|
||||
version = "7.x-1.9"
|
||||
core = "7.x"
|
||||
project = "ctools"
|
||||
datestamp = "1426696183"
|
||||
datestamp = "1440020680"
|
||||
|
||||
|
@@ -341,7 +341,16 @@ function ctools_content_editable($type, $subtype, $conf) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ($function = ctools_plugin_get_function($subtype, 'check editable')) {
|
||||
$function = FALSE;
|
||||
|
||||
if (!empty($subtype['check editable'])) {
|
||||
$function = ctools_plugin_get_function($subtype, 'check editable');
|
||||
}
|
||||
elseif (!empty($type['check editable'])) {
|
||||
$function = ctools_plugin_get_function($type, 'check editable');
|
||||
}
|
||||
|
||||
if ($function) {
|
||||
return $function($type, $subtype, $conf);
|
||||
}
|
||||
|
||||
|
@@ -736,6 +736,15 @@ function ctools_edit_context_form_defaults($form, &$form_state) {
|
||||
'#default_value' => $conf['keyword'],
|
||||
);
|
||||
|
||||
if ($type_info['key'] == 'requiredcontexts') {
|
||||
$form['optional'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Context is optional'),
|
||||
'#default_value' => !empty($form_state['conf']['optional']),
|
||||
'#description' => t('This context need not be present for the component to function.'),
|
||||
);
|
||||
}
|
||||
|
||||
$form['#submit'][] = 'ctools_edit_context_form_defaults_submit';
|
||||
|
||||
return $form;
|
||||
@@ -752,6 +761,9 @@ function ctools_edit_context_form_defaults_submit(&$form, &$form_state) {
|
||||
$form_state['conf']['default'] = $form_state['values']['default'];
|
||||
$form_state['conf']['title'] = $form_state['values']['title'];
|
||||
}
|
||||
if ($form_state['type info']['key'] == 'requiredcontexts') {
|
||||
$form_state['conf']['optional'] = $form_state['values']['optional'];
|
||||
}
|
||||
|
||||
$form_state['conf']['identifier'] = $form_state['values']['identifier'];
|
||||
$form_state['conf']['keyword'] = $form_state['values']['keyword'];
|
||||
|
@@ -216,7 +216,7 @@ class ctools_context_optional extends ctools_context_required {
|
||||
$context = new ctools_context('any');
|
||||
$context->title = t('No context');
|
||||
$context->identifier = t('No context');
|
||||
$contexts = array_merge(array('empty' => $context), $contexts);
|
||||
$contexts['empty'] = $context;
|
||||
}
|
||||
|
||||
function filter($contexts) {
|
||||
@@ -1505,7 +1505,7 @@ function ctools_access($settings, $contexts = array()) {
|
||||
return TRUE;
|
||||
}
|
||||
else if (!$pass && $settings['logic'] == 'and') {
|
||||
// Fail if 'and' and htis rule failed.
|
||||
// Fail if 'and' and this rule failed.
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@@ -172,10 +172,12 @@ function ctools_css_cache($css, $filter = TRUE) {
|
||||
// @todo Is this slow? Does it matter if it is?
|
||||
$filename = $path . '/' . md5($css) . '.css';
|
||||
|
||||
// This will do renames if the file already exists, ensuring we don't
|
||||
// accidentally overwrite other files who share the same md5. Yes this
|
||||
// is a very miniscule chance but it's safe.
|
||||
$filename = file_unmanaged_save_data($css, $filename);
|
||||
// Generally md5 is considered unique enough to sign file downloads.
|
||||
// So this replaces already existing files based on the assumption that two
|
||||
// files with the same hash are identical content wise.
|
||||
// If we rename, the cache folder can potentially fill up with thousands of
|
||||
// files with the same content.
|
||||
$filename = file_unmanaged_save_data($css, $filename, FILE_EXISTS_REPLACE);
|
||||
|
||||
return $filename;
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ function ctools_jump_menu($form, &$form_state, $select, $options = array()) {
|
||||
'hide' => TRUE,
|
||||
);
|
||||
|
||||
ctools_add_js('jump-menu');
|
||||
$form['#attached']['js'][] = ctools_attach_js('jump-menu');
|
||||
|
||||
if (!empty($options['choose'])) {
|
||||
$select = array('' => $options['choose']) + $select;
|
||||
|
@@ -271,7 +271,7 @@ class ctools_math_expr {
|
||||
} elseif (in_array($op, $ops) and !$expecting_op) {
|
||||
return $this->trigger("unexpected operator '$op'");
|
||||
} else { // I don't even want to know what you did to get here
|
||||
return $this->trigger("an unexpected error occured");
|
||||
return $this->trigger("an unexpected error occurred");
|
||||
}
|
||||
if ($index == strlen($expr)) {
|
||||
if (in_array($op, $ops)) { // did we end with an operator? bad.
|
||||
|
@@ -66,6 +66,7 @@ function ctools_modal_add_js() {
|
||||
drupal_add_library('system', 'jquery.form');
|
||||
drupal_add_library('system', 'drupal.progress');
|
||||
drupal_add_library('system', 'drupal.ajax');
|
||||
drupal_add_library('system', 'ui');
|
||||
ctools_add_js('modal');
|
||||
|
||||
ctools_add_css('modal');
|
||||
|
@@ -79,7 +79,9 @@ function ctools_plugin_api_info($owner, $api, $minimum_version, $current_version
|
||||
}
|
||||
|
||||
// Only process if version is between minimum and current, inclusive.
|
||||
if (version_compare($version, $minimum_version, '>=') && version_compare($version, $current_version, '<=')) {
|
||||
if (($version == $minimum_version) || ($version == $current_version)
|
||||
|| (version_compare($version, $minimum_version, '>=')
|
||||
&& version_compare($version, $current_version, '<='))) {
|
||||
if (!isset($info['path'])) {
|
||||
$info['path'] = drupal_get_path('module', $module);
|
||||
}
|
||||
@@ -110,7 +112,7 @@ function ctools_plugin_api_info($owner, $api, $minimum_version, $current_version
|
||||
}
|
||||
|
||||
// Allow other modules to hook in.
|
||||
drupal_alter($hook, $cache[$owner][$api]);
|
||||
drupal_alter($hook, $cache[$owner][$api], $owner, $api);
|
||||
}
|
||||
|
||||
return $cache[$owner][$api];
|
||||
@@ -213,7 +215,7 @@ function ctools_plugin_api_get_hook($owner, $api) {
|
||||
*/
|
||||
function ctools_get_plugins($module, $type, $id = NULL) {
|
||||
// Store local caches of plugins and plugin info so we don't have to do full
|
||||
// lookups everytime.
|
||||
// lookups every time.
|
||||
static $drupal_static_fast;
|
||||
if (!isset($drupal_static_fast)) {
|
||||
$drupal_static_fast['plugins'] = &drupal_static('ctools_plugins', array());
|
||||
|
@@ -500,7 +500,7 @@ class ctools_stylizer_image_processor {
|
||||
$palette[$luminosity_input]['green'] = $green;
|
||||
$palette[$luminosity_input]['blue'] = $blue;
|
||||
|
||||
// Now we complete the palette, first we'll do it tothe black, and then to
|
||||
// Now we complete the palette, first we'll do it to the black, and then to
|
||||
// the white.
|
||||
|
||||
// From input to black
|
||||
|
@@ -25,7 +25,8 @@ function _ctools_uuid_generate_com() {
|
||||
* Generates an universally unique identifier using the PECL extension.
|
||||
*/
|
||||
function _ctools_uuid_generate_pecl() {
|
||||
return uuid_create(UUID_TYPE_DEFAULT);
|
||||
$uuid_type = UUID_TYPE_DEFAULT;
|
||||
return uuid_create($uuid_type);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -48,7 +48,8 @@
|
||||
modalOptions: {
|
||||
opacity: .55,
|
||||
background: '#fff'
|
||||
}
|
||||
},
|
||||
modalClass: 'default'
|
||||
};
|
||||
|
||||
var settings = {};
|
||||
@@ -97,8 +98,8 @@
|
||||
resize();
|
||||
|
||||
$('span.modal-title', Drupal.CTools.Modal.modal).html(Drupal.CTools.Modal.currentSettings.loadingText);
|
||||
Drupal.CTools.Modal.modalContent(Drupal.CTools.Modal.modal, settings.modalOptions, settings.animation, settings.animationSpeed);
|
||||
$('#modalContent .modal-content').html(Drupal.theme(settings.throbberTheme));
|
||||
Drupal.CTools.Modal.modalContent(Drupal.CTools.Modal.modal, settings.modalOptions, settings.animation, settings.animationSpeed, settings.modalClass);
|
||||
$('#modalContent .modal-content').html(Drupal.theme(settings.throbberTheme)).addClass('ctools-modal-loading');
|
||||
|
||||
// Position autocomplete results based on the scroll position of the modal.
|
||||
$('#modalContent .modal-content').delegate('input.form-autocomplete', 'keyup', function() {
|
||||
@@ -299,6 +300,17 @@
|
||||
// Attach behaviors within a modal dialog.
|
||||
var settings = response.settings || ajax.settings || Drupal.settings;
|
||||
Drupal.attachBehaviors('#modalContent', settings);
|
||||
|
||||
if ($('#modal-content').hasClass('ctools-modal-loading')) {
|
||||
$('#modal-content').removeClass('ctools-modal-loading');
|
||||
}
|
||||
else {
|
||||
// If the modal was already shown, and we are simply replacing its
|
||||
// content, then focus on the first focusable element in the modal.
|
||||
// (When first showing the modal, focus will be placed on the close
|
||||
// button by the show() function called above.)
|
||||
$('#modal-content :focusable:first').focus();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -349,8 +361,9 @@
|
||||
* @param css obj of css attributes
|
||||
* @param animation (fadeIn, slideDown, show)
|
||||
* @param speed (valid animation speeds slow, medium, fast or # in ms)
|
||||
* @param modalClass class added to div#modalContent
|
||||
*/
|
||||
Drupal.CTools.Modal.modalContent = function(content, css, animation, speed) {
|
||||
Drupal.CTools.Modal.modalContent = function(content, css, animation, speed, modalClass) {
|
||||
// If our animation isn't set, make it just show/pop
|
||||
if (!animation) {
|
||||
animation = 'show';
|
||||
@@ -402,9 +415,56 @@
|
||||
if( docHeight < winHeight ) docHeight = winHeight;
|
||||
|
||||
// Create our divs
|
||||
$('body').append('<div id="modalBackdrop" style="z-index: 1000; display: none;"></div><div id="modalContent" style="z-index: 1001; position: absolute;">' + $(content).html() + '</div>');
|
||||
$('body').append('<div id="modalBackdrop" class="backdrop-' + modalClass + '" style="z-index: 1000; display: none;"></div><div id="modalContent" class="modal-' + modalClass + '" style="z-index: 1001; position: absolute;">' + $(content).html() + '</div>');
|
||||
|
||||
// Keyboard and focus event handler ensures focus stays on modal elements only
|
||||
// Get a list of the tabbable elements in the modal content.
|
||||
var getTabbableElements = function () {
|
||||
var tabbableElements = $('#modalContent :tabbable'),
|
||||
radioButtons = tabbableElements.filter('input[type="radio"]');
|
||||
|
||||
// The list of tabbable elements from jQuery is *almost* right. The
|
||||
// exception is with groups of radio buttons. The list from jQuery will
|
||||
// include all radio buttons, when in fact, only the selected radio button
|
||||
// is tabbable, and if no radio buttons in a group are selected, then only
|
||||
// the first is tabbable.
|
||||
if (radioButtons.length > 0) {
|
||||
// First, build up an index of which groups have an item selected or not.
|
||||
var anySelected = {};
|
||||
radioButtons.each(function () {
|
||||
var name = this.name;
|
||||
|
||||
if (typeof anySelected[name] === 'undefined') {
|
||||
anySelected[name] = radioButtons.filter('input[name="' + name + '"]:checked').length !== 0;
|
||||
}
|
||||
});
|
||||
|
||||
// Next filter out the radio buttons that aren't really tabbable.
|
||||
var found = {};
|
||||
tabbableElements = tabbableElements.filter(function () {
|
||||
var keep = true;
|
||||
|
||||
if (this.type == 'radio') {
|
||||
if (anySelected[this.name]) {
|
||||
// Only keep the selected one.
|
||||
keep = this.checked;
|
||||
}
|
||||
else {
|
||||
// Only keep the first one.
|
||||
if (found[this.name]) {
|
||||
keep = false;
|
||||
}
|
||||
found[this.name] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return keep;
|
||||
});
|
||||
}
|
||||
|
||||
return tabbableElements.get();
|
||||
};
|
||||
|
||||
// Keyboard and focus event handler ensures only modal elements gain focus.
|
||||
modalEventHandler = function( event ) {
|
||||
target = null;
|
||||
if ( event ) { //Mozilla
|
||||
@@ -428,7 +488,7 @@
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
$('#modalContent').focus();
|
||||
getTabbableElements()[0].focus();
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
@@ -436,6 +496,59 @@
|
||||
$('body').bind( 'focus', modalEventHandler );
|
||||
$('body').bind( 'keypress', modalEventHandler );
|
||||
|
||||
// Keypress handler Ensures you can only TAB to elements within the modal.
|
||||
// Based on the psuedo-code from WAI-ARIA 1.0 Authoring Practices section
|
||||
// 3.3.1 "Trapping Focus".
|
||||
modalTabTrapHandler = function (evt) {
|
||||
// We only care about the TAB key.
|
||||
if (evt.which != 9) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var tabbableElements = getTabbableElements(),
|
||||
firstTabbableElement = tabbableElements[0],
|
||||
lastTabbableElement = tabbableElements[tabbableElements.length - 1],
|
||||
singleTabbableElement = firstTabbableElement == lastTabbableElement,
|
||||
node = evt.target;
|
||||
|
||||
// If this is the first element and the user wants to go backwards, then
|
||||
// jump to the last element.
|
||||
if (node == firstTabbableElement && evt.shiftKey) {
|
||||
if (!singleTabbableElement) {
|
||||
lastTabbableElement.focus();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// If this is the last element and the user wants to go forwards, then
|
||||
// jump to the first element.
|
||||
else if (node == lastTabbableElement && !evt.shiftKey) {
|
||||
if (!singleTabbableElement) {
|
||||
firstTabbableElement.focus();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// If this element isn't in the dialog at all, then jump to the first
|
||||
// or last element to get the user into the game.
|
||||
else if ($.inArray(node, tabbableElements) == -1) {
|
||||
// Make sure the node isn't in another modal (ie. WYSIWYG modal).
|
||||
var parents = $(node).parents().get();
|
||||
for (var i = 0; i < parents.length; ++i) {
|
||||
var position = $(parents[i]).css('position');
|
||||
if (position == 'absolute' || position == 'fixed') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (evt.shiftKey) {
|
||||
lastTabbableElement.focus();
|
||||
}
|
||||
else {
|
||||
firstTabbableElement.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
$('body').bind('keydown', modalTabTrapHandler);
|
||||
|
||||
// Create our content div, get the dimensions, and hide it
|
||||
var modalContent = $('#modalContent').css('top','-1000px');
|
||||
var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2);
|
||||
@@ -457,12 +570,19 @@
|
||||
|
||||
$(document).bind('keydown', modalEventEscapeCloseHandler);
|
||||
|
||||
// Per WAI-ARIA 1.0 Authoring Practices, initial focus should be on the
|
||||
// close button, but we should save the original focus to restore it after
|
||||
// the dialog is closed.
|
||||
var oldFocus = document.activeElement;
|
||||
$('.close').focus();
|
||||
|
||||
// Close the open modal content and backdrop
|
||||
function close() {
|
||||
// Unbind the events
|
||||
$(window).unbind('resize', modalContentResize);
|
||||
$('body').unbind( 'focus', modalEventHandler);
|
||||
$('body').unbind( 'keypress', modalEventHandler );
|
||||
$('body').unbind( 'keydown', modalTabTrapHandler );
|
||||
$('.close').unbind('click', modalContentClose);
|
||||
$('body').unbind('keypress', modalEventEscapeCloseHandler);
|
||||
$(document).trigger('CToolsDetachBehaviors', $('#modalContent'));
|
||||
@@ -478,12 +598,19 @@
|
||||
// Remove the content
|
||||
$('#modalContent').remove();
|
||||
$('#modalBackdrop').remove();
|
||||
|
||||
// Restore focus to where it was before opening the dialog
|
||||
$(oldFocus).focus();
|
||||
};
|
||||
|
||||
// Move and resize the modalBackdrop and modalContent on resize of the window
|
||||
modalContentResize = function(){
|
||||
// Move and resize the modalBackdrop and modalContent on window resize.
|
||||
modalContentResize = function(){
|
||||
|
||||
// position code lifted from http://www.quirksmode.org/viewport/compatibility.html
|
||||
// Reset the backdrop height/width to get accurate document size.
|
||||
$('#modalBackdrop').css('height', '').css('width', '');
|
||||
|
||||
// Position code lifted from:
|
||||
// http://www.quirksmode.org/viewport/compatibility.html
|
||||
if (self.pageYOffset) { // all except Explorer
|
||||
var wt = self.pageYOffset;
|
||||
} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
|
||||
@@ -509,8 +636,6 @@
|
||||
modalContent.css('top', mdcTop + 'px').css('left', mdcLeft + 'px').show();
|
||||
};
|
||||
$(window).bind('resize', modalContentResize);
|
||||
|
||||
$('#modalContent').focus();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -533,7 +658,9 @@
|
||||
$(window).unbind('resize', modalContentResize);
|
||||
$('body').unbind('focus', modalEventHandler);
|
||||
$('body').unbind('keypress', modalEventHandler);
|
||||
$('body').unbind( 'keydown', modalTabTrapHandler );
|
||||
$('.close').unbind('click', modalContentClose);
|
||||
$('body').unbind('keypress', modalEventEscapeCloseHandler);
|
||||
$(document).trigger('CToolsDetachBehaviors', $('#modalContent'));
|
||||
|
||||
// jQuery magic loop through the instances and run the animations or removal.
|
||||
|
43
sites/all/modules/contrib/dev/ctools/js/states-show.js
Normal file
43
sites/all/modules/contrib/dev/ctools/js/states-show.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* @file
|
||||
* Custom state for handling visibility
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add a new state to Drupal #states. We use this to toggle element-invisible
|
||||
* to show/hidden #states elements. This allows elements to be visible to
|
||||
* screen readers.
|
||||
*
|
||||
* To use:
|
||||
* $form['my_form_field'] = array(
|
||||
* ..
|
||||
* // Only show this field if 'some_other_field' is checked.
|
||||
* '#states => array(
|
||||
* 'show' => array(
|
||||
* 'some-other-field' => array('checked' => TRUE),
|
||||
* ),
|
||||
* ),
|
||||
* ..
|
||||
* // Required to load the 'show' state handler.
|
||||
* '#attached' => array(
|
||||
* 'js' => array(ctools_attach_js('states-show')),
|
||||
* ),
|
||||
* );
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
Drupal.states.State.aliases.hidden = '!show';
|
||||
|
||||
// Show/hide form items by toggling the 'element-invisible' class. This is a
|
||||
// more accessible option than the core 'visible' state.
|
||||
$(document).bind('state:show', function(e) {
|
||||
if (e.trigger) {
|
||||
var element = $(e.target).closest('.form-item, .form-submit, .form-wrapper');
|
||||
element.toggle(e.value);
|
||||
e.value === true ? element.removeClass('element-invisible') : element.addClass('element-invisible');
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
@@ -5,9 +5,9 @@ dependencies[] = ctools
|
||||
package = Chaos tool suite
|
||||
version = CTOOLS_MODULE_VERSION
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-03-18
|
||||
version = "7.x-1.7"
|
||||
; Information added by Drupal.org packaging script on 2015-08-19
|
||||
version = "7.x-1.9"
|
||||
core = "7.x"
|
||||
project = "ctools"
|
||||
datestamp = "1426696183"
|
||||
datestamp = "1440020680"
|
||||
|
||||
|
@@ -440,13 +440,18 @@ function page_manager_cache_load($task_name) {
|
||||
*/
|
||||
function page_manager_handler_get_name($task_name, $handlers, $handler) {
|
||||
$base = str_replace('-', '_', $task_name);
|
||||
$name = '';
|
||||
|
||||
// Optional machine name.
|
||||
if (!empty($handler->conf['name'])) {
|
||||
$name = $base . '__' . $handler->conf['name'];
|
||||
if (count(ctools_export_load_object('page_manager_handlers', 'names', array($name)))) {
|
||||
$name = '';
|
||||
}
|
||||
}
|
||||
|
||||
// If no machine name was provided, generate a unique name.
|
||||
else {
|
||||
// If no machine name was provided or the name is in use, generate a unique name.
|
||||
if (empty($name)) {
|
||||
$base .= '__' . $handler->handler;
|
||||
|
||||
// Use the ctools uuid generator to generate a unique id.
|
||||
@@ -472,6 +477,10 @@ function page_manager_handler_add_to_page(&$page, &$handler, $title = NULL) {
|
||||
|
||||
if ($title) {
|
||||
$handler->conf['title'] = $title;
|
||||
$handler->conf['name'] = trim(preg_replace('/[^a-z0-9_]+/', '-', strtolower($title)), '-');
|
||||
}
|
||||
else {
|
||||
$handler->conf['name'] = '';
|
||||
}
|
||||
|
||||
$name = page_manager_handler_get_name($page->task_name, $page->handlers, $handler);
|
||||
|
@@ -108,7 +108,7 @@ function page_manager_node_edit($node) {
|
||||
* Callback to handle the process of adding a node.
|
||||
*
|
||||
* This creates a basic $node and passes that off to page_manager_node_edit().
|
||||
* It is modeled after Drupal's node_add() function.
|
||||
* It is modelled after Drupal's node_add() function.
|
||||
*
|
||||
* Unlike node_add() we do not need to check node_access because that was
|
||||
* already checked by the menu system.
|
||||
|
@@ -78,10 +78,6 @@ function page_manager_node_view_menu_alter(&$items, $task) {
|
||||
* node view, which is node_page_view().
|
||||
*/
|
||||
function page_manager_node_view_page($node) {
|
||||
// Prep the node to be displayed so all of the regular hooks are triggered.
|
||||
// Also save the output for later, in case it is needed.
|
||||
$default_output = node_page_view($node);
|
||||
|
||||
// Load my task plugin
|
||||
$task = page_manager_get_task('node_view');
|
||||
|
||||
@@ -107,6 +103,9 @@ function page_manager_node_view_page($node) {
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare the node to be displayed so all of the regular hooks are triggered.
|
||||
$default_output = node_page_view($node);
|
||||
|
||||
// Otherwise, fall back to the default output generated by node_page_view().
|
||||
return $default_output;
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ function page_manager_page_menu(&$items, $task) {
|
||||
}
|
||||
|
||||
$path = array();
|
||||
$page_arguments = array($subtask_id);
|
||||
$page_arguments = array((string) $subtask_id);
|
||||
$access_arguments = array($subtask->access);
|
||||
$load_arguments = array($subtask_id, '%index', '%map');
|
||||
|
||||
@@ -566,7 +566,7 @@ function page_manager_page_form_basic_validate(&$form, &$form_state) {
|
||||
if (strpos($path, '%') === FALSE) {
|
||||
$alias = db_query('SELECT alias, source FROM {url_alias} WHERE alias = :path', array(':path' => $path))->fetchObject();
|
||||
if ($alias) {
|
||||
form_error($form['path'], t('That path is currently assigned to be an alias for @alias. This system cannot override existing aliases.', array('@alias' => $alias->src)));
|
||||
form_error($form['path'], t('That path is currently assigned to be an alias for @alias. This system cannot override existing aliases.', array('@alias' => $alias->source)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
$plugin = array(
|
||||
'single' => TRUE,
|
||||
'title' => t('Comment created date'),
|
||||
'icon' => 'icon_comment.png',
|
||||
'description' => t('The date the referenced comment was created.'),
|
||||
'required context' => new ctools_context_required(t('Comment'), 'entity:comment'),
|
||||
'category' => t('Comment'),
|
||||
'defaults' => array(
|
||||
'format' => 'small',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Render the custom content type.
|
||||
*/
|
||||
function ctools_comment_created_content_type_render($subtype, $conf, $panel_args, $context) {
|
||||
if (empty($context) || empty($context->data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get a shortcut to the comment.
|
||||
$comment = $context->data;
|
||||
|
||||
// Build the content type block.
|
||||
$block = new stdClass();
|
||||
$block->module = 'comment_created';
|
||||
$block->title = t('Created date');
|
||||
$block->content = format_date($comment->created, $conf['format']);
|
||||
$block->delta = $comment->cid;
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an edit form for custom type settings.
|
||||
*/
|
||||
function ctools_comment_created_content_type_edit_form($form, &$form_state) {
|
||||
$conf = $form_state['conf'];
|
||||
$date_types = array();
|
||||
|
||||
foreach (system_get_date_types() as $date_type => $definition) {
|
||||
$date_types[$date_type] = format_date(REQUEST_TIME, $date_type);
|
||||
}
|
||||
$form['format'] = array(
|
||||
'#title' => t('Date format'),
|
||||
'#type' => 'select',
|
||||
'#options' => $date_types,
|
||||
'#default_value' => $conf['format'],
|
||||
);
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit handler for the custom type settings form.
|
||||
*/
|
||||
function ctools_comment_created_content_type_edit_form_submit($form, &$form_state) {
|
||||
// Copy everything from our defaults.
|
||||
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
||||
$form_state['conf'][$key] = $form_state['values'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the administrative title for a type.
|
||||
*/
|
||||
function ctools_comment_created_content_type_admin_title($subtype, $conf, $context) {
|
||||
return t('"@s" created date', array('@s' => $context->identifier));
|
||||
}
|
@@ -34,6 +34,14 @@ function ctools_entity_field_content_type_content_types() {
|
||||
return $types;
|
||||
}
|
||||
|
||||
$cache_key = 'ctools_entity_field_content_type_content_types';
|
||||
if ($cache = cache_get($cache_key)) {
|
||||
$types = $cache->data;
|
||||
if (!empty($types)) {
|
||||
return $types;
|
||||
}
|
||||
}
|
||||
|
||||
// This will hold all the individual field content types.
|
||||
$context_types = array();
|
||||
$entities = entity_get_info();
|
||||
@@ -82,6 +90,8 @@ function ctools_entity_field_content_type_content_types() {
|
||||
unset($context_types[$key]['types']);
|
||||
}
|
||||
|
||||
cache_set($cache_key, $types);
|
||||
|
||||
return $types;
|
||||
}
|
||||
|
||||
|
@@ -57,6 +57,26 @@ function ctools_entity_form_field_content_type_content_types() {
|
||||
}
|
||||
}
|
||||
|
||||
if (module_exists('field_group')) {
|
||||
foreach ($entities as $entity_type => $entity) {
|
||||
foreach ($entity['bundles'] as $type => $bundle) {
|
||||
if ($group_info = field_group_info_groups($entity_type, $type, "form")) {
|
||||
foreach ($group_info as $group_name => $group) {
|
||||
if (!isset($types[$entity_type . ':' . $group_name])) {
|
||||
$types[$entity_type . ':' . $group_name] = array(
|
||||
'category' => t('Form'),
|
||||
'icon' => 'icon_field.png',
|
||||
'title' => t('Group form: @widget_label', array('@widget_label' => $group->label)),
|
||||
'description' => t('Field group on the referenced entity.'),
|
||||
);
|
||||
}
|
||||
$content_types[$entity_type . ':' . $group_name]['types'][$type] = $bundle['label'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create the required context for each field related to the bundle types.
|
||||
foreach ($types as $key => $field_content_type) {
|
||||
list($entity_type, $field_name) = explode(':', $key, 2);
|
||||
@@ -85,16 +105,38 @@ function ctools_entity_form_field_content_type_render($subtype, $conf, $panel_ar
|
||||
$ids = entity_extract_ids($entity_type, $entity);
|
||||
$field = field_info_instance($entity_type, $field_name, $ids[2]);
|
||||
|
||||
// Do not render if the entity type does not have this field.
|
||||
if (empty($field)) {
|
||||
// Check for field groups.
|
||||
if (empty($field) && module_exists('field_group')) {
|
||||
$groups = field_group_info_groups($entity_type, $entity->type, "form");
|
||||
$group = !empty($groups[$field_name]) ? $groups[$field_name] : NULL;
|
||||
}
|
||||
|
||||
// Do not render if the entity type does not have this field or group.
|
||||
if (empty($field) && empty($group)) {
|
||||
return;
|
||||
}
|
||||
$block = new stdClass();
|
||||
|
||||
$block = new stdClass();
|
||||
if (isset($context->form)) {
|
||||
$block->content = array();
|
||||
$block->content[$field_name] = $context->form[$field_name];
|
||||
unset($context->form[$field_name]);
|
||||
if (!empty($field)) {
|
||||
$block->content[$field_name] = $context->form[$field_name];
|
||||
unset($context->form[$field_name]);
|
||||
}
|
||||
else {
|
||||
// Pre-render the form to populate field groups.
|
||||
if (isset($context->form['#pre_render'])) {
|
||||
foreach ($context->form['#pre_render'] as $function) {
|
||||
if (function_exists($function)) {
|
||||
$context->form = $function($context->form);
|
||||
}
|
||||
}
|
||||
unset($context->form['#pre_render']);
|
||||
}
|
||||
|
||||
$block->content[$field_name] = $context->form[$field_name];
|
||||
unset($context->form[$field_name]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$block->content = t('Entity info.');
|
||||
|
@@ -77,20 +77,3 @@ function ctools_node_comment_form_content_type_edit_form_submit($form, &$form_st
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Alter the comment form to get a little more control over it.
|
||||
*/
|
||||
function ctools_form_comment_form_alter(&$form, &$form_state) {
|
||||
if (!empty($form_state['ctools comment alter'])) {
|
||||
// Force the form to post back to wherever we are.
|
||||
$form['#action'] = url($_GET['q'], array('fragment' => 'comment-form'));
|
||||
if (empty($form['#submit'])) {
|
||||
$form['#submit'] = array('comment_form_submit');
|
||||
}
|
||||
$form['#submit'][] = 'ctools_node_comment_form_submit';
|
||||
}
|
||||
}
|
||||
|
||||
function ctools_node_comment_form_submit(&$form, &$form_state) {
|
||||
$form_state['redirect'][0] = $_GET['q'];
|
||||
}
|
||||
|
@@ -29,6 +29,9 @@ $plugin = array(
|
||||
* Outputs the page title of the current page.
|
||||
*/
|
||||
function ctools_page_title_content_type_render($subtype, $conf, $panel_args) {
|
||||
if (!drupal_get_title()) {
|
||||
return;
|
||||
}
|
||||
// TODO: This should have a setting or something for the markup.
|
||||
if (empty($conf['markup'])) {
|
||||
$conf['markup'] = 'h1';
|
||||
|
@@ -18,8 +18,8 @@ function ctools_term_description_content_type_render($subtype, $conf, $panel_arg
|
||||
$block = new stdClass();
|
||||
$block->module = 'node_type';
|
||||
|
||||
$block->title = $term->name;
|
||||
if ($term) {
|
||||
if (!empty($term)) {
|
||||
$block->title = $term->name;
|
||||
$block->content = check_markup($term->description, $term->format, '', TRUE);
|
||||
$block->delta = $term->tid;
|
||||
|
||||
@@ -33,6 +33,7 @@ function ctools_term_description_content_type_render($subtype, $conf, $panel_arg
|
||||
}
|
||||
}
|
||||
else {
|
||||
$block->title = '';
|
||||
$block->content = t('Term description goes here.');
|
||||
$block->delta = 'unknown';
|
||||
}
|
||||
|
@@ -43,7 +43,9 @@ function ctools_context_create_user($empty, $data = NULL, $conf = FALSE) {
|
||||
if ($data['type'] == 'current') {
|
||||
global $user;
|
||||
$data = user_load($user->uid);
|
||||
$data->logged_in_user = TRUE;
|
||||
if (user_is_logged_in()) {
|
||||
$data->logged_in_user = TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$data = user_load($data['uid']);
|
||||
|
@@ -34,15 +34,15 @@ function ctools_context_create_user_edit_form($empty, $user = NULL, $conf = FALS
|
||||
$category = !empty($conf['category']) ? $conf['category'] : FALSE;
|
||||
unset($conf['category']);
|
||||
|
||||
// If no category was specified, use the default 'account'.
|
||||
if (!$category) {
|
||||
$category = 'account';
|
||||
}
|
||||
// Return previously created contexts, per category.
|
||||
static $created = array();
|
||||
if (!empty($created[$category])) {
|
||||
return $created[$category];
|
||||
}
|
||||
// If no category was specified, use the default 'account'.
|
||||
if (!$category) {
|
||||
$category = 'account';
|
||||
}
|
||||
|
||||
$context = new ctools_context(array('form', 'user_edit', 'user_form', 'user_edit_form', 'user', 'entity:user'));
|
||||
// Store this context for later.
|
||||
|
@@ -724,7 +724,13 @@ class ctools_export_ui {
|
||||
// Export the handler, which is a fantastic way to clean database IDs out of it.
|
||||
$export = ctools_export_crud_export($this->plugin['schema'], $original);
|
||||
$item = ctools_export_crud_import($this->plugin['schema'], $export);
|
||||
$item->{$this->plugin['export']['key']} = 'clone_of_' . $item->{$this->plugin['export']['key']};
|
||||
|
||||
if (!empty($input[$this->plugin['export']['key']])) {
|
||||
$item->{$this->plugin['export']['key']} = $input[$this->plugin['export']['key']];
|
||||
}
|
||||
else {
|
||||
$item->{$this->plugin['export']['key']} = 'clone_of_' . $item->{$this->plugin['export']['key']};
|
||||
}
|
||||
}
|
||||
|
||||
// Tabs and breadcrumb disappearing, this helps alleviate through cheating.
|
||||
|
@@ -185,7 +185,7 @@ function ctools_entity_from_field_context($context, $conf) {
|
||||
$loaded_to_entity = array_shift($loaded_to_entity);
|
||||
|
||||
// Pass current user account and entity type to access callback.
|
||||
if (function_exists($to_entity_info['access callback']) && !call_user_func($to_entity_info['access callback'], 'view', $loaded_to_entity, $account, $to_entity)) {
|
||||
if (isset($to_entity_info['access callback']) && function_exists($to_entity_info['access callback']) && !call_user_func($to_entity_info['access callback'], 'view', $loaded_to_entity)) {
|
||||
return ctools_context_create_empty('entity:' . $to_entity, NULL);
|
||||
}
|
||||
else {
|
||||
|
@@ -6,9 +6,9 @@ version = CTOOLS_MODULE_VERSION
|
||||
dependencies[] = ctools
|
||||
dependencies[] = color
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-03-18
|
||||
version = "7.x-1.7"
|
||||
; Information added by Drupal.org packaging script on 2015-08-19
|
||||
version = "7.x-1.9"
|
||||
core = "7.x"
|
||||
project = "ctools"
|
||||
datestamp = "1426696183"
|
||||
datestamp = "1440020680"
|
||||
|
||||
|
@@ -5,9 +5,9 @@ dependencies[] = ctools
|
||||
package = Chaos tool suite
|
||||
version = CTOOLS_MODULE_VERSION
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-03-18
|
||||
version = "7.x-1.7"
|
||||
; Information added by Drupal.org packaging script on 2015-08-19
|
||||
version = "7.x-1.9"
|
||||
core = "7.x"
|
||||
project = "ctools"
|
||||
datestamp = "1426696183"
|
||||
datestamp = "1440020680"
|
||||
|
||||
|
@@ -8,9 +8,9 @@ hidden = TRUE
|
||||
|
||||
files[] = ctools_export.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-03-18
|
||||
version = "7.x-1.7"
|
||||
; Information added by Drupal.org packaging script on 2015-08-19
|
||||
version = "7.x-1.9"
|
||||
core = "7.x"
|
||||
project = "ctools"
|
||||
datestamp = "1426696183"
|
||||
datestamp = "1440020680"
|
||||
|
||||
|
@@ -12,9 +12,9 @@ files[] = math_expression.test
|
||||
files[] = math_expression_stack.test
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-03-18
|
||||
version = "7.x-1.7"
|
||||
; Information added by Drupal.org packaging script on 2015-08-19
|
||||
version = "7.x-1.9"
|
||||
core = "7.x"
|
||||
project = "ctools"
|
||||
datestamp = "1426696183"
|
||||
datestamp = "1440020680"
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* A cached plugin object that tests inheritence including.
|
||||
* A cached plugin object that tests inheritance including.
|
||||
*/
|
||||
|
||||
class ctoolsCachedPluginArray {}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* A cached plugin object that tests inheritence including.
|
||||
* A cached plugin object that tests inheritance including.
|
||||
*/
|
||||
|
||||
class ctoolsCachedPluginArray2 extends ctoolsCachedPluginArray {}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* A cached plugin object that tests inheritence including.
|
||||
* A cached plugin object that tests inheritance including.
|
||||
*/
|
||||
|
||||
class ctoolsNotCachedPluginArray extends ctoolsNotCachedPluginArray2 {}
|
||||
|
@@ -10,9 +10,9 @@ files[] = plugins/views/views_content_plugin_display_ctools_context.inc
|
||||
files[] = plugins/views/views_content_plugin_display_panel_pane.inc
|
||||
files[] = plugins/views/views_content_plugin_style_ctools_context.inc
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-03-18
|
||||
version = "7.x-1.7"
|
||||
; Information added by Drupal.org packaging script on 2015-08-19
|
||||
version = "7.x-1.9"
|
||||
core = "7.x"
|
||||
project = "ctools"
|
||||
datestamp = "1426696183"
|
||||
datestamp = "1440020680"
|
||||
|
||||
|
Reference in New Issue
Block a user