contrib modules security updates

This commit is contained in:
Bachir Soussi Chiadmi
2016-10-13 12:10:40 +02:00
parent ffd758abc9
commit 747127f643
732 changed files with 67976 additions and 23207 deletions

View File

@@ -25,7 +25,7 @@ $plugin = array(
*/
function panels_simple_cache_get_cache($conf, $display, $args, $contexts, $pane = NULL) {
$cid = panels_simple_cache_get_id($conf, $display, $args, $contexts, $pane);
$cache = cache_get($cid, 'cache');
$cache = cache_get($cid, 'cache_panels');
if (!$cache) {
return FALSE;
}
@@ -42,7 +42,7 @@ function panels_simple_cache_get_cache($conf, $display, $args, $contexts, $pane
*/
function panels_simple_cache_set_cache($conf, $content, $display, $args, $contexts, $pane = NULL) {
$cid = panels_simple_cache_get_id($conf, $display, $args, $contexts, $pane);
cache_set($cid, $content);
cache_set($cid, $content, 'cache_panels');
}
/**
@@ -53,13 +53,25 @@ function panels_simple_cache_set_cache($conf, $content, $display, $args, $contex
function panels_simple_cache_clear_cache($display) {
$cid = 'panels_simple_cache';
// This is used in case this is an in-code display, which means did will be something like 'new-1'.
if (isset($display->owner) && isset($display->owner->id)) {
$cid .= ':' . $display->owner->id;
// If the panel is stored in the database it'll have a numeric did value.
if (is_numeric($display->did)) {
$cid .= ':' . $display->did;
}
// Exported panels won't have a numeric did but may have a usable cache_key.
elseif (!empty($display->cache_key)) {
$cid .= ':' . str_replace('panel_context:', '', $display->cache_key);
}
// Alternatively use the css_id.
elseif (!empty($display->css_id)) {
$cid .= ':' . $display->css_id;
}
// Failover to just appending the did, which may be the completely unusable
// string 'new'.
else {
$cid .= ':' . $display->did;
}
$cid .= ':' . $display->did;
cache_clear_all($cid, 'cache', TRUE);
cache_clear_all($cid, 'cache_panels', TRUE);
}
/**

View File

@@ -61,6 +61,7 @@ class panels_renderer_editor extends panels_renderer_standard {
ctools_add_js('display_editor', 'panels');
ctools_add_css('panels_dnd', 'panels');
ctools_add_css('panels_admin', 'panels');
drupal_add_library('system', 'ui');
}
}
@@ -161,7 +162,7 @@ class panels_renderer_editor extends panels_renderer_standard {
if ($buttons) {
$output .= '<span class="buttons">' . $buttons . '</span>';
}
$output .= '<span class="text">' . $title . '</span>';
$output .= '<span class="text" title="' . check_plain($title) . '">' . $title . '</span>';
$output .= '</div>'; // grabber
$output .= '<div class="panel-pane-collapsible">';
@@ -186,12 +187,12 @@ class panels_renderer_editor extends panels_renderer_standard {
$style_title = isset($style['title']) ? $style['title'] : t('Default');
$style_links[] = array(
$style_links['title'] = array(
'title' => $style_title,
'attributes' => array('class' => array('panels-text')),
);
$style_links[] = array(
$style_links['change'] = array(
'title' => t('Change'),
'href' => $this->get_url('style-type', $type, $id),
'attributes' => array('class' => array('ctools-use-modal')),
@@ -199,7 +200,7 @@ class panels_renderer_editor extends panels_renderer_standard {
$function = $type != 'pane' ? 'settings form' : 'pane settings form';
if (panels_plugin_get_function('styles', $style, $function)) {
$style_links[] = array(
$style_links['settings'] = array(
'title' => t('Settings'),
'href' => $this->get_url('style-settings', $type, $id),
'attributes' => array('class' => array('ctools-use-modal')),
@@ -307,14 +308,14 @@ class panels_renderer_editor extends panels_renderer_standard {
$links = array();
if (!empty($pane->shown)) {
$links[] = array(
$links['top']['disabled'] = array(
'title' => t('Disable this pane'),
'href' => $this->get_url('hide', $pane->pid),
'attributes' => array('class' => array('use-ajax')),
);
}
else {
$links[] = array(
$links['top']['enable'] = array(
'title' => t('Enable this pane'),
'href' => $this->get_url('show', $pane->pid),
'attributes' => array('class' => array('use-ajax')),
@@ -322,13 +323,13 @@ class panels_renderer_editor extends panels_renderer_standard {
}
if (isset($this->display->title_pane) && $this->display->title_pane == $pane->pid) {
$links['panels-set-title'] = array(
$links['top']['panels-set-title'] = array(
'title' => t('&#x2713;Panel title'),
'html' => TRUE,
);
}
else {
$links['panels-set-title'] = array(
$links['top']['panels-set-title'] = array(
'title' => t('Panel title'),
'href' => $this->get_url('panel-title', $pane->pid),
'attributes' => array('class' => array('use-ajax')),
@@ -338,7 +339,7 @@ class panels_renderer_editor extends panels_renderer_standard {
$subtype = ctools_content_get_subtype($content_type, $pane->subtype);
if (ctools_content_editable($content_type, $subtype, $pane->configuration)) {
$links[] = array(
$links['top']['settings'] = array(
'title' => isset($content_type['edit text']) ? $content_type['edit text'] : t('Settings'),
'href' => $this->get_url('edit-pane', $pane->pid),
'attributes' => array('class' => array('ctools-use-modal')),
@@ -346,7 +347,7 @@ class panels_renderer_editor extends panels_renderer_standard {
}
if (user_access('administer advanced pane settings')) {
$links[] = array(
$links['top']['css'] = array(
'title' => t('CSS properties'),
'href' => $this->get_url('pane-css', $pane->pid),
'attributes' => array('class' => array('ctools-use-modal')),
@@ -354,26 +355,10 @@ class panels_renderer_editor extends panels_renderer_standard {
}
if (user_access('administer panels styles')) {
$links[] = array(
'title' => '<hr />',
'html' => TRUE,
);
$style_links = $this->get_style_links('pane', $pane->pid);
$links[] = array(
'title' => '<span class="dropdown-header">' . t('Style') . '</span>' . theme_links(array('links' => $style_links, 'attributes' => array(), 'heading' => array())),
'html' => TRUE,
'attributes' => array('class' => array('panels-sub-menu')),
);
$links['style'] = $this->get_style_links('pane', $pane->pid);
}
if (user_access('administer pane access')) {
$links[] = array(
'title' => '<hr />',
'html' => TRUE,
);
$contexts = $this->display->context;
// Make sure we have the logged in user context
if (!isset($contexts['logged-in-user'])) {
@@ -385,7 +370,7 @@ class panels_renderer_editor extends panels_renderer_standard {
if (!empty($pane->access['plugins'])) {
foreach ($pane->access['plugins'] as $id => $test) {
$plugin = ctools_get_access_plugin($test['name']);
$access_title = isset($plugin['title']) ? $plugin['title'] : t('Broken/missing access plugin %plugin', array('%plugin' => $test['name']));
$access_title = isset($plugin['title']) ? $plugin['title'] : t('Broken/missing access plugin %plugin', array('%plugin' => $test['name']));
$access_description = ctools_access_summary($plugin, $contexts, $test);
$visibility_links[] = array(
@@ -396,37 +381,28 @@ class panels_renderer_editor extends panels_renderer_standard {
}
}
if (empty($visibility_links)) {
$visibility_links[] = array(
$visibility_links['no_rules'] = array(
'title' => t('No rules'),
'attributes' => array('class' => array('panels-text')),
);
}
$visibility_links[] = array(
$visibility_links['add_rule'] = array(
'title' => t('Add new rule'),
'href' => $this->get_url('access-add-test', $pane->pid),
'attributes' => array('class' => array('ctools-use-modal')),
);
$visibility_links[] = array(
$visibility_links['settings'] = array(
'title' => t('Settings'),
'href' => $this->get_url('access-settings', $pane->pid),
'attributes' => array('class' => array('ctools-use-modal')),
);
$links[] = array(
'title' => '<span class="dropdown-header">' . t('Visibility rules') . '</span>' . theme_links(array('links' => $visibility_links, 'attributes' => array(), 'heading' => array())),
'html' => TRUE,
'attributes' => array('class' => array('panels-sub-menu')),
);
$links['visibility'] = $visibility_links;
}
if (user_access('use panels locks')) {
$links[] = array(
'title' => '<hr />',
'html' => TRUE,
);
$lock_type = !empty($pane->locks['type']) ? $pane->locks['type'] : 'none';
switch ($lock_type) {
case 'immovable':
@@ -441,62 +417,44 @@ class panels_renderer_editor extends panels_renderer_standard {
break;
}
$lock_links[] = array(
$lock_links['lock'] = array(
'title' => $lock_method,
'attributes' => array('class' => array('panels-text')),
);
$lock_links[] = array(
$lock_links['change'] = array(
'title' => t('Change'),
'href' => $this->get_url('lock', $pane->pid),
'attributes' => array('class' => array('ctools-use-modal')),
);
$links[] = array(
'title' => '<span class="dropdown-header">' . t('Locking') . '</span>' . theme_links(array('links' => $lock_links, 'attributes' => array(), 'heading' => array())),
'html' => TRUE,
'attributes' => array('class' => array('panels-sub-menu')),
);
$links['lock'] = $lock_links;
}
if (panels_get_caches() && user_access('use panels caching features')) {
$links[] = array(
'title' => '<hr />',
'html' => TRUE,
);
$method = isset($pane->cache['method']) ? $pane->cache['method'] : 0;
$info = panels_get_cache($method);
$cache_method = isset($info['title']) ? $info['title'] : t('No caching');
$cache_links[] = array(
$cache_links['title'] = array(
'title' => $cache_method,
'attributes' => array('class' => array('panels-text')),
);
$cache_links[] = array(
$cache_links['change'] = array(
'title' => t('Change'),
'href' => $this->get_url('cache-method', $pane->pid),
'attributes' => array('class' => array('ctools-use-modal')),
);
if (panels_plugin_get_function('cache', $info, 'settings form')) {
$cache_links[] = array(
$cache_links['settings'] = array(
'title' => t('Settings'),
'href' => $this->get_url('cache-settings', $pane->pid),
'attributes' => array('class' => array('ctools-use-modal')),
);
}
$links[] = array(
'title' => '<span class="dropdown-header">' . t('Caching') . '</span>' . theme_links(array('links' => $cache_links, 'attributes' => array(), 'heading' => array())),
'html' => TRUE,
'attributes' => array('class' => array('panels-sub-menu')),
);
$links['cache'] = $cache_links;
}
$links[] = array(
'title' => '<hr />',
'html' => TRUE,
);
$links[] = array(
$links['bottom']['remove'] = array(
'title' => t('Remove'),
'href' => '#',
'attributes' => array(
@@ -505,7 +463,38 @@ class panels_renderer_editor extends panels_renderer_standard {
),
);
return theme('ctools_dropdown', array('title' => theme('image', array('path' => ctools_image_path('icon-configure.png', 'panels'))), 'links' => $links, 'image' => TRUE));
// Allow others to add/remove links from pane context menu.
// Grouped by 'top', 'style', 'visibility', 'lock', 'cache' and 'bottom'
drupal_alter('get_pane_links', $links, $pane, $content_type);
$dropdown_links = $links['top'];
$category_labels = array(
'style' => 'Style',
'visibility' => 'Visibility rules',
'lock' => 'Locking',
'cache' => 'Caching',
);
foreach ($category_labels as $category => $label) {
if (array_key_exists($category, $links)) {
$dropdown_links[] = array(
'title' => '<hr />',
'html' => TRUE,
);
$dropdown_links[] = array(
'title' => '<span class="dropdown-header">' . t($label) . '</span>' . theme_links(array('links' => $links[$category], 'attributes' => array(), 'heading' => array())),
'html' => TRUE,
'attributes' => array('class' => array('panels-sub-menu')),
);
}
}
$dropdown_links[] = array(
'title' => '<hr />',
'html' => TRUE,
);
$dropdown_links = array_merge($dropdown_links, $links['bottom']);
return theme('ctools_dropdown', array('title' => theme('image', array('path' => ctools_image_path('icon-configure.png', 'panels'))), 'links' => $dropdown_links, 'image' => TRUE));
}
// -----------------------------------------------------------------------
@@ -525,6 +514,40 @@ class panels_renderer_editor extends panels_renderer_standard {
return $url;
}
/**
* Get the Panels storage oparation for a given renderer AJAX method.
*
* @param string $method
* The method name.
*
* @return string
* The Panels storage op.
*/
function get_panels_storage_op_for_ajax($method) {
switch ($method) {
case 'ajax_show':
case 'ajax_hide':
case 'ajax_select_content':
case 'ajax_add_pane':
case 'ajax_edit_pane':
case 'ajax_panel_title':
case 'ajax_cache_method':
case 'ajax_cache_settings':
case 'ajax_style_type':
case 'ajax_style_settings':
case 'ajax_pane_css':
case 'ajax_lock':
case 'ajax_access_settings':
case 'ajax_access_add_test':
case 'ajax_access_configure_test':
case 'ajax_layout':
case 'ajax_style':
return 'update';
}
return parent::get_panels_storage_op_for_ajax($method);
}
/**
* AJAX command to show a pane.
*/
@@ -572,6 +595,11 @@ class panels_renderer_editor extends panels_renderer_standard {
$output = theme('panels_add_content_modal', array('renderer' => $this, 'categories' => $categories, 'category' => $category, 'region' => $region));
}
$this->commands[] = ctools_modal_command_display($title, $output);
// Give keybord focus to the first item in the category we just loaded.
if (!empty($category)) {
$this->commands[] = ajax_command_invoke(".panels-add-content-modal .panels-section-columns :focusable:first", 'focus');
}
}
/**
@@ -656,7 +684,19 @@ class panels_renderer_editor extends panels_renderer_standard {
$content_type = ctools_get_content_type($type_name);
$subtype = ctools_content_get_subtype($content_type, $subtype_name);
if (!isset($step) || !isset($this->cache->new_pane)) {
// Determine if we are adding a different pane than previously cached. This
// is used to load the different pane into cache so that multistep forms
// have the correct context instead of a previously cached version that
// does not match the pane currently being added.
$is_different_pane = FALSE;
if (isset($this->cache) && isset($this->cache->new_pane)) {
$diff_type = $type_name != $this->cache->new_pane->type;
$diff_subtype = $subtype_name != $this->cache->new_pane->subtype;
$is_different_pane = $diff_type || $diff_subtype;
}
if (!isset($step) || !isset($this->cache->new_pane) || $is_different_pane) {
$pane = panels_new_pane($type_name, $subtype_name, TRUE);
$this->cache->new_pane = &$pane;
}
@@ -947,8 +987,11 @@ class panels_renderer_editor extends panels_renderer_standard {
ctools_include('content');
$pane = &$this->display->content[$pid];
$style = isset($pane->style['style']) ? $pane->style['style'] : 'default';
$subtype = ctools_content_get_subtype($pane->type, $pane->subtype);
$title = t('Pane style for "!pane"', array('!pane' => $subtype['title']));
$title = ctools_content_admin_title($pane->type, $pane->subtype, $pane->configuration, $this->display->context);
if (!$title) {
$title = $pane->type;
}
$title = t('Pane style for "!title"', array('!title' => $title));
break;
default:
@@ -1163,9 +1206,21 @@ class panels_renderer_editor extends panels_renderer_standard {
unset($this->cache->style);
}
if (!empty($form_state['cancel'])) {
// The cache must be saved prior to dismissing the modal.
panels_edit_cache_set($this->cache);
$this->commands[] = ctools_modal_command_dismiss();
return;
}
// Copy settings from form state back into the cache.
if(!empty($form_state['values']['settings'])) {
$this->cache->display->content[$pid]->style['settings'] = $form_state['values']['settings'];
if ($type == 'pane') {
$this->cache->display->content[$pid]->style['settings'] = $form_state['values']['settings'];
}
else if($type == 'region') {
$this->cache->display->panel_settings['style_settings'][$pid] = $form_state['values']['settings'];
}
}
panels_edit_cache_set($this->cache);
@@ -1485,7 +1540,7 @@ function panels_ajax_edit_pane_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.
@@ -1510,6 +1565,8 @@ function panels_ajax_edit_pane_cancel(&$form_state) {
* Choose cache method form
*/
function panels_edit_cache_method_form($form, &$form_state) {
ctools_form_include($form_state, 'plugins', 'panels');
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
$display = &$form_state['display'];
$conf = &$form_state['conf'];
@@ -1558,6 +1615,8 @@ function panels_edit_cache_method_form_submit($form, &$form_state) {
* Cache settings form
*/
function panels_edit_cache_settings_form($form, &$form_state) {
ctools_form_include($form_state, 'plugins', 'panels');
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
$display = &$form_state['display'];
$conf = &$form_state['conf'];
$pid = $form_state['pid'];
@@ -1618,6 +1677,8 @@ function panels_edit_cache_settings_form_submit($form, &$form_state) {
* Choose style form
*/
function panels_edit_style_type_form($form, &$form_state) {
ctools_form_include($form_state, 'plugins', 'panels');
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
$display = &$form_state['display'];
$style = $form_state['style'];
$type = $form_state['type'];
@@ -1668,6 +1729,8 @@ function panels_edit_style_type_form_submit($form, &$form_state) {
* Style settings form
*/
function panels_edit_style_settings_form($form, &$form_state) {
ctools_form_include($form_state, 'plugins', 'panels');
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
$display = &$form_state['display'];
$conf = &$form_state['conf'];
$pid = $form_state['pid'];
@@ -1692,9 +1755,28 @@ function panels_edit_style_settings_form($form, &$form_state) {
'#value' => t('Save'),
);
// Need a cancel button since the style cache can persist and impact the wrong
// pane (or region, or display).
$form['cancel_style'] = array(
'#type' => 'submit',
'#value' => t('Cancel'),
'#submit' => array('panels_edit_style_settings_form_cancel'),
);
return $form;
}
/**
* Cancel style settings form.
*
* Clears the editing cache to prevent styles being applied to incorrect regions
* or panes.
*/
function panels_edit_style_settings_form_cancel($form, &$form_state) {
$form_state['cancel'] = TRUE;
}
/**
* Validate style settings.
*/
@@ -1722,6 +1804,8 @@ function panels_edit_style_settings_form_submit($form, &$form_state) {
* Configure CSS on a pane form.
*/
function panels_edit_configure_pane_css_form($form, &$form_state) {
ctools_form_include($form_state, 'plugins', 'panels');
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
$display = &$form_state['display'];
$pane = &$form_state['pane'];
@@ -1729,13 +1813,13 @@ function panels_edit_configure_pane_css_form($form, &$form_state) {
'#type' => 'textfield',
'#default_value' => isset($pane->css['css_id']) ? $pane->css['css_id'] : '',
'#title' => t('CSS ID'),
'#description' => t('CSS ID to apply to this pane. This may be blank.'),
'#description' => t('CSS ID to apply to this pane. This may be blank. Keywords from context are allowed.'),
);
$form['css_class'] = array(
'#type' => 'textfield',
'#default_value' => isset($pane->css['css_class']) ? $pane->css['css_class'] : '',
'#title' => t('CSS class'),
'#description' => t('CSS class to apply to this pane. This may be blank.'),
'#description' => t('CSS class to apply to this pane. This may be blank. Keywords from context are allowed.'),
);
$form['next'] = array(
@@ -1764,6 +1848,8 @@ function panels_edit_configure_pane_css_form_submit($form, &$form_state) {
* Configure lock on a pane form.
*/
function panels_edit_configure_pane_lock_form($form, &$form_state) {
ctools_form_include($form_state, 'plugins', 'panels');
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
$display = &$form_state['display'];
$pane = &$form_state['pane'];
@@ -1839,6 +1925,8 @@ function panels_edit_configure_pane_lock_form_submit($form, &$form_state) {
* Form to control basic visibility settings.
*/
function panels_edit_configure_access_settings_form($form, &$form_state) {
ctools_form_include($form_state, 'plugins', 'panels');
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
$display = &$form_state['display'];
$pane = &$form_state['pane'];
@@ -1876,6 +1964,8 @@ function panels_edit_configure_access_settings_form_submit($form, &$form_state)
* Form to add a visibility rule.
*/
function panels_edit_add_access_test_form($form, &$form_state) {
ctools_form_include($form_state, 'plugins', 'panels');
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
$display = &$form_state['display'];
$pane = &$form_state['pane'];
@@ -1905,6 +1995,8 @@ function panels_edit_add_access_test_form($form, &$form_state) {
* Form to configure a visibility rule.
*/
function panels_edit_configure_access_test_form($form, &$form_state) {
ctools_form_include($form_state, 'plugins', 'panels');
form_load_include($form_state, 'php', 'panels', '/plugins/display_renderers/panels_renderer_editor.class');
$display = &$form_state['display'];
$test = &$form_state['test'];
$plugin = &$form_state['plugin'];

View File

@@ -151,6 +151,15 @@ class panels_renderer_standard {
*/
var $suffix = '';
/**
* Boolean flag indicating whether to render the layout even if all rendered
* regions are blank. If FALSE, the layout renders as an empty string (without
* prefix or suffix) if not in administrative mode.
*
* @var bool
*/
var $show_empty_layout = TRUE;
/**
* Receive and store the display object to be rendered.
*
@@ -176,6 +185,19 @@ class panels_renderer_standard {
}
}
/**
* Get the Panels storage oparation for a given renderer AJAX method.
*
* @param string $method
* The method name.
*
* @return string
* The Panels storage op.
*/
function get_panels_storage_op_for_ajax($method) {
return 'read';
}
/**
* Prepare the attached display for rendering.
*
@@ -396,6 +418,22 @@ class panels_renderer_standard {
$theme = $this->plugins['layout']['theme'];
}
// Determine whether to render layout.
$show = TRUE;
if (!$this->show_empty_layout && !$this->admin) {
$show = FALSE;
// Render layout if any region is not empty.
foreach ($this->rendered['regions'] as $region) {
if (is_string($region) && $region !== '') {
$show = TRUE;
break;
}
}
}
if (!$show) {
return;
}
$this->rendered['layout'] = theme($theme, array('css_id' => check_plain($this->display->css_id), 'content' => $this->rendered['regions'], 'settings' => $this->display->layout_settings, 'display' => $this->display, 'layout' => $this->plugins['layout'], 'renderer' => $this));
return $this->prefix . $this->rendered['layout'] . $this->suffix;
}
@@ -407,17 +445,38 @@ class panels_renderer_standard {
* their CSS added in the right order: inner content before outer content.
*/
function add_meta() {
global $theme;
if (!empty($this->plugins['layout']['css'])) {
if (file_exists(path_to_theme() . '/' . $this->plugins['layout']['css'])) {
$this->add_css(path_to_theme() . '/' . $this->plugins['layout']['css']);
// Do not use the path_to_theme() function, because it returns the
// $GLOBALS['theme_path'] value, which may be overriden in the theme()
// function when the theme hook defines the key 'theme path'.
$theme_path = isset($theme) ? drupal_get_path('theme', $theme) : '';
$css = $this->plugins['layout']['css'];
if (!is_array($css)) {
$css = array($css);
}
else {
$this->add_css($this->plugins['layout']['path'] . '/' . $this->plugins['layout']['css']);
// Load each of the CSS files defined in this layout.
foreach ($css as $file) {
if (!empty($theme_path) && file_exists($theme_path . '/' . $file)) {
$this->add_css($theme_path . '/' . $file);
}
else {
$this->add_css($this->plugins['layout']['path'] . '/' . $file);
}
}
}
if ($this->admin && isset($this->plugins['layout']['admin css'])) {
$this->add_css($this->plugins['layout']['path'] . '/' . $this->plugins['layout']['admin css']);
$admin_css = $this->plugins['layout']['admin css'];
if (!is_array($admin_css)) {
$admin_css = array($admin_css);
}
foreach ($admin_css as $file) {
$this->add_css($this->plugins['layout']['path'] . '/' . $file);
}
}
}
@@ -453,6 +512,7 @@ class panels_renderer_standard {
* The array of rendered panes, keyed on pane pid.
*/
function render_panes() {
drupal_alter('panels_prerender_panes', $this);
ctools_include('content');
// First, render all the panes into little boxes.
@@ -477,6 +537,8 @@ class panels_renderer_standard {
* A Panels pane object, as loaded from the database.
*/
function render_pane(&$pane) {
module_invoke_all('panels_pane_prerender', $pane);
$content = $this->render_pane_content($pane);
if ($this->display->hide_title == PANELS_TITLE_PANE && !empty($this->display->title_pane) && $this->display->title_pane == $pane->pid) {
@@ -530,7 +592,6 @@ class panels_renderer_standard {
$this->display->context = array();
}
$content = FALSE;
$caching = !empty($pane->cache['method']) && empty($this->display->skip_cache);
if ($caching && ($cache = panels_get_cached_content($this->display, $this->display->args, $this->display->context, $pane))) {
$content = $cache->content;
@@ -544,10 +605,6 @@ class panels_renderer_standard {
$content = ctools_content_render($pane->type, $pane->subtype, $pane->configuration, array(), $this->display->args, $this->display->context);
if (empty($content)) {
return;
}
foreach (module_implements('panels_pane_content_alter') as $module) {
$function = $module . '_panels_pane_content_alter';
$function($content, $pane, $this->display->args, $this->display->context, $this, $this->display);
@@ -559,14 +616,19 @@ class panels_renderer_standard {
}
}
// Pass long the css_id that is usually available.
if (!empty($pane->css['css_id'])) {
$content->css_id = check_plain($pane->css['css_id']);
}
// If there's content, check if we've css configuration to add.
if (!empty($content)) {
// Pass long the css_id that is usually available.
if (!empty($pane->css['css_id'])) {
$id = ctools_context_keyword_substitute($pane->css['css_id'], array(), $this->display->context);
$content->css_id = check_plain($id);
}
// Pass long the css_class that is usually available.
if (!empty($pane->css['css_class'])) {
$content->css_class = check_plain($pane->css['css_class']);
// Pass long the css_class that is usually available.
if (!empty($pane->css['css_class'])) {
$class = ctools_context_keyword_substitute($pane->css['css_class'], array(), $this->display->context, array('css safe' => TRUE));
$content->css_class = check_plain($class);
}
}
return $content;
@@ -580,6 +642,7 @@ class panels_renderer_standard {
* An array of rendered panel regions, keyed on the region name.
*/
function render_regions() {
drupal_alter('panels_prerender_regions', $this);
$this->rendered['regions'] = array();
// Loop through all panel regions, put all panes that belong to the current

View File

@@ -17,7 +17,7 @@ Drupal.flexible.fixHeight = function() {
Drupal.behaviors.flexibleAdmin = {
attach: function(context) {
// Show/hide layout manager button
$('input#panels-flexible-toggle-layout:not(.panels-flexible-processed)', context)
$('#panels-flexible-toggle-layout:not(.panels-flexible-processed)', context)
.addClass('panels-flexible-processed')
.click(function() {
$('.panel-flexible-admin')
@@ -290,9 +290,6 @@ Drupal.flexible.splitter = function($splitter) {
// if not moving the right side, adjust the parent padding instead.
splitter.parent.css('padding-left', (splitter.left_padding - moved) + 'px');
splitter.left.parent().css('margin-left', (splitter.left_parent + moved) + 'px');
if (jQuery.browser.msie) {
splitter.left.parent().css('left', splitter.currentLeft);
}
}
return false;
};

View File

@@ -471,15 +471,26 @@ function panels_flexible_render_items($renderer, $list, $owner_id) {
switch ($item['type']) {
case 'column':
$content = panels_flexible_render_items($renderer, $item['children'], $renderer->base['column'] . '-' . $id);
$groups[$location] .= panels_flexible_render_item($renderer, $item, $content, $id, $position, $max);
if (empty($renderer->settings['items'][$id]['hide_empty']) || trim($content)) {
$groups[$location] .= panels_flexible_render_item($renderer, $item, $content, $id, $position, $max);
}
break;
case 'row':
$content = panels_flexible_render_items($renderer, $item['children'], $renderer->base['row'] . '-' . $id);
$groups[$location] .= panels_flexible_render_item($renderer, $item, $content, $id, $position, $max, TRUE);
if (empty($renderer->settings['items'][$id]['hide_empty']) || trim($content)) {
$groups[$location] .= panels_flexible_render_item($renderer, $item, $content, $id, $position, $max, TRUE);
}
break;
case 'region':
$content = isset($renderer->content[$id]) ? $renderer->content[$id] : "&nbsp;";
$groups[$location] .= panels_flexible_render_item($renderer, $item, $content, $id, $position, $max);
if (empty($renderer->settings['items'][$id]['hide_empty'])) {
$content = isset($renderer->content[$id]) ? $renderer->content[$id] : "&nbsp;";
}
else {
$content = isset($renderer->content[$id]) ? trim($renderer->content[$id]) : "";
}
if (empty($renderer->settings['items'][$id]['hide_empty']) || $content) {
$groups[$location] .= panels_flexible_render_item($renderer, $item, $content, $id, $position, $max);
}
break;
}
@@ -1186,6 +1197,12 @@ function panels_flexible_config_item_form($form, &$form_state) {
}
}
$form['hide_empty'] = array(
'#title' => t('Hide element if empty'),
'#type' => 'checkbox',
'#default_value' => !empty($item['hide_empty']) ? 1 : 0,
);
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save'),
@@ -1223,6 +1240,7 @@ function panels_flexible_config_item_form_submit(&$form, &$form_state) {
else {
$item['contains'] = $form_state['values']['contains'];
}
$item['hide_empty'] = $form_state['values']['hide_empty'];
}
@@ -1486,6 +1504,12 @@ function panels_flexible_add_item_form($form, &$form_state) {
);
}
$form['hide_empty'] = array(
'#title' => t('Hide element if empty'),
'#type' => 'checkbox',
'#default_value' => 0,
);
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save'),
@@ -1516,6 +1540,8 @@ function panels_flexible_add_item_form_submit(&$form, &$form_state) {
$item['contains'] = $form_state['values']['contains'];
}
$item['hide_empty'] = $form_state['values']['hide_empty'];
if ($item['type'] == 'region') {
// derive the region key from the title
$key = preg_replace("/[^a-z0-9]/", '_', drupal_strtolower($item['title']));

View File

@@ -18,7 +18,7 @@
width: 25%;
}
.panel-3col-stacked .panel-col .inside {
.panel-3col-stacked .panel-col-first .inside {
margin: 0 .5em 1em .5em;
}

View File

@@ -66,6 +66,8 @@ function panels_landing_page_new_page(&$cache) {
);
$cache->display = panels_new_display();
$cache->display->layout = 'flexible';
$cache->display->storage_type = 'page_manager';
$cache->display->storage_id = 'new';
}
/**
@@ -257,6 +259,9 @@ function panels_landing_page_finish(&$form_state) {
// Create the the panel context variant configured with our display
$plugin = page_manager_get_task_handler('panel_context');
// Set the storage id.
$cache->display->storage_id = $cache->name;
// Create a new handler.
$handler = page_manager_new_task_handler($plugin);
$handler->conf['title'] = t('Landing page');

View File

@@ -0,0 +1,19 @@
<?php
/**
* @file
* Provides a panels_storage plugin for page_manager.
*/
// Plugin definition
$plugin = array(
'access callback' => 'page_manager_panels_storage_access',
);
/**
* Access callback for panels storage.
*/
function page_manager_panels_storage_access($storage_type, $storage_id, $op, $account) {
// Only users with the 'use page manager' or administer page manager perms.
return user_access('use page manager', $account) || user_access('administer page manager', $account) || user_access('use ipe with page manager', $account);
}

View File

@@ -286,7 +286,8 @@ function panels_panel_context_render($handler, $base_contexts, $args, $test = TR
$display->context = $contexts;
$display->args = $args;
$display->css_id = $handler->conf['css_id'];
$page_css_id = ctools_context_keyword_substitute($handler->conf['css_id'], array(), $contexts);
$display->css_id = check_plain($page_css_id);
$task_name = page_manager_make_task_name($handler->task, $handler->subtask);
$display->cache_key = panels_panel_context_cache_key($task_name, $handler->name, $args);
@@ -297,7 +298,9 @@ function panels_panel_context_render($handler, $base_contexts, $args, $test = TR
$css_id = 'panel_context:' . $handler->name;
$filename = ctools_css_retrieve($css_id);
if (!$filename) {
$filename = ctools_css_store($css_id, $handler->conf['css']);
// Add keywords from context
$css = ctools_context_keyword_substitute($handler->conf['css'], array(), $contexts, array('css safe' => TRUE));
$filename = ctools_css_store($css_id, $css);
}
drupal_add_css($filename);
}
@@ -317,11 +320,23 @@ function panels_panel_context_render($handler, $base_contexts, $args, $test = TR
// Remove and add body element classes
$panel_body_css = &drupal_static('panel_body_css');
if (isset($handler->conf['body_classes_to_remove']) && !isset($panel_body_css['body_classes_to_remove'])) {
$panel_body_css['body_classes_to_remove'] = $handler->conf['body_classes_to_remove'];
if (isset($handler->conf['body_classes_to_remove'])) {
$classes = ctools_context_keyword_substitute($handler->conf['body_classes_to_remove'], array(), $contexts, array('css safe' => TRUE));
if (!isset($panel_body_css['body_classes_to_remove'])) {
$panel_body_css['body_classes_to_remove'] = check_plain($classes);
}
else{
$panel_body_css['body_classes_to_remove'] .= ' ' . check_plain($classes);
}
}
if (isset($handler->conf['body_classes_to_add']) && !isset($panel_body_css['body_classes_to_add'])) {
$panel_body_css['body_classes_to_add'] = $handler->conf['body_classes_to_add'];
if (isset($handler->conf['body_classes_to_add'])) {
$classes = ctools_context_keyword_substitute($handler->conf['body_classes_to_add'], array(), $contexts, array('css safe' => TRUE));
if (!isset($panel_body_css['body_classes_to_add'])) {
$panel_body_css['body_classes_to_add'] = check_plain($classes);
}
else {
$panel_body_css['body_classes_to_add'] .= ' '. check_plain($classes);
}
}
$info = array(
@@ -393,7 +408,10 @@ function panels_panel_context_export(&$handler, $indent) {
unset($handler->conf[$item]);
}
}
$display->did = 'new';
$display = (object) array(
'did' => 'new',
'uuid' => ctools_uuid_generate(),
);
$handler->conf['display'] = $display;
}
@@ -568,6 +586,19 @@ function panels_panel_context_edit_choose($form, &$form_state) {
$form_state['display'] = &panels_panel_context_get_display($form_state['handler']);
// Grab the storage_type and storage_id and inject it into the display.
if (empty($form_state['display']->storage_type)) {
if (!isset($form_state[$form_state['task_id']]->storage_type)) {
watchdog('panels', "Unable to find the storage type for specified storage. Read 'Upgrading task handlers' in CHANGELOG.txt", array(), WATCHDOG_ERROR);
$form_state['display']->storage_type = 'unknown';
}
else {
$form_state['display']->storage_type = $form_state[$form_state['task_id']]->storage_type;
}
// When adding variants, we don't know the handler id yet. In that case,
// Mark it as new. We'll assign it later.
$form_state['display']->storage_id = !empty($form_state['handler_id']) ? $form_state['handler_id'] : 'new';
}
// Tell the Panels form not to display buttons.
$form_state['no buttons'] = TRUE;
@@ -725,6 +756,10 @@ function panels_panel_context_edit_content_validate(&$form, &$form_state) {
}
function panels_panel_context_edit_content_submit(&$form, &$form_state) {
// Update the storage_id if this is a new variant before saving.
if ($form_state['display']->storage_id == 'new') {
$form_state['display']->storage_id = $form_state['handler_id'];
}
panels_edit_display_form_submit($form, $form_state);
$handler = &$form_state['handler'];
@@ -760,17 +795,17 @@ function panels_panel_context_edit_settings($form, &$form_state) {
$form['conf']['body_classes_to_remove'] = array(
'#type' => 'textfield',
'#size' => 128,
'#default_value' => $conf['body_classes_to_remove'],
'#default_value' => empty($conf['body_classes_to_remove']) ? '' : $conf['body_classes_to_remove'],
'#title' => t('Remove body CSS classes'),
'#description' => t('The CSS classes to remove from the body element of this page. Separated by a space. For example: no-sidebars one-sidebar sidebar-first sidebar-second two-sidebars.'),
'#description' => t('The CSS classes to remove from the body element of this page. Separated by a space. For example: no-sidebars one-sidebar sidebar-first sidebar-second two-sidebars. Keywords from context are allowed.'),
);
$form['conf']['body_classes_to_add'] = array(
'#type' => 'textfield',
'#size' => 128,
'#default_value' => $conf['body_classes_to_add'],
'#default_value' => empty($conf['body_classes_to_add']) ? '' : $conf['body_classes_to_add'],
'#title' => t('Add body CSS classes'),
'#description' => t('The CSS classes to add to the body element of this page. Separated by a space. For example: no-sidebars one-sidebar sidebar-first sidebar-second two-sidebars.'),
'#description' => t('The CSS classes to add to the body element of this page. Separated by a space. For example: no-sidebars one-sidebar sidebar-first sidebar-second two-sidebars. Keywords from context are allowed.'),
);
ctools_include('plugins', 'panels');
@@ -810,13 +845,13 @@ function panels_panel_context_edit_settings($form, &$form_state) {
'#size' => 35,
'#default_value' => $conf['css_id'],
'#title' => t('CSS ID'),
'#description' => t('The CSS ID to apply to this page'),
'#description' => t('The CSS ID to apply to this page. Keywords from context are allowed.'),
);
$form['conf']['css'] = array(
'#type' => 'textarea',
'#title' => t('CSS code'),
'#description' => t('Enter well-formed CSS code here; this code will be embedded into the page, and should only be used for minor adjustments; it is usually better to try to put CSS for the page into the theme if possible. This CSS will be filtered for safety so some CSS may not work.'),
'#description' => t('Enter well-formed CSS code here; this code will be embedded into the page, and should only be used for minor adjustments; it is usually better to try to put CSS for the page into the theme if possible. This CSS will be filtered for safety so some CSS may not work. Keywords from context are allowed.'),
'#default_value' => $conf['css'],
);
@@ -900,12 +935,25 @@ function panels_panel_context_get_addressable($task, $subtask_name, $handler, $a
$display->cache_key = panels_panel_context_cache_key($task->name, $handler->name, $arguments);
$renderer = panels_get_renderer($handler->conf['pipeline'], $display);
if ($type == 'content') {
$renderer->prepare();
$renderer->prepare();
if ($address) {
$pid = array_shift($address);
if (!empty($renderer->prepared['panes'][$pid])) {
return $renderer->render_pane($renderer->prepared['panes'][$pid]);
if ($type == 'content') {
return $renderer->render_pane($renderer->prepared['panes'][$pid]);
}
elseif ($type == 'pane') {
return $renderer->prepared['panes'][$pid];
}
}
}
else {
if ($type == 'content') {
return $renderer->render();
}
elseif ($type == 'renderer') {
return $renderer;
}
}
}

View File

@@ -137,8 +137,8 @@ class panels_views_plugin_row_fields extends views_plugin_row_fields {
// Now that we have distributed our fields, go through the regions and
// render them into the content array.
foreach ($this->region_fields as $region_id => $fields) {
$this->view->field = $fields;
foreach ($this->region_fields as $region_id => $fields_list) {
$this->view->field = $fields_list;
$content[$region_id] = theme($this->theme_functions(), array('view' => $this->view, 'options' => $this->options, 'row' => $row));
}