diff --git a/sites/all/modules/ctools/API.txt b/sites/all/modules/ctools/API.txt index 29000a48b8aee0663c504a0512ee693a6fd9f03a..fe208a8e941563f406c699f8832c46591026e5d9 100644 --- a/sites/all/modules/ctools/API.txt +++ b/sites/all/modules/ctools/API.txt @@ -9,7 +9,8 @@ API Version 2.0.1 ctools_export_crud_set_status() and requisite changes. Introduce 'object factory' to export schema, allowing modules to control how the exportable objects are instantiated. - + Introduce 'hook_ctools_math_expression_functions_alter'. + API Version 2.0 Remove the deprecated callback-based behavior of the 'defaults' property on plugin types; array addition is now the only option. If you need more diff --git a/sites/all/modules/ctools/bulk_export/bulk_export.info b/sites/all/modules/ctools/bulk_export/bulk_export.info index 7e17fd735148f09ac1c1fa57de335d9ac21a0e1f..f01bb3704ff705f6597cd0a77a9a398cdc05bf86 100644 --- a/sites/all/modules/ctools/bulk_export/bulk_export.info +++ b/sites/all/modules/ctools/bulk_export/bulk_export.info @@ -4,9 +4,9 @@ core = 7.x dependencies[] = ctools package = Chaos tool suite -; Information added by drupal.org packaging script on 2011-05-31 -version = "7.x-1.0-beta1" +; Information added by drupal.org packaging script on 2011-07-28 +version = "7.x-1.0-rc1" core = "7.x" project = "ctools" -datestamp = "1306885315" +datestamp = "1311894415" diff --git a/sites/all/modules/ctools/ctools.api.php b/sites/all/modules/ctools/ctools.api.php index 8e74d06b010b56bcc74dcabd5b19e854b0e18b40..b6a3cd9203b44d5c703d3c8d51d3278d180334ca 100644 --- a/sites/all/modules/ctools/ctools.api.php +++ b/sites/all/modules/ctools/ctools.api.php @@ -117,6 +117,21 @@ function hook_ctools_plugin_post_alter(&$plugin, &$info) { } } + +/** + * Alter the available functions to be used in ctools math expression api. + * + * One usecase would be to create your own function in your module and + * allow to use it in the math expression api. + * + * @param $functions + * An array which has the functions as value. + */ +function hook_ctools_math_expression_functions_alter(&$functions) { + // Allow to convert from degrees to radiant. + $functions[] = 'deg2rad'; +} + /** * @} End of "addtogroup hooks". */ diff --git a/sites/all/modules/ctools/ctools.info b/sites/all/modules/ctools/ctools.info index 08b7887757d11b4be2fcfbb727f040a990471ee6..4d3007b245d064812ae6ab8d8710328ee2de0c50 100644 --- a/sites/all/modules/ctools/ctools.info +++ b/sites/all/modules/ctools/ctools.info @@ -6,9 +6,9 @@ files[] = includes/context.inc files[] = includes/math-expr.inc files[] = includes/stylizer.inc -; Information added by drupal.org packaging script on 2011-05-31 -version = "7.x-1.0-beta1" +; Information added by drupal.org packaging script on 2011-07-28 +version = "7.x-1.0-rc1" core = "7.x" project = "ctools" -datestamp = "1306885315" +datestamp = "1311894415" diff --git a/sites/all/modules/ctools/ctools.module b/sites/all/modules/ctools/ctools.module index 7b7499eecfb9087082d1641f7de432fe55ba2a5e..01156f9b7f13cab937d322424e06db90dfc22d4f 100644 --- a/sites/all/modules/ctools/ctools.module +++ b/sites/all/modules/ctools/ctools.module @@ -760,7 +760,7 @@ function ctools_block_list_alter(&$blocks) { foreach ($blocks as $block_id => $block) { // @todo -- possibly we can set configuration for this so that users can // specify which blocks will not get rendered. - if (substr_compare($block->region, 'sidebar', 0) >= 0) { + if (strpos($block->region, 'sidebar') !== FALSE) { unset($blocks[$block_id]); } } diff --git a/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.info b/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.info index b1af3988b172eaace230f2e9a8a3543601a010dc..c73784f5fac704b80952eba9264f42f0ce56c362 100644 --- a/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.info +++ b/sites/all/modules/ctools/ctools_access_ruleset/ctools_access_ruleset.info @@ -4,9 +4,9 @@ core = 7.x package = Chaos tool suite dependencies[] = ctools -; Information added by drupal.org packaging script on 2011-05-31 -version = "7.x-1.0-beta1" +; Information added by drupal.org packaging script on 2011-07-28 +version = "7.x-1.0-rc1" core = "7.x" project = "ctools" -datestamp = "1306885315" +datestamp = "1311894415" diff --git a/sites/all/modules/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css b/sites/all/modules/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css index dc83b0b0f95e0350306f28f02cc43315fdcd61f5..8df17de5fc25c449a3d5a4fba09bf2407478a252 100644 --- a/sites/all/modules/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css +++ b/sites/all/modules/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css @@ -47,6 +47,7 @@ div.ctools-sample-modal-content .popups-box tr { div.ctools-sample-modal-content td.popups-border { background: url(../images/popups-border.png); background-color:transparent; + border: none; } div.ctools-sample-modal-content td.popups-tl, div.ctools-sample-modal-content td.popups-tr, @@ -61,9 +62,8 @@ div.ctools-sample-modal-content td.popups-t, div.ctools-sample-modal-content td.popups-b { background-position: 0px -40px; background-repeat: repeat-x; - height:10px; } -div.ctools-sample-modal-content td.popups-tr { background-position: 0px -10px; } +div.ctools-sample-modal-content td.popups-tr { background-position: 0px -10px; width: 10px; } div.ctools-sample-modal-content td.popups-cl, div.ctools-sample-modal-content td.popups-cr { background-position: -10px 0; @@ -72,10 +72,10 @@ div.ctools-sample-modal-content td.popups-cr { } div.ctools-sample-modal-content td.popups-cl, div.ctools-sample-modal-content td.popups-cr, -div.ctools-sample-modal-content td.popups-c { padding:0; } +div.ctools-sample-modal-content td.popups-c { padding:0; border: none; } div.ctools-sample-modal-content td.popups-c { background:#fff; } div.ctools-sample-modal-content td.popups-bl { background-position: 0px -20px; } -div.ctools-sample-modal-content td.popups-br { background-position: 0px -30px; } +div.ctools-sample-modal-content td.popups-br { background-position: 0px -30px; width: 10px; } div.ctools-sample-modal-content .popups-box, div.ctools-sample-modal-content #popups-loading { diff --git a/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.info b/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.info index 1f1159be396969d9594e56cae59d056ec75ee8fe..6ae89078448024841f34405e8be5d251d3a82e62 100644 --- a/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.info +++ b/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.info @@ -4,9 +4,9 @@ package = Chaos tool suite dependencies[] = ctools core = 7.x -; Information added by drupal.org packaging script on 2011-05-31 -version = "7.x-1.0-beta1" +; Information added by drupal.org packaging script on 2011-07-28 +version = "7.x-1.0-rc1" core = "7.x" project = "ctools" -datestamp = "1306885315" +datestamp = "1311894415" diff --git a/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.module b/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.module index 463e4a8060ba735c9625735a907f0e068a22cbe0..2a30c2a5638f87db7e3bc826b81679e7384e6571 100644 --- a/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.module +++ b/sites/all/modules/ctools/ctools_ajax_sample/ctools_ajax_sample.module @@ -561,6 +561,7 @@ function ctools_ajax_sample_start($form, &$form_state) { '#default_value' => $form_state['object']->type, '#required' => TRUE, ); + return $form; } @@ -738,8 +739,10 @@ function ctools_ajax_sample_ajax_button_form() { $form['url'] = array( '#type' => 'hidden', + // The name of the class is the #id of $form['ajax_button'] with "-url" + // suffix. '#attributes' => array('class' => array('ctools-ajax-sample-button-url')), - '#value' => 'ctools_ajax_sample/nojs/animal', + '#value' => url('ctools_ajax_sample/nojs/animal'), ); $form['ajax_button'] = array( diff --git a/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.info b/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.info index 09e989876387b0784ea31bb036f6244240db48f4..53a21eeab33e3dc883d75c95a650e822afd71f2d 100644 --- a/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.info +++ b/sites/all/modules/ctools/ctools_custom_content/ctools_custom_content.info @@ -4,9 +4,9 @@ core = 7.x package = Chaos tool suite dependencies[] = ctools -; Information added by drupal.org packaging script on 2011-05-31 -version = "7.x-1.0-beta1" +; Information added by drupal.org packaging script on 2011-07-28 +version = "7.x-1.0-rc1" core = "7.x" project = "ctools" -datestamp = "1306885315" +datestamp = "1311894415" diff --git a/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.info b/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.info index b6ba31ede434abe42cbc410560e68e1341e2f173..7ce5305c247e175ec02cd3d21da74fb014272442 100644 --- a/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.info +++ b/sites/all/modules/ctools/ctools_plugin_example/ctools_plugin_example.info @@ -7,9 +7,9 @@ dependencies[] = page_manager dependencies[] = advanced_help core = 7.x -; Information added by drupal.org packaging script on 2011-05-31 -version = "7.x-1.0-beta1" +; Information added by drupal.org packaging script on 2011-07-28 +version = "7.x-1.0-rc1" core = "7.x" project = "ctools" -datestamp = "1306885315" +datestamp = "1311894415" diff --git a/sites/all/modules/ctools/help/export.html b/sites/all/modules/ctools/help/export.html index 350190296532de8a5c7475c5b33ceda0b3db48e2..234ef15275eebaefdef5e859092b774ef1c66d42 100644 --- a/sites/all/modules/ctools/help/export.html +++ b/sites/all/modules/ctools/help/export.html @@ -117,6 +117,12 @@ function mymodule_schema() { <dt>object factory</dt> <dd>Function used to create the object. The function receives the schema and the loaded data as a parameters: your_factory_function($schema, $data). If this is set, 'object' has no effect since you can use your function to create whatever class you wish.</dd> +<dt>admin_title</dt> +<dd>A convenience field that may contain the field which represents the human readable administrative title for use in export UI. If a field "admin_title" exists, it will automatically be used.</dd> + +<dt>admin_description</dt> +<dd>A convenience field that may contain the field which represents the human readable administrative title for use in export UI. If a field "admin_title" exists, it will automatically be used.</dd> + <dt>can disable</dt> <dd>Control whether or not the exportable objects can be disabled. All this does is cause the 'disabled' field on the object to always be set appropriately, and a variable is kept to record the state. Changes made to this state must be handled by the owner of the object. Defaults to TRUE.</dd> @@ -146,7 +152,7 @@ function mymodule_schema() { <dt>to hook code callback</dt> <dd>Function used to generate an export for the bulk export process. This is only necessary if the export is more complicated than simply listing the fields. Defaults to $module . '_' . $table . '_to_hook_code'.</dt> -</dl> + <dt>create callback</dt> <dd>CRUD callback to use to create a new exportable item in memory. If not provided, the default function will be used. The single argument is a boolean used to determine if defaults should be set on the object. This object will not be written to the database by this callback.</dd> @@ -172,6 +178,25 @@ function mymodule_schema() { <dt>status callback</dt> <dd>CRUD callback to use for updating the status of an object. If the status is TRUE the object will be disabled. If the status is FALSE the object will be enabled.</dd> +<dt>api</dt> +<dd>The 'api' key can optionally contain some information for the plugin API definition. This means that the imports can be tied to an API name which is used to have automatic inclusion of files, and can be used to prevent dangerous objects from older versions from being loaded, causing a loss of functionality rather than site crashes or security loopholes. + +If not present, no additional files will be loaded and the default hook will always be a simple hook that must be either part of the .module file or loaded during normal operations. + +api supports these subkeys: +<dl> +<dt>owner</dt> +<dd>The module that owns the API. Typically this is the name of the module that owns the schema. This will be one of the two keys used by hook_ctools_plugin_api() to determine version compatibility. Note that the name of this hook can be tailored via the use of hook_ctools_plugin_api_hook_name(). See ctools_plugin_api_get_hook() for details.</dd> +<dt>api</dt> +<dd>This is the name of the API, and will be the second parameter to the above mentioned hook. It will also be used as part of the name of the file that the hook containing default objects will be in, which comes in the form of MODULENAME.API.inc.</dd> +<dt>minimum_version</dt> +<dd>The minimum version supported. Any module reporting an API less than this will not have its default objects used. This should be updated only when API changes can cause older objects to crash or otherwise break badly.</dd> +<dt>current_version</dt> +<dd>The current version of the API. Any module reporting a required API higher than this will not have its default objects used.</dd> +</dl> +</dd> + +</dl> In addition, each field can contain the following: <dl> <dt>no export</dt> diff --git a/sites/all/modules/ctools/includes/cache.inc b/sites/all/modules/ctools/includes/cache.inc index ca6e6f34d50a7924bd67b137f6a5775e2cfd9414..3918683b02a16083088b4952366ae046089ce870 100644 --- a/sites/all/modules/ctools/includes/cache.inc +++ b/sites/all/modules/ctools/includes/cache.inc @@ -93,7 +93,7 @@ function ctools_cache_set($mechanism, $key, $object) { * The key used to identify the cache. */ function ctools_cache_clear($mechanism, $key) { - return ctools_cache_operation($mechanism, $key, 'clear', $object); + return ctools_cache_operation($mechanism, $key, 'clear'); } diff --git a/sites/all/modules/ctools/includes/context-task-handler.inc b/sites/all/modules/ctools/includes/context-task-handler.inc index e1f786172c5da5e89f53ebbfc7b908cf8bca39d7..a1d9cd4ec225847409a4f7939fcb99d172252b5c 100644 --- a/sites/all/modules/ctools/includes/context-task-handler.inc +++ b/sites/all/modules/ctools/includes/context-task-handler.inc @@ -160,6 +160,53 @@ function ctools_context_handler_render_handler($task, $subtask, $handler, $conte } } + $plugin = page_manager_get_task_handler($handler->handler); + + if (module_exists('contextual') && user_access('access contextual links') && user_access('administer page manager') && isset($handler->task)) { + // Provide a tab to edit this context: + ctools_include('menu'); + $task = page_manager_get_task($handler->task); + + $title = !empty($task['tab title']) ? $task['tab title'] : t('Edit @type', array('@type' => $plugin['title'])); + $trail = array(); + if (!empty($plugin['tab operation'])) { + if (is_array($plugin['tab operation'])) { + $trail = $plugin['tab operation']; + } + else if (function_exists($plugin['tab operation'])) { + $trail = $plugin['tab operation']($handler, $contexts, $args); + } + } + + $build = array( + '#theme_wrappers' => array('container'), + '#attributes' => array('class' => array('contextual-links-region')), + ); + + if (!is_array($info['content'])) { + $build['content']['#markup'] = $info['content']; + } + else { + $build['content'] = $info['content']; + } + + $path = page_manager_edit_url(page_manager_make_task_name($handler->task, $handler->subtask), $trail); + $build['contextual_links'] = array( + '#prefix' => '<div class="contextual-links-wrapper">', + '#suffix' => '</div>', + '#theme' => 'links__contextual', + '#links' => array(array( + 'href' => $path, + 'title' => $title, + )), + '#attributes' => array('class' => array('contextual-links')), + '#attached' => array( + 'library' => array(array('contextual', 'contextual-links')), + ), + ); + $info['content'] = drupal_render($build); + } + foreach (ctools_context_handler_get_task_arguments($task, $subtask) as $id => $argument) { $plugin = ctools_get_argument($argument['name']); $cid = ctools_context_id($argument, 'argument'); @@ -182,32 +229,7 @@ function ctools_context_handler_render_handler($task, $subtask, $handler, $conte /** * Called to execute actions that should happen before a handler is rendered. */ -function ctools_context_handler_pre_render($handler, $contexts, $args) { - $plugin = page_manager_get_task_handler($handler->handler); - - if (user_access('administer page manager') && isset($handler->task)) { - // Provide a tab to edit this context: - ctools_include('menu'); - $task = page_manager_get_task($handler->task); - - $title = !empty($task['tab title']) ? $task['tab title'] : t('Edit @type', array('@type' => $plugin['title'])); - $trail = array(); - if (!empty($plugin['tab operation'])) { - if (is_array($plugin['tab operation'])) { - $trail = $plugin['tab operation']; - } - else if (function_exists($plugin['tab operation'])) { - $trail = $plugin['tab operation']($handler, $contexts, $args); - } - } - - ctools_menu_add_tab(array( - 'title' => $title, - 'href' => page_manager_edit_url(page_manager_make_task_name($handler->task, $handler->subtask), $trail), - 'type' => MENU_LOCAL_ACTION - )); - } -} +function ctools_context_handler_pre_render($handler, $contexts, $args) { } /** * Compare arguments to contexts for selection purposes. diff --git a/sites/all/modules/ctools/includes/dependent.inc b/sites/all/modules/ctools/includes/dependent.inc index e812cb977a607cab6fa9cd2b33e37972986f609f..74de919716ea788bdb05dda376cbf7f152be0f66 100644 --- a/sites/all/modules/ctools/includes/dependent.inc +++ b/sites/all/modules/ctools/includes/dependent.inc @@ -174,7 +174,7 @@ function ctools_dependent_pre_render($element) { * because you don't have to add #process. */ function ctools_dependent_element_info_alter(&$type) { - $form_elements = array('checkbox', 'checkboxes', 'fieldset', 'item', 'markup', 'radio', 'radios', 'select', 'textarea', 'textfield', 'text_format'); + $form_elements = array('checkbox', 'checkboxes', 'date', 'fieldset', 'item', 'machine_name', 'markup', 'radio', 'radios', 'select', 'textarea', 'textfield', 'text_format'); foreach ($form_elements as $element) { $type[$element]['#pre_render'][] = 'ctools_dependent_pre_render'; } diff --git a/sites/all/modules/ctools/includes/export-ui.inc b/sites/all/modules/ctools/includes/export-ui.inc index 2868ae8f5089393d213268869dc8f2aba529d3b4..455a3cc57db2bd5d6ce83424f95f750dd6df1803 100644 --- a/sites/all/modules/ctools/includes/export-ui.inc +++ b/sites/all/modules/ctools/includes/export-ui.inc @@ -164,7 +164,8 @@ function ctools_export_ui_process(&$plugin, $info) { 'load arguments' => array($plugin['name']), 'access callback' => 'ctools_export_ui_task_access', 'access arguments' => array($plugin['name'], 'edit', $prefix_count + 2), - 'type' => MENU_CALLBACK, + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'weight' => -10, ), ); diff --git a/sites/all/modules/ctools/includes/export.inc b/sites/all/modules/ctools/includes/export.inc index eebf7f57625db103fd53a4a5006876eff02f5a9f..66aa3b673faf870bcb0ae594e5d61d07c87b9be2 100644 --- a/sites/all/modules/ctools/includes/export.inc +++ b/sites/all/modules/ctools/includes/export.inc @@ -772,7 +772,12 @@ function _ctools_export_unpack_object($schema, $data, $object = 'stdClass') { // Go through our schema and build correlations. foreach ($schema['fields'] as $field => $info) { - $object->$field = empty($info['serialize']) ? $data->$field : unserialize($data->$field); + if (isset($data->$field)) { + $object->$field = empty($info['serialize']) ? $data->$field : unserialize($data->$field); + } + else { + $data->$field = NULL; + } } if (isset($schema['join'])) { diff --git a/sites/all/modules/ctools/includes/fields.inc b/sites/all/modules/ctools/includes/fields.inc index 1617d3acbcd1f927b6a3dcdcff685c4084b6b6f3..f4debb4771e2e0e9523da799053e51af5dfc1ff7 100644 --- a/sites/all/modules/ctools/includes/fields.inc +++ b/sites/all/modules/ctools/includes/fields.inc @@ -71,6 +71,9 @@ function ctools_fields_fake_field_instance($field_name, $view_mode = 'ctools', $ function ctools_fields_get_field_formatter_settings_form($field, $formatter_type, &$form, $form_state, $view_mode = 'ctools') { $conf = $form_state['conf']; $formatter = field_info_formatter_types($formatter_type); + if (isset($formatter['settings'])) { + $conf['formatter_settings'] += $formatter['settings']; + } $function = $formatter['module'] . '_field_formatter_settings_form'; if (function_exists($function)) { $instance = ctools_fields_fake_field_instance($field['field_name'], $view_mode, $formatter_type, $conf['formatter_settings']); diff --git a/sites/all/modules/ctools/includes/jump-menu.inc b/sites/all/modules/ctools/includes/jump-menu.inc index f58672766438726d1edb9b86d394ff5770b0a41b..ac776ece4b06620147e393d37b9dcef54a691031 100644 --- a/sites/all/modules/ctools/includes/jump-menu.inc +++ b/sites/all/modules/ctools/includes/jump-menu.inc @@ -116,7 +116,17 @@ function ctools_jump_menu($form, &$form_state, $select, $options = array()) { * This is normally only invoked upon submit without javascript enabled. */ function ctools_jump_menu_submit($form, &$form_state) { - $redirect = $form_state['values']['jump']; + // If the path we are redirecting to contains the string :: then treat the + // the string after the double colon as the path to redirect to. + // This allows duplicate paths to be used in jump menus for multiple options. + $redirect_array = explode("::", $form_state['values']['jump']); + + if(isset($redirect_array[1]) && !empty($redirect_array[1])){ + $redirect = $redirect_array[1]; + } + else { + $redirect = $form_state['values']['jump']; + } // If the path we are redirecting to starts with the base path (for example, // "/somepath/node/1"), we need to strip the base path off before passing it diff --git a/sites/all/modules/ctools/includes/math-expr.inc b/sites/all/modules/ctools/includes/math-expr.inc index 325d444000420ea9b157cfed55560941414a36ff..b4b7fb73088324bc62ba11195ea151e31658f9b7 100644 --- a/sites/all/modules/ctools/includes/math-expr.inc +++ b/sites/all/modules/ctools/includes/math-expr.inc @@ -95,12 +95,14 @@ class ctools_math_expr { 'sin','sinh','arcsin','asin','arcsinh','asinh', 'cos','cosh','arccos','acos','arccosh','acosh', 'tan','tanh','arctan','atan','arctanh','atanh', - 'sqrt','abs','ln','log'); + 'sqrt','abs','ln','log', + 'time', 'ceil', 'floor', 'min', 'max', 'round'); function ctools_math_expr() { // make the variables a little more accurate $this->v['pi'] = pi(); $this->v['e'] = exp(1); + drupal_alter('ctools_math_expression_functions', $this->fb); } function e($expr) { diff --git a/sites/all/modules/ctools/includes/plugins.inc b/sites/all/modules/ctools/includes/plugins.inc index f395dbc18ced7a10a54e6213f051abaf14303074..572d8a2d7c56ef03ab3105b9766818b4eea41a26 100644 --- a/sites/all/modules/ctools/includes/plugins.inc +++ b/sites/all/modules/ctools/includes/plugins.inc @@ -156,7 +156,7 @@ function ctools_plugin_api_include($owner, $api, $minimum_version, $current_vers require_once DRUPAL_ROOT . "/$plugin_info[path]/$file"; } else if (file_exists(DRUPAL_ROOT . "/$file")) { - require_once DRUPAL_ROOT . "/$plugin_info[path]/$file"; + require_once DRUPAL_ROOT . "/$file"; } $already_done[$owner][$api][$module] = TRUE; } diff --git a/sites/all/modules/ctools/js/ajax-responder.js b/sites/all/modules/ctools/js/ajax-responder.js index 61ddcf690d78dd044ed12a7a60c920d7a34faebc..e244106fe7b4d355ad621caab2d430b2121bf976 100644 --- a/sites/all/modules/ctools/js/ajax-responder.js +++ b/sites/all/modules/ctools/js/ajax-responder.js @@ -26,7 +26,7 @@ // Grab all the links that match this url and add the fetching class. // This allows the caching system to grab each url once and only once // instead of grabbing the url once per <a>. - var $objects = $('a[href=' + old_url + ']') + var $objects = $('a[href="' + old_url + '"]') $objects.addClass('ctools-fetching'); try { url = old_url.replace(/\/nojs(\/|$)/g, '/ajax$1'); diff --git a/sites/all/modules/ctools/js/auto-submit.js b/sites/all/modules/ctools/js/auto-submit.js index 4a80f79ee1910115aa25386bf483a7d5af9337cd..f84db2371e0217acbcde07ab3a93850db893c332 100644 --- a/sites/all/modules/ctools/js/auto-submit.js +++ b/sites/all/modules/ctools/js/auto-submit.js @@ -31,7 +31,7 @@ Drupal.behaviors.CToolsAutoSubmit = { var timeoutID = 0; // Bind to any select widgets that will be auto submitted. - $('select.ctools-auto-submit:not(.ctools-auto-submit-processed),.ctools-auto-submit-full-form select:not(.ctools-auto-submit-processed)') + $('select.ctools-auto-submit:not(.ctools-auto-submit-processed),.ctools-auto-submit-full-form *[type!=input]:not(.ctools-auto-submit-processed)') .addClass('.ctools-auto-submit-processed') .change(function() { $(this.form).find('.ctools-auto-submit-click').click(); diff --git a/sites/all/modules/ctools/js/dependent.js b/sites/all/modules/ctools/js/dependent.js index 9ed0a3215522204ef8c75fe333339465424ba3a7..cca36222197539f491a1951fdf436dfb90416c59 100644 --- a/sites/all/modules/ctools/js/dependent.js +++ b/sites/all/modules/ctools/js/dependent.js @@ -54,6 +54,8 @@ // Iterate through all relationships for (id in Drupal.settings.CTools.dependent) { + // Test to make sure the id even exists; this helps clean up multiple + // AJAX calls with multiple forms. // Drupal.CTools.dependent.activeBindings[id] is a boolean, // whether the binding is active or not. Defaults to no. @@ -87,6 +89,10 @@ } var getValue = function(item, trigger) { + if ($(trigger).size() == 0) { + return null; + } + if (item.substring(0, 6) == 'radio:') { var val = $(trigger + ':checked').val(); } @@ -115,9 +121,12 @@ var changeTrigger = function() { var val = getValue(bind_id, trigger_id); + if (val == null) { + return; + } + for (i in Drupal.CTools.dependent.bindings[bind_id]) { var id = Drupal.CTools.dependent.bindings[bind_id][i]; - // Fix numerous errors if (typeof id != 'string') { continue; @@ -143,6 +152,16 @@ var object = $('#' + id + '-wrapper'); if (!object.size()) { + // Some elements can't use the parent() method or they can + // damage things. They are guaranteed to have wrappers but + // only if dependent.inc provided them. This check prevents + // problems when multiple AJAX calls cause settings to build + // up. + var $original = $('#' + id); + if ($original.is('fieldset') || $original.is('textarea')) { + continue; + } + object = $('#' + id).parent(); } diff --git a/sites/all/modules/ctools/js/jump-menu.js b/sites/all/modules/ctools/js/jump-menu.js index f515c8c5d433858c1d92f2bf73e36d3dd80159d0..6bd0af6be78fa9283dbbebec71c6ce1339395a38 100644 --- a/sites/all/modules/ctools/js/jump-menu.js +++ b/sites/all/modules/ctools/js/jump-menu.js @@ -10,7 +10,11 @@ .addClass('ctools-jump-menu-processed') .change(function() { var loc = $(this).val(); - if (loc) { + var urlArray = loc.split('::'); + if (urlArray[1]) { + location.href = urlArray[1]; + } + else { location.href = loc; } return false; @@ -24,7 +28,11 @@ // Find our sibling value. var $select = $(this).parents('form').find('.ctools-jump-menu-select'); var loc = $select.val(); - if (loc) { + var urlArray = loc.split('::'); + if (urlArray[1]) { + location.href = urlArray[1]; + } + else { location.href = loc; } return false; diff --git a/sites/all/modules/ctools/js/modal.js b/sites/all/modules/ctools/js/modal.js index 4d6c6f81e118b6d683676152492d61bde238351b..c98c50fa774645683b7b12291ba4209be694d96b 100644 --- a/sites/all/modules/ctools/js/modal.js +++ b/sites/all/modules/ctools/js/modal.js @@ -269,6 +269,9 @@ * AJAX responder command to place HTML within the modal. */ Drupal.CTools.Modal.modal_display = function(ajax, response, status) { + if ($('#modalContent').length == 0) { + Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(ajax.element)); + } $('#modal-title').html(response.title); $('#modal-content').html(response.output); Drupal.attachBehaviors(); diff --git a/sites/all/modules/ctools/page_manager/page_manager.info b/sites/all/modules/ctools/page_manager/page_manager.info index 4791bc318786d021052ca9de2dc0161864e2b8aa..1c2ee01624f6ca00077bba52bf07792871c53d00 100644 --- a/sites/all/modules/ctools/page_manager/page_manager.info +++ b/sites/all/modules/ctools/page_manager/page_manager.info @@ -4,9 +4,9 @@ core = 7.x dependencies[] = ctools package = Chaos tool suite -; Information added by drupal.org packaging script on 2011-05-31 -version = "7.x-1.0-beta1" +; Information added by drupal.org packaging script on 2011-07-28 +version = "7.x-1.0-rc1" core = "7.x" project = "ctools" -datestamp = "1306885315" +datestamp = "1311894415" diff --git a/sites/all/modules/ctools/page_manager/plugins/tasks/page.inc b/sites/all/modules/ctools/page_manager/plugins/tasks/page.inc index aba99c7d9eb4526df168d18285b0e225dcaaba39..095c3906452580c65db7bc94778979864f3f869a 100644 --- a/sites/all/modules/ctools/page_manager/plugins/tasks/page.inc +++ b/sites/all/modules/ctools/page_manager/plugins/tasks/page.inc @@ -290,7 +290,6 @@ function page_manager_page_execute($subtask_id) { $argument['keyword'] = $name; if (isset($args[$count])) { // Hack: use a special argument config variable to learn if we need - $plugin = ctools_get_argument($argument['name']); // to use menu_tail style behavior: if (empty($argument['settings']['use_tail'])) { $value = $args[$count]; diff --git a/sites/all/modules/ctools/plugins/access/entity_bundle.inc b/sites/all/modules/ctools/plugins/access/entity_bundle.inc index ffb83f572c1b3f3161babe576f39dccd3b8abcee..cce241b7f95007a47ce90bab71f38f2b405d271a 100644 --- a/sites/all/modules/ctools/plugins/access/entity_bundle.inc +++ b/sites/all/modules/ctools/plugins/access/entity_bundle.inc @@ -121,6 +121,6 @@ function ctools_entity_bundle_ctools_access_summary($conf, $context) { return t('@identifier is any bundle', array('@identifier' => $context->identifier)); } - return format_plural(count($names), '@identifier is type "@types"', '@identifier type is one of "@types"', array('@types' => implode(', ', $names), '@identifier' => $context->identifier)); + return format_plural(count($names), '@identifier is bundle "@types"', '@identifier bundle is one of "@types"', array('@types' => implode(', ', $names), '@identifier' => $context->identifier)); } diff --git a/sites/all/modules/ctools/plugins/arguments/term.inc b/sites/all/modules/ctools/plugins/arguments/term.inc index 652c5c16c303f05dda1693d96bd58b9b31e59dc4..93d2f0a2ec3693266d900916ea863110947cb00f 100644 --- a/sites/all/modules/ctools/plugins/arguments/term.inc +++ b/sites/all/modules/ctools/plugins/arguments/term.inc @@ -141,6 +141,7 @@ function ctools_term_breadcrumb($conf, $context) { } $breadcrumb = array(); + $current = new stdClass(); $current->tid = $context->data->tid; while ($parents = taxonomy_get_parents($current->tid)) { $current = array_shift($parents); diff --git a/sites/all/modules/ctools/plugins/arguments/uid.inc b/sites/all/modules/ctools/plugins/arguments/uid.inc index a730b2164e514b7400142f3d01bab864eb29c8f3..f9d5315cc326f79e87ba519de20b054971250289 100644 --- a/sites/all/modules/ctools/plugins/arguments/uid.inc +++ b/sites/all/modules/ctools/plugins/arguments/uid.inc @@ -44,7 +44,7 @@ function ctools_argument_uid_context($arg = NULL, $conf = NULL, $empty = FALSE) return NULL; } - $account = user_load(array('uid' => $arg)); + $account = user_load($arg); if (!$account) { return NULL; } diff --git a/sites/all/modules/ctools/plugins/content_types/contact/user_contact.inc b/sites/all/modules/ctools/plugins/content_types/contact/user_contact.inc index cb643bfdcf1767300b47817e62625d8cbfb2f098..9b3726ab8a018e389bfde04cb81b69a099f59689 100644 --- a/sites/all/modules/ctools/plugins/content_types/contact/user_contact.inc +++ b/sites/all/modules/ctools/plugins/content_types/contact/user_contact.inc @@ -41,7 +41,7 @@ function ctools_user_contact_content_type_render($subtype, $conf, $panel_args, $ /** * Returns an edit form for custom type settings. */ -function ctools_user_contact_content_type_edit_form(&$form, &$form_state) { +function ctools_user_contact_content_type_edit_form($form, &$form_state) { // Empty so that we can have title override. return $form; } diff --git a/sites/all/modules/ctools/plugins/content_types/custom/custom.inc b/sites/all/modules/ctools/plugins/content_types/custom/custom.inc index f60497a60ee4cb3ea50417c339adf573c7db5771..a4a2def6381d95b44d6214d2d14d1ffa46c92154 100644 --- a/sites/all/modules/ctools/plugins/content_types/custom/custom.inc +++ b/sites/all/modules/ctools/plugins/content_types/custom/custom.inc @@ -174,6 +174,17 @@ function ctools_custom_content_type_render($subtype, $conf, $args, $contexts) { } $block->content = check_markup($content, $settings['format']); + if ($settings['custom_type'] == 'fixed' && user_access('administer custom content')) { + $block->admin_links = array( + array( + 'title' => t('Configure content pane'), + 'alt' => t("Configure this pane in administer >> structure >> custom content panes"), + 'href' => 'admin/structure/ctools-content/list/' . $settings['content']->name . '/edit', + 'query' => drupal_get_destination(), + ), + ); + } + return $block; } @@ -300,7 +311,7 @@ function ctools_custom_content_type_edit_form($form, &$form_state) { } } $header = array(t('Keyword'), t('Value')); - $form['contexts']['context'] = array('#value' => theme('table', $header, $rows)); + $form['contexts']['context'] = array('#markup' => theme('table', array('header' => $header, 'rows' => $rows))); } if (!user_access('administer custom content') || !module_exists('ctools_custom_content')) { diff --git a/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc b/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc index e252064a6df193e44a27684eb62ad4550867dd84..d729d65201382de745abcfb7477ba625ae30db88 100644 --- a/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc +++ b/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc @@ -110,7 +110,7 @@ function ctools_entity_field_content_type_render($subtype, $conf, $panel_args, $ 'type' => $conf['formatter'], ); - // Get the field output, and the title.\ + // Get the field output, and the title. if (!empty($conf['formatter_settings'])) { $field_settings['settings'] = $conf['formatter_settings']; } diff --git a/sites/all/modules/ctools/plugins/content_types/node_context/node_terms.inc b/sites/all/modules/ctools/plugins/content_types/node_context/node_terms.inc index 6cb5e7ce912bb303dbb1aaaaf43b9e595cca80dd..1b9c55394947747df6c22619b56e31bde7d0edcf 100644 --- a/sites/all/modules/ctools/plugins/content_types/node_context/node_terms.inc +++ b/sites/all/modules/ctools/plugins/content_types/node_context/node_terms.inc @@ -82,20 +82,16 @@ function ctools_node_terms_content_type_render($subtype, $conf, $panel_args, $co switch ($conf['term_format']) { case 'term-links': drupal_alter('link', $terms, $node); - $formatted_terms = theme('links', $terms); + $formatted_terms = theme('links', array('links' => $terms)); break; case 'ul': - $formatted_terms = theme('item_list', $terms); + $formatted_terms = theme('item_list', array('items' => $terms)); break; case 'inline-delimited': - $term_names = array(); - foreach ($terms AS $term) { - $term_names[] = $term['title']; - } $delimiter = isset($conf['term_delimiter']) ? $conf['term_delimiter'] : ', '; - $formatted_terms = implode($delimiter, $term_names); + $formatted_terms = implode($delimiter, $terms); break; } @@ -103,7 +99,7 @@ function ctools_node_terms_content_type_render($subtype, $conf, $panel_args, $co $block = new stdClass(); $block->module = 'node_terms'; $block->delta = $node->nid; - $block->title = $type->title_label; + $block->title = t('Terms'); $block->content = $formatted_terms; return $block; diff --git a/sites/all/modules/ctools/plugins/content_types/search/search_result.inc b/sites/all/modules/ctools/plugins/content_types/search/search_result.inc index 44cfbac5e73c75c5f939413daf143912a7903b79..eae9870823383211193e2c767861d574aca64c35 100644 --- a/sites/all/modules/ctools/plugins/content_types/search/search_result.inc +++ b/sites/all/modules/ctools/plugins/content_types/search/search_result.inc @@ -65,21 +65,18 @@ function ctools_search_result_content_type_render($subtype, $conf, $panel_args, $results = ''; - // Only search if there are keywords or non-empty conditions. - if ($keys || !empty($conditions)) { + // Only search if there are keywords or non-empty conditions. + if ($keys || !empty($conditions)) { - // Collect the search results. - $results = search_data($keys, $info['module'], $conditions); - } + // Collect the search results. + $results = search_data($keys, $info['module'], $conditions); + } if (!empty($conf['log'])) { // Log the search keys: watchdog('search', 'Searched %type for %keys.', array('%keys' => $keys, '%type' => $info['title']), WATCHDOG_NOTICE, l(t('results'), $_GET['q'])); } - // Collect the search results: - $results = search_data($keys, $conf['type'], $conditions); - if (!empty($results['#results'])) { $output = "<ol class=\"search-results $conf[type]-results\">\n"; foreach ($results['#results'] as $result) { diff --git a/sites/all/modules/ctools/plugins/content_types/user_context/user_picture.inc b/sites/all/modules/ctools/plugins/content_types/user_context/user_picture.inc index dbe42428e58c70064f995b217b1ad591ec91dca4..f8a9e8ac5c6a80d6a45349ebb874f05f9cb106d2 100644 --- a/sites/all/modules/ctools/plugins/content_types/user_context/user_picture.inc +++ b/sites/all/modules/ctools/plugins/content_types/user_context/user_picture.inc @@ -14,14 +14,21 @@ $plugin = array( ); function ctools_user_picture_content_type_render($subtype, $conf, $panel_args, $context) { - $account = isset($context->data) ? clone($context->data) : FALSE; - $block = new stdClass(); - $block->module = 'term-list'; + global $user; - if ($account === FALSE || ($account->access == 0 && !user_access('administer users'))) { - return drupal_not_found(); + if (empty($context->data)) { + return; } + $account = clone $context->data; + + // Check if user has permissions to access the user + if ($user->uid != $account->uid && (!user_access('access user profiles') && !user_access('administer users'))) { + return; + } + + $block = new stdClass(); + $block->module = 'user-profile'; $block->title = check_plain($account->name); $block->content = theme('user_picture', array('account' => $account)); diff --git a/sites/all/modules/ctools/plugins/contexts/entity.inc b/sites/all/modules/ctools/plugins/contexts/entity.inc index 99bfb293aa983718fcbbda5134b10e00394d4d1d..3915667c7fd83ee0deb5be9d3017117faec48123 100644 --- a/sites/all/modules/ctools/plugins/contexts/entity.inc +++ b/sites/all/modules/ctools/plugins/contexts/entity.inc @@ -79,8 +79,7 @@ function ctools_context_create_entity($empty, $data = NULL, $conf = FALSE, $plug if (is_array($data)) { $data = entity_load($entity_type, array($id)); - $data = $data[$id]; - //$language = field_language($entity_type, $data); + $data = !empty($data[$id]) ? $data[$id] : FALSE; } if (!empty($data)) { @@ -262,10 +261,8 @@ function ctools_context_entity_convert($context, $type) { $tokens = token_info(); - if (isset($tokens['tokens'][$token][$type])) { - $values = token_generate($token, array($type => $type), array($token => $context->data)); - if (isset($values[$type])) { - return $values[$type]; - } + $values = token_generate($token, array($type => $type), array($token => $context->data)); + if (isset($values[$type])) { + return $values[$type]; } } diff --git a/sites/all/modules/ctools/plugins/contexts/node_add_form.inc b/sites/all/modules/ctools/plugins/contexts/node_add_form.inc index 55219330a9699e7e86c390db7275792c3c5b3938..fcd92d4024eb1f06551245c5cab9e135893421eb 100644 --- a/sites/all/modules/ctools/plugins/contexts/node_add_form.inc +++ b/sites/all/modules/ctools/plugins/contexts/node_add_form.inc @@ -31,14 +31,14 @@ $plugin = array( * are not always created from the UI. */ function ctools_context_create_node_add_form($empty, $data = NULL, $conf = FALSE) { - static $created; + static $creating = FALSE; $context = new ctools_context(array('form', 'node_add', 'node_form')); $context->plugin = 'node_add_form'; - if ($empty || (isset($created) && $created)) { + if ($empty || ($creating)) { return $context; } - $created = TRUE; + $creating = TRUE; if ($conf && (isset($data['types']) || isset($data['type']))) { // Holdover from typo'd config. @@ -53,19 +53,27 @@ function ctools_context_create_node_add_form($empty, $data = NULL, $conf = FALSE if (isset($types[$type]) && node_access('create', $type)) { // Initialize settings: global $user; - $node = array('uid' => $user->uid, 'name' => $user->name, 'type' => $type); + $node = (object) array( + 'uid' => $user->uid, + 'name' => (isset($user->name) ? $user->name : ''), + 'type' => $type, + 'language' => LANGUAGE_NONE, + ); - $form_id = $node['type'] . '_node_form'; + $form_id = $type . '_node_form'; - $form_state = array('want form' => TRUE, 'build_info' => array('args' => array($node))); + $form_state = array( + 'want form' => TRUE, + 'build_info' => array( + 'args' => array($node) + ) + ); - $file = drupal_get_path('module', 'node') . '/node.pages.inc'; - include_once './' . $file; - // This piece of information can let other modules know that more files - // need to be included if this form is loaded from cache: - $form_state['build_info']['files'] = array($file); + // Use module_load_include so that caches and stuff can know to load this. + form_load_include($form_state, 'inc', 'node', 'node.pages'); $form = drupal_build_form($form_id, $form_state); + // In a form, $data is the object being edited. $context->data = $type; $context->title = $types[$type]->name; @@ -74,14 +82,17 @@ function ctools_context_create_node_add_form($empty, $data = NULL, $conf = FALSE // These are specific pieces of data to this form. // All forms should place the form here. $context->form = $form; - $context->form_id = $type . '_node_form'; + $context->form_id = $form_id; $context->form_title = t('Submit @name', array('@name' => $types[$type]->name)); $context->node_type = $type; $context->restrictions['type'] = array($type); $context->restrictions['form'] = array('form'); + + $creating = FALSE; return $context; } } + $creating = FALSE; } function ctools_context_node_add_form_settings_form($form, &$form_state) { diff --git a/sites/all/modules/ctools/plugins/contexts/node_edit_form.inc b/sites/all/modules/ctools/plugins/contexts/node_edit_form.inc index a7b04523a37ae1fdbc1191d324181242ebdbab8a..cd4ff0a8a6434b93db0571e69cc72d5da5d91dff 100644 --- a/sites/all/modules/ctools/plugins/contexts/node_edit_form.inc +++ b/sites/all/modules/ctools/plugins/contexts/node_edit_form.inc @@ -31,14 +31,14 @@ $plugin = array( * are not always created from the UI. */ function ctools_context_create_node_edit_form($empty, $node = NULL, $conf = FALSE) { - static $created; - $context = new ctools_context(array('form', 'node_edit', 'node_form', 'node', 'node_edit_form')); + static $creating = FALSE; + $context = new ctools_context(array('form', 'node_edit', 'node_form', 'node_edit_form')); $context->plugin = 'node_edit_form'; - if ($empty || (isset($created) && $created)) { + if ($empty || ($creating)) { return $context; } - $created = TRUE; + $creating = TRUE; if ($conf) { // In this case, $node is actually our $conf array. @@ -81,8 +81,11 @@ function ctools_context_create_node_edit_form($empty, $node = NULL, $conf = FALS $context->node_type = $node->type; $context->restrictions['type'] = array($node->type); $context->restrictions['form'] = array('form'); + + $creating = FALSE; return $context; } + $creating = FALSE; } function ctools_context_node_edit_form_settings_form($form, &$form_state) { diff --git a/sites/all/modules/ctools/plugins/contexts/terms.inc b/sites/all/modules/ctools/plugins/contexts/terms.inc index b076a61991c6e7c8d631821405197ada06759f1c..64ec6829b2cedf05d9de801dc43b10e62de57718 100644 --- a/sites/all/modules/ctools/plugins/contexts/terms.inc +++ b/sites/all/modules/ctools/plugins/contexts/terms.inc @@ -17,7 +17,6 @@ $plugin = array( 'keyword' => 'terms', // This context is deprecated and should not be usable in the UI. 'no ui' => TRUE, - 'no required context ui' => TRUE, 'context name' => 'terms', 'convert list' => array( 'tid' => t('Term ID of first term'), @@ -39,7 +38,7 @@ function ctools_context_create_terms($empty, $data = NULL, $conf = FALSE) { // The input is expected to be an object as created by ctools_break_phrase // which contains a group of terms. - $context = new ctools_context(array('terms', 'term')); + $context = new ctools_context(array('terms', 'entity:taxonomy_term')); $context->plugin = 'terms'; if ($empty) { diff --git a/sites/all/modules/ctools/plugins/export_ui/ctools_export_ui.class.php b/sites/all/modules/ctools/plugins/export_ui/ctools_export_ui.class.php index 4a919eacff1c30221a5a5904f5249a1149f000e3..7fe005582928841f614359536a0fc1500b63b54d 100644 --- a/sites/all/modules/ctools/plugins/export_ui/ctools_export_ui.class.php +++ b/sites/all/modules/ctools/plugins/export_ui/ctools_export_ui.class.php @@ -121,7 +121,7 @@ class ctools_export_ui { switch ($op) { case 'import': - return user_access('use PHP for block visibility'); + return user_access('use PHP for settings'); case 'revert': return ($item->export_type & EXPORT_IN_DATABASE) && ($item->export_type & EXPORT_IN_CODE); case 'delete': @@ -1311,6 +1311,10 @@ function ctools_export_ui_list_form_submit(&$form, &$form_state) { * This simply loads the object defined in the plugin and hands it off. */ function ctools_export_ui_edit_item_form($form, &$form_state) { + // When called using #ajax via ajax_form_callback(), 'export' may + // not be included so include it here. + ctools_include('export'); + $form = array(); $form_state['object']->edit_form($form, $form_state); return $form; @@ -1401,6 +1405,10 @@ function ctools_export_ui_delete_confirm_form($form, &$form_state) { * This simply loads the object defined in the plugin and hands it off. */ function ctools_export_ui_edit_item_wizard_form($form, &$form_state) { + // When called using #ajax via ajax_form_callback(), 'export' may + // not be included so include it here. + ctools_include('export'); + $method = 'edit_form_' . $form_state['step']; if (!method_exists($form_state['object'], $method)) { $method = 'edit_form'; diff --git a/sites/all/modules/ctools/plugins/relationships/entity_from_field.inc b/sites/all/modules/ctools/plugins/relationships/entity_from_field.inc index 99d6f2d6db4cf548d356982825c6f192779017e4..e5e6582667ffe6df0b38a6e806accb0be67ef75d 100644 --- a/sites/all/modules/ctools/plugins/relationships/entity_from_field.inc +++ b/sites/all/modules/ctools/plugins/relationships/entity_from_field.inc @@ -13,8 +13,10 @@ $plugin = array( 'title' => t('Entity'), 'description' => t('Creates an entity context from a foreign key on a field.'), 'context' => 'ctools_entity_from_field_context', + 'edit form' => 'ctools_entity_from_field_edit_form', 'get child' => 'ctools_entity_from_field_get_child', 'get children' => 'ctools_entity_from_field_get_children', + 'defaults' => array('delta' => 0), ); function ctools_entity_from_field_get_child($plugin, $parent, $child) { @@ -59,6 +61,12 @@ function ctools_entity_from_field_get_children($parent_plugin, $parent) { if (isset($info['table'])) { foreach ($entities as $to_entity => $to_entity_info) { $from_entity_info = $entities[$from_entity]; + // If somehow the bundle doesn't exist on the to-entity, + // skip. + if (!isset($from_entity_info['bundles'][$bundle])) { + continue; + } + if (isset($to_entity_info['base table']) && $to_entity_info['base table'] == $info['table'] && isset($info['columns'][$to_entity_info['entity keys']['id']])) { $name = $field_name . '-' . $from_entity . '-' . $to_entity; $plugin_id = $parent . ':' . $name; @@ -153,6 +161,7 @@ function ctools_entity_from_field_get_children($parent_plugin, $parent) { * Return a new context based on an existing context. */ function ctools_entity_from_field_context($context, $conf) { + $delta = !empty($conf['delta']) ? intval($conf['delta']) : 0; $plugin = $conf['name']; list($plugin, $plugin_name) = explode(':', $plugin); list($field_name, $from_entity, $to_entity_info) = explode('-', $plugin_name); @@ -167,13 +176,45 @@ function ctools_entity_from_field_context($context, $conf) { $id = $context->data->{$entity_info['entity keys']['id']}; $entity = entity_load($from_entity, array($id)); $entity = $entity[$id]; - if (isset($entity->$field_name)) { - $language = field_language($from_entity, $entity, $field_name); + if ($items = field_get_items($from_entity, $entity, $field_name)) { $to_entity_info_info = entity_get_info($to_entity_info); - $to_entity_info_id = $entity->{$field_name}[$language][0][$to_entity_info_info['entity keys']['id']]; + if (isset($items[$delta])) { + $to_entity_info_id = $items[$delta][$to_entity_info_info['entity keys']['id']]; + + // Send it to ctools. + return ctools_context_create('entity:' . $to_entity_info, $to_entity_info_id); + } + else { + // In case that delta was empty. + return ctools_context_create_empty('entity:' . $to_entity_info, NULL); + } + } + } +} - // Send it to ctools. - return ctools_context_create('entity:' . $to_entity_info, $to_entity_info_id); +function ctools_entity_from_field_edit_form($form, &$form_state) { + $field = field_info_field($form_state['plugin']['field name']); + $conf = $form_state['conf']; + + if ($field && $field['cardinality'] != 1) { + if ($field['cardinality'] == -1) { + $form['delta'] = array( + '#type' => 'textfield', + '#title' => t('Delta'), + '#description' => t('The relationship can only create one context, but multiple items can be related. Please select which one. Since this can have unlimited items, type in the number you want. The first one will be 0.'), + '#default_value' => !empty($conf['delta']) ? $conf['delta'] : 0, + ); + } + else { + $form['delta'] = array( + '#type' => 'select', + '#title' => t('Delta'), + '#description' => t('The relationship can only create one context, but multiple items can be related. Please select which one.'), + '#options' => range(1, $field['cardinality']), + '#default_value' => !empty($conf['delta']) ? $conf['delta'] : 0, + ); } } + + return $form; } diff --git a/sites/all/modules/ctools/plugins/relationships/term_from_node.inc b/sites/all/modules/ctools/plugins/relationships/term_from_node.inc index 2304367820f85ed6deb51cca6918edff0255cdf7..38f6aeaa0e2f73e234c599d3967f244ac3cb69de 100644 --- a/sites/all/modules/ctools/plugins/relationships/term_from_node.inc +++ b/sites/all/modules/ctools/plugins/relationships/term_from_node.inc @@ -25,7 +25,7 @@ $plugin = array( function ctools_term_from_node_context($context, $conf) { // If unset it wants a generic, unfilled context, which is just NULL. if (empty($context->data)) { - return ctools_context_create_empty('entity_taxonomy:term', NULL); + return ctools_context_create_empty('entity:taxonomy_term', NULL); } if (isset($context->data->taxonomy)) { diff --git a/sites/all/modules/ctools/plugins/relationships/terms_from_node.inc b/sites/all/modules/ctools/plugins/relationships/terms_from_node.inc index e8eaa545c085bd150f1ea08a3eb55197c999f8de..ddba9ed47a262849d361756be2b4e94bfabb681a 100644 --- a/sites/all/modules/ctools/plugins/relationships/terms_from_node.inc +++ b/sites/all/modules/ctools/plugins/relationships/terms_from_node.inc @@ -29,18 +29,25 @@ function ctools_terms_from_node_context($context, $conf) { } // Collect all terms for the chosen vocabulary and concatenate them. - if (isset($context->data->taxonomy)) { - $terms = array(); - foreach ($context->data->taxonomy as $term) { - if (in_array($term->vid, $conf['vid'])) { - $terms[] = $term->tid; + $node = $context->data; + $terms = array(); + + $fields = field_info_instances('node', $node->type); + foreach ($fields as $name => $info) { + $field_info = field_info_field($name); + if ($field_info['type'] == 'taxonomy_term_reference') { + $items = field_get_items('node', $node, $name); + if (is_array($items)) { + foreach ($items as $item) { + $terms[] = $item['tid']; + } } } - - if (!empty($terms)) { - $all_terms = ctools_break_phrase(implode($conf['concatenator'], $terms)); - return ctools_context_create('terms', $all_terms); - } + } + + if (!empty($terms)) { + $all_terms = ctools_break_phrase(implode($conf['concatenator'], $terms)); + return ctools_context_create('terms', $all_terms); } } diff --git a/sites/all/modules/ctools/stylizer/stylizer.info b/sites/all/modules/ctools/stylizer/stylizer.info index 96b7db6f311a7d41cb7e59b978a9c00e4b1836ce..5398713d38e0fa642492dae9fb7a49028a130732 100644 --- a/sites/all/modules/ctools/stylizer/stylizer.info +++ b/sites/all/modules/ctools/stylizer/stylizer.info @@ -5,9 +5,9 @@ package = Chaos tool suite dependencies[] = ctools dependencies[] = color -; Information added by drupal.org packaging script on 2011-05-31 -version = "7.x-1.0-beta1" +; Information added by drupal.org packaging script on 2011-07-28 +version = "7.x-1.0-rc1" core = "7.x" project = "ctools" -datestamp = "1306885315" +datestamp = "1311894415" diff --git a/sites/all/modules/ctools/stylizer/stylizer.install b/sites/all/modules/ctools/stylizer/stylizer.install index cee8b74815b9511c99274b28803e896190017577..5cefb0ddfb4d8c0ea461d61ee08e8ff7dd3a57fe 100644 --- a/sites/all/modules/ctools/stylizer/stylizer.install +++ b/sites/all/modules/ctools/stylizer/stylizer.install @@ -18,6 +18,12 @@ function stylizer_schema_1() { 'can disable' => TRUE, 'identifier' => 'style', 'primary key' => 'sid', + 'api' => array( + 'owner' => 'stylizer', + 'api' => 'stylizer', + 'minimum_version' => 1, + 'current_version' => 1, + ), ), 'fields' => array( 'sid' => array( diff --git a/sites/all/modules/ctools/tests/ctools_plugin_test.info b/sites/all/modules/ctools/tests/ctools_plugin_test.info index 83ec9dc0b18a1a8ccbadb2a5acb060432d185084..b15e4649ba8d90b9bf2d3b13e89838872ec895ef 100644 --- a/sites/all/modules/ctools/tests/ctools_plugin_test.info +++ b/sites/all/modules/ctools/tests/ctools_plugin_test.info @@ -7,9 +7,9 @@ files[] = ctools.plugins.test files[] = object_cache.test hidden = TRUE -; Information added by drupal.org packaging script on 2011-05-31 -version = "7.x-1.0-beta1" +; Information added by drupal.org packaging script on 2011-07-28 +version = "7.x-1.0-rc1" core = "7.x" project = "ctools" -datestamp = "1306885315" +datestamp = "1311894415" diff --git a/sites/all/modules/ctools/views_content/plugins/content_types/views.inc b/sites/all/modules/ctools/views_content/plugins/content_types/views.inc index 1a7be12d7cb57a7e68bece6d096e8f8aa9eee847..04b6869ac462e576d4319b39e162c14638ba4630 100644 --- a/sites/all/modules/ctools/views_content/plugins/content_types/views.inc +++ b/sites/all/modules/ctools/views_content/plugins/content_types/views.inc @@ -427,6 +427,8 @@ function views_content_views_content_type_admin_info($subtype, $conf, $contexts) } $display = empty($conf['display']) ? $view->current_display : $conf['display']; + $block = new stdClass(); + $block->title = t('View information'); $block->content = '<ul>'; diff --git a/sites/all/modules/ctools/views_content/plugins/content_types/views_row.inc b/sites/all/modules/ctools/views_content/plugins/content_types/views_row.inc index 827d36035ad3658f1d14da897b2d99ba166a305f..254f7b5f247b1059d6be40bfc006a3bef1424d36 100644 --- a/sites/all/modules/ctools/views_content/plugins/content_types/views_row.inc +++ b/sites/all/modules/ctools/views_content/plugins/content_types/views_row.inc @@ -163,7 +163,11 @@ function views_content_views_row_edit_submit(&$form, &$form_state) { } function views_content_views_row_content_type_admin_info($subtype, $conf, $contexts) { - $context = $contexts[$conf['context']]; + // Go through this route to make sure we catch changes in configuration + // that can happen. + $plugin = ctools_get_content_type('views_row'); + $context = ctools_content_select_context($plugin, $subtype, $conf, $contexts); + $block->title = t('Row information'); if (!empty($conf['use_fields'])) { diff --git a/sites/all/modules/ctools/views_content/plugins/relationships/node_from_view.inc b/sites/all/modules/ctools/views_content/plugins/relationships/node_from_view.inc index 55ed945763ba7fb55cb43851740d6a6c7bcc7908..0f3fa8e0a81a579b5abb8785583a97bcaa3d13db 100644 --- a/sites/all/modules/ctools/views_content/plugins/relationships/node_from_view.inc +++ b/sites/all/modules/ctools/views_content/plugins/relationships/node_from_view.inc @@ -15,8 +15,8 @@ $plugin = array( 'description' => t('Extract a node context from a view context of the base type node.'), 'required context' => new ctools_context_required(t('View'), 'view', array('base' => 'node')), 'context' => 'views_content_node_from_view_context', - 'settings form' => 'views_content_node_from_view_settings_form', - 'settings form validate' => 'views_content_node_from_view_settings_form_validate', + 'edit form' => 'views_content_node_from_view_settings_form', + 'edit form validate' => 'views_content_node_from_view_settings_form_validate', 'defaults' => array('row' => 1), ); diff --git a/sites/all/modules/ctools/views_content/plugins/relationships/term_from_view.inc b/sites/all/modules/ctools/views_content/plugins/relationships/term_from_view.inc index bc75062a5c31d4b2086ea5bc9de707b26d1b5094..bdd25b850255dab56cdfa5f51aa17350d5f2e48e 100644 --- a/sites/all/modules/ctools/views_content/plugins/relationships/term_from_view.inc +++ b/sites/all/modules/ctools/views_content/plugins/relationships/term_from_view.inc @@ -15,8 +15,8 @@ $plugin = array( 'description' => t('Extract a term context from a view context of the base type term.'), 'required context' => new ctools_context_required(t('View'), 'view', array('base' => 'term_data')), 'context' => 'views_content_term_from_view_context', - 'settings form' => 'views_content_term_from_view_settings_form', - 'settings form validate' => 'views_content_term_from_view_settings_form_validate', + 'edit form' => 'views_content_term_from_view_settings_form', + 'edit form validate' => 'views_content_term_from_view_settings_form_validate', 'defaults' => array('row' => 1), ); diff --git a/sites/all/modules/ctools/views_content/plugins/relationships/user_from_view.inc b/sites/all/modules/ctools/views_content/plugins/relationships/user_from_view.inc index eb594859371fa6d8754c3d781da5512ba864e640..47c4693cc93f0027f98c5306e096d0196043ecc3 100644 --- a/sites/all/modules/ctools/views_content/plugins/relationships/user_from_view.inc +++ b/sites/all/modules/ctools/views_content/plugins/relationships/user_from_view.inc @@ -15,8 +15,8 @@ $plugin = array( 'description' => t('Extract a user context from a view context of the base type user.'), 'required context' => new ctools_context_required(t('View'), 'view', array('base' => 'users')), 'context' => 'views_content_user_from_view_context', - 'settings form' => 'views_content_user_from_view_settings_form', - 'settings form validate' => 'views_content_user_from_view_settings_form_validate', + 'edit form' => 'views_content_user_from_view_settings_form', + 'edit form validate' => 'views_content_user_from_view_settings_form_validate', 'defaults' => array('row' => 1), ); diff --git a/sites/all/modules/ctools/views_content/plugins/views/views_content_plugin_display_panel_pane.inc b/sites/all/modules/ctools/views_content/plugins/views/views_content_plugin_display_panel_pane.inc index 06225afbb9aaa5d09eb9614db55f52f9fb0bbf35..2b45849b61b008107dd6745f8745997f6526dd61 100644 --- a/sites/all/modules/ctools/views_content/plugins/views/views_content_plugin_display_panel_pane.inc +++ b/sites/all/modules/ctools/views_content/plugins/views/views_content_plugin_display_panel_pane.inc @@ -384,6 +384,11 @@ class views_content_plugin_display_panel_pane extends views_plugin_display { return $this->view->override_path; } + function uses_exposed_form_in_block() { + // We'll always allow the exposed form in a block, regardless of path. + return TRUE; + } + /** * Determine if this display should display the exposed * filters widgets, so the view will know whether or not diff --git a/sites/all/modules/ctools/views_content/plugins/views/views_content_plugin_style_ctools_context.inc b/sites/all/modules/ctools/views_content/plugins/views/views_content_plugin_style_ctools_context.inc index 837f2e1775e07fe22aacedf425c9d8377179087d..513de3ce561124a22f4b672b732840756faec249 100644 --- a/sites/all/modules/ctools/views_content/plugins/views/views_content_plugin_style_ctools_context.inc +++ b/sites/all/modules/ctools/views_content/plugins/views/views_content_plugin_style_ctools_context.inc @@ -13,17 +13,6 @@ class views_content_plugin_style_ctools_context extends views_plugin_style { var $rows = array(); - /** - * Set default options - */ - function options(&$options) { - parent::options($options); - } - - function options_form(&$form, &$form_state) { - parent::options_form($form, $form_state); - } - /** * Render the display in this style. */ diff --git a/sites/all/modules/ctools/views_content/views_content.info b/sites/all/modules/ctools/views_content/views_content.info index 1da408bf2ced83ae735dacf05ca9784d161c90d7..f484b85576bb0bf7a18c900884a5c26e0da830d7 100644 --- a/sites/all/modules/ctools/views_content/views_content.info +++ b/sites/all/modules/ctools/views_content/views_content.info @@ -9,9 +9,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 2011-05-31 -version = "7.x-1.0-beta1" +; Information added by drupal.org packaging script on 2011-07-28 +version = "7.x-1.0-rc1" core = "7.x" project = "ctools" -datestamp = "1306885315" +datestamp = "1311894415"