security updates of unpatched modules
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
Welcome to Panels 3
|
||||
|
||||
Welcome to Panels 3.
|
||||
|
||||
A little documentation should go here, but Panels 3 is alsoi a beast - you're
|
||||
best off checking the online handbook on Drupal.org, or this issue:
|
||||
http://drupal.org/node/887560.
|
||||
Documentation is available at https://www.drupal.org/node/496278
|
@@ -11,7 +11,7 @@ Upgrading from Panels-6.x-3.x to Panels-7.x-3.x
|
||||
|
||||
- panels_plugin_get_function() deprecated.
|
||||
|
||||
- panels_required_context removed. These were deprecated long ago and
|
||||
- panels_required_context removed. These were deprecated long ago and
|
||||
existed only to prevent crashes.
|
||||
|
||||
- panels_optional_context removed.
|
||||
@@ -20,3 +20,13 @@ Upgrading from Panels-6.x-3.x to Panels-7.x-3.x
|
||||
|
||||
- display_renderer class is now in 'renderer', not 'handler'.
|
||||
|
||||
Upgrading task handlers from Panels 7.x-3.5 or older to Panels 7.x-3.6 and newer:
|
||||
|
||||
- You must specify a storage type for any panels display using your custom task handler.
|
||||
For examples, see panels_update_7306.
|
||||
|
||||
- When creating whatever stores the panel, a storage id and storage type must be defined.
|
||||
See panels_mini.module for examples inside panels_mini_save and panels_mini_panels_cache_get.
|
||||
|
||||
- A display access plugin must be defined.
|
||||
See panels_mini/plugins/panels_storage/panels_mini.inc for an example plugin.
|
||||
|
@@ -40,11 +40,6 @@ div.panel-pane:hover div.panel-hide {
|
||||
margin-top: -1.5em;
|
||||
}
|
||||
|
||||
div.panel-pane div.node {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
div.panel-pane div.feed a {
|
||||
float: right;
|
||||
}
|
||||
|
@@ -305,11 +305,19 @@ a.close img {
|
||||
background: url(../images/bg-content-modal.png);
|
||||
height: 100%;
|
||||
margin: -1em;
|
||||
padding-top: 1em;
|
||||
padding-bottom: 1em;
|
||||
padding-left: 175px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.panels-section-columns-quickfilter {
|
||||
padding-top: 1em;
|
||||
padding-left: 1em;
|
||||
padding-bottom: 1em;
|
||||
margin-bottom: 1em;
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
|
||||
.panels-section-columns {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
@@ -371,7 +379,11 @@ a.close img {
|
||||
|
||||
.content-type-button a {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
width: 99%;
|
||||
}
|
||||
|
||||
.content-type-button a:focus {
|
||||
border: 1px dotted black;
|
||||
}
|
||||
|
||||
.content-type-button img {
|
||||
|
@@ -48,7 +48,7 @@ The include file defines all the other files that our layout will utilize in ord
|
||||
<ol>
|
||||
<li><strong>Title:</strong><br />The title of our layout. (Utilized within the panels administration screens)</li>
|
||||
<li><strong>Icon:</strong><br />The graphical representation of our layout. (Utilized within the panels administration screens)</li>
|
||||
<li><strong>Theme:</strong><br />The template file of our layout. (Sharp eyed readers will note that the theme definition utilizes underscores instead of dashes, and does not have ".tpl.php" after it. This is refering to the layout-sample-first-layout.tpl.php file all the same, it is simply how the naming convention works. Utilize dashes in the tpl file name and underscores when refering to it in your include file.)</li>
|
||||
<li><strong>Theme:</strong><br />The template file of our layout. (Sharp eyed readers will note that the theme definition utilizes underscores instead of dashes, and does not have ".tpl.php" after it. This is referring to the layout-sample-first-layout.tpl.php file all the same, it is simply how the naming convention works. Utilize dashes in the tpl file name and underscores when referring to it in your include file.)</li>
|
||||
<li><strong>CSS:</strong><br />The css file to be utilized for our layout. (Utilized within the panels administration screens, AND when viewing the actual panel itself.)</li>
|
||||
<li><strong>Panels:</strong><br />Defines all the various regions within your panel. This will be further utilized within our tpl.php file.</li>
|
||||
</ol>
|
||||
|
@@ -7,9 +7,9 @@ dependencies[] = i18n_translation
|
||||
package = Multilingual - Internationalization
|
||||
core = 7.x
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-01-28
|
||||
version = "7.x-3.5"
|
||||
; Information added by Drupal.org packaging script on 2016-10-16
|
||||
version = "7.x-3.8"
|
||||
core = "7.x"
|
||||
project = "panels"
|
||||
datestamp = "1422472985"
|
||||
datestamp = "1476582295"
|
||||
|
||||
|
@@ -9,6 +9,8 @@
|
||||
* Preprocess the primary entry level theme.
|
||||
*/
|
||||
function template_preprocess_panels_add_content_modal(&$vars) {
|
||||
$vars['categories_array'] = array();
|
||||
|
||||
// Process the list of categories.
|
||||
foreach ($vars['categories'] as $key => $category_info) {
|
||||
// 'root' category is actually displayed under the categories, so
|
||||
|
@@ -89,7 +89,7 @@ class panels_allowed_layouts {
|
||||
* as allowed or not allowed on the initial call to panels_allowed_layouts::set_allowed()
|
||||
*
|
||||
*/
|
||||
function panels_allowed_layouts($start_allowed = TRUE) {
|
||||
function __construct($start_allowed = TRUE) {
|
||||
// TODO would be nice if there was a way to just fetch the names easily
|
||||
foreach ($this->list_layouts() as $layout_name) {
|
||||
$this->allowed_layout_settings[$layout_name] = $start_allowed ? 1 : 0;
|
||||
@@ -196,7 +196,7 @@ class panels_allowed_layouts {
|
||||
*/
|
||||
function save() {
|
||||
if (!is_null($this->module_name)) {
|
||||
variable_set($this->module_name . "_allowed_layouts", serialize($this));
|
||||
variable_set($this->module_name . '_allowed_layouts', serialize($this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,7 +272,11 @@ function panels_common_settings($form, &$form_state, $module_name = 'panels_comm
|
||||
// each type its own checkboxes set unless it's 'single' in which
|
||||
// case it can go into our fake other set.
|
||||
$available_content_types = ctools_content_get_all_types();
|
||||
$allowed_content_types = variable_get($module_name . '_allowed_types', array());
|
||||
$allowed_content_types = db_select('panels_allowed_types', 'pat')
|
||||
->fields('pat', array('type', 'allowed'))
|
||||
->condition('module', $module_name)
|
||||
->execute()
|
||||
->fetchAllKeyed();
|
||||
|
||||
foreach ($available_content_types as $id => $types) {
|
||||
foreach ($types as $type => $info) {
|
||||
@@ -352,13 +356,23 @@ function panels_common_settings_submit($form, &$form_state) {
|
||||
$module_name = $form_state['values']['module_name'];
|
||||
variable_set($module_name . '_default', $form_state['values']['panels_common_default']);
|
||||
if (!$form_state['skip']) {
|
||||
// merge the broken apart array neatly back together
|
||||
$allowed = $form_state['values']['allowed'];
|
||||
// Merge the broken apart array neatly back together.
|
||||
$allowed_content_types = array();
|
||||
foreach ($form_state['values']['allowed'] as $allowed) {
|
||||
$allowed_content_types = array_merge($allowed_content_types, $form_state['values']['content_types'][$allowed]['options']);
|
||||
$content_types = $form_state['values']['allowed'];
|
||||
foreach ($content_types as $content_type) {
|
||||
$allowed_content_types = array_merge($allowed_content_types, $form_state['values']['content_types'][$content_type]['options']);
|
||||
foreach ($allowed_content_types as $type => $allowed) {
|
||||
$allowed = empty($allowed) ? 0 : 1;
|
||||
db_merge('panels_allowed_types')
|
||||
->key(array('module' => $module_name, 'type' => $type))
|
||||
->fields(array(
|
||||
'module' => $module_name,
|
||||
'type' => $type,
|
||||
'allowed' => $allowed,
|
||||
))
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
variable_set($module_name . '_allowed_types', $allowed_content_types);
|
||||
}
|
||||
drupal_set_message(t('Your changes have been saved.'));
|
||||
}
|
||||
@@ -368,9 +382,13 @@ function panels_common_settings_submit($form, &$form_state) {
|
||||
*/
|
||||
function panels_common_get_allowed_types($module, $contexts = array(), $has_content = FALSE, $default_defaults = array(), $default_allowed_types = array()) {
|
||||
// Get a list of all types that are available
|
||||
|
||||
$default_types = variable_get($module . '_default', $default_defaults);
|
||||
$allowed_types = variable_get($module . '_allowed_types', $default_allowed_types);
|
||||
$allowed_types = db_select('panels_allowed_types', 'pat')
|
||||
->fields('pat', array('type', 'allowed'))
|
||||
->condition('module', $module)
|
||||
->execute()
|
||||
->fetchAllKeyed();
|
||||
$allowed_types = !empty($allowed_types) ? $allowed_types : $default_allowed_types;
|
||||
|
||||
// By default, if they haven't gone and done the initial setup here,
|
||||
// let all 'other' types (which will be all types) be available.
|
||||
@@ -455,7 +473,7 @@ function panels_common_allowed_layouts_form_submit($form, &$form_state) {
|
||||
* Get the allowed layout object for the given module.
|
||||
*/
|
||||
function panels_common_get_allowed_layout_object($module_name) {
|
||||
$allowed_layouts = unserialize(variable_get($module_name . "_allowed_layouts", serialize('')));
|
||||
$allowed_layouts = unserialize(variable_get($module_name . '_allowed_layouts', serialize('')));
|
||||
|
||||
// if no parameter was provided, or the variable_get failed
|
||||
if (!$allowed_layouts) {
|
||||
|
@@ -302,7 +302,7 @@ function panels_edit_display_settings_form($form, &$form_state) {
|
||||
* Validate the layout settings form.
|
||||
*/
|
||||
function panels_edit_display_settings_form_validate($form, &$form_state) {
|
||||
if ($function = panels_plugin_get_function('layout', $form_state['layout'], 'settings validate')) {
|
||||
if ($function = panels_plugin_get_function('layouts', $form_state['layout'], 'settings validate')) {
|
||||
$function($form_state['values']['layout_settings'], $form['layout_settings'], $form_state['display'], $form_state['layout'], $form_state['display']->layout_settings);
|
||||
}
|
||||
}
|
||||
@@ -312,7 +312,7 @@ function panels_edit_display_settings_form_validate($form, &$form_state) {
|
||||
*/
|
||||
function panels_edit_display_settings_form_submit($form, &$form_state) {
|
||||
$display = &$form_state['display'];
|
||||
if ($function = panels_plugin_get_function('layout', $form_state['layout'], 'settings submit')) {
|
||||
if ($function = panels_plugin_get_function('layouts', $form_state['layout'], 'settings submit')) {
|
||||
$function($form_state['values']['layout_settings'], $display, $form_state['layout'], $display->layout_settings);
|
||||
}
|
||||
|
||||
|
@@ -321,6 +321,8 @@ function panels_change_layout_submit($form, &$form_state) {
|
||||
$display->panels = $content;
|
||||
|
||||
$display->layout = $form_state['layout'];
|
||||
|
||||
panels_edit_display_settings_form_submit($form, $form_state);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -125,7 +125,7 @@ class panels_cache_object {
|
||||
/**
|
||||
* When constructed, take a snapshot of our existing out of band data.
|
||||
*/
|
||||
function panels_cache_object() {
|
||||
function __construct() {
|
||||
$this->head = drupal_add_html_head();
|
||||
$this->css = drupal_add_css();
|
||||
$this->tokens = ctools_set_page_token();
|
||||
@@ -478,6 +478,31 @@ function panels_get_renderer_pipelines($sort = TRUE) {
|
||||
return $pipelines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch metadata on a specific panels_storage plugin.
|
||||
*
|
||||
* @param $storage
|
||||
* Name of a panel_storage plugin.
|
||||
*
|
||||
* @return
|
||||
* An array with information about the requested panels_storage plugin
|
||||
*/
|
||||
function panels_get_panels_storage_plugin($storage) {
|
||||
ctools_include('plugins');
|
||||
return ctools_get_plugins('panels', 'panels_storage', $storage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch metadata for all panels_storage plugins.
|
||||
*
|
||||
* @return
|
||||
* An array of arrays with information about all available panels_storage plugins.
|
||||
*/
|
||||
function panels_get_panels_storage_plugins() {
|
||||
ctools_include('plugins');
|
||||
return ctools_get_plugins('panels', 'panels_storage');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a function from a plugin, if it exists.
|
||||
*
|
||||
|
@@ -13,6 +13,45 @@
|
||||
}
|
||||
};
|
||||
|
||||
Drupal.Panels.AddContentModalQuickFilter = function() {
|
||||
var input_field = $('.panels-add-content-modal input[name=quickfilter]');
|
||||
input_field.data.panelsAddContentModalQuickFilter = {
|
||||
keyupTimeout: false,
|
||||
filter: function(e) {
|
||||
if (this.val().length) {
|
||||
var search_expression = this.val().toLowerCase();
|
||||
$('.panels-add-content-modal .panels-section-columns .content-type-button').each(function(i, elem) {
|
||||
if ($(elem).text().toLowerCase().search(search_expression) > -1) {
|
||||
$(elem).show();
|
||||
}
|
||||
else {
|
||||
$(elem).hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
$('.panels-add-content-modal .panels-section-columns .content-type-button').show();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Use timeout to reduce the iteration over the DOM tree.
|
||||
input_field.bind('keyup.AddContentModalQuickFilter', jQuery.proxy(function(e){
|
||||
var filter = $(this).data.panelsAddContentModalQuickFilter;
|
||||
if (filter.keyupTimeout) {
|
||||
window.clearTimeout(filter.timeout);
|
||||
filter.keyupTimeout = false;
|
||||
}
|
||||
// If there's only one item left and enter is hit select it right away.
|
||||
if (e.keyCode == 13 && $('.panels-add-content-modal .panels-section-columns .content-type-button:visible').length == 1) {
|
||||
$('.panels-add-content-modal .panels-section-columns .content-type-button:visible a').trigger('click');
|
||||
}
|
||||
else {
|
||||
filter.keyupTimeout = window.setTimeout(jQuery.proxy(filter.filter, this), 200);
|
||||
}
|
||||
}, input_field));
|
||||
input_field.focus();
|
||||
};
|
||||
|
||||
Drupal.Panels.restripeTable = function(table) {
|
||||
// :even and :odd are reversed because jquery counts from 0 and
|
||||
// we count from 1, so we're out of sync.
|
||||
|
@@ -2,18 +2,25 @@ name = Panels
|
||||
description = Core Panels display functions; provides no external UI, at least one other Panels module should be enabled.
|
||||
core = 7.x
|
||||
package = "Panels"
|
||||
version = PANELS_VERSION
|
||||
configure = admin/structure/panels
|
||||
dependencies[] = ctools (>1.5)
|
||||
dependencies[] = ctools
|
||||
files[] = panels.module
|
||||
files[] = includes/common.inc
|
||||
files[] = includes/legacy.inc
|
||||
files[] = includes/plugins.inc
|
||||
files[] = plugins/views/panels_views_plugin_row_fields.inc
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-01-28
|
||||
version = "7.x-3.5"
|
||||
; Tests.
|
||||
; Task handlers for entities. These inherit off one base class to make it easier
|
||||
; to repeat tests across multiple entity types.
|
||||
files[] = tests/PanelsEntityViewWebTestCase.test
|
||||
files[] = tests/PanelsNodeViewWebTestCase.test
|
||||
files[] = tests/PanelsTermViewWebTestCase.test
|
||||
files[] = tests/PanelsUserViewWebTestCase.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-10-16
|
||||
version = "7.x-3.8"
|
||||
core = "7.x"
|
||||
project = "panels"
|
||||
datestamp = "1422472985"
|
||||
datestamp = "1476582295"
|
||||
|
||||
|
@@ -47,7 +47,69 @@ function panels_requirements_install() {
|
||||
function panels_schema() {
|
||||
// This should always point to our 'current' schema. This makes it relatively
|
||||
// easy to keep a record of schema as we make changes to it.
|
||||
return panels_schema_6();
|
||||
return panels_schema_9();
|
||||
}
|
||||
|
||||
function panels_schema_9() {
|
||||
$schema = panels_schema_8();
|
||||
$schema['panels_allowed_types'] = array(
|
||||
'fields' => array(
|
||||
'module' => array(
|
||||
'description' => 'The name of the module requiring allowed type settings.',
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
),
|
||||
'type' => array(
|
||||
'description' => 'Ctools content type to allow.',
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
),
|
||||
'allowed' => array(
|
||||
'description' => 'A boolean for if the type is allowed or not.',
|
||||
'type' => 'int',
|
||||
'size' => 'tiny',
|
||||
'default' => 1,
|
||||
),
|
||||
),
|
||||
'indexes' => array(
|
||||
'type_idx' => array('type'),
|
||||
),
|
||||
);
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
function panels_schema_8() {
|
||||
$schema = panels_schema_7();
|
||||
|
||||
// Add the storage type and id columns.
|
||||
$schema['panels_display']['fields']['storage_type'] = array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'default' => '',
|
||||
);
|
||||
$schema['panels_display']['fields']['storage_id'] = array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'default' => '',
|
||||
);
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
function panels_schema_7() {
|
||||
$schema = panels_schema_6();
|
||||
|
||||
// Update field lengths to 255 chars.
|
||||
$schema['panels_pane']['fields']['subtype']['length'] = '255';
|
||||
$schema['panels_pane']['fields']['panel']['length'] = '255';
|
||||
$schema['panels_pane']['fields']['type']['length'] = '255';
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
function panels_schema_6() {
|
||||
@@ -406,11 +468,23 @@ function panels_update_7301() {
|
||||
|
||||
/**
|
||||
* Adding universally unique identifiers to panels.
|
||||
*
|
||||
* Note: This update hook is not written well. It calls apis which uses the
|
||||
* most updated drupal database, causing missing columns or tables errors. To
|
||||
* mitigate the issue, we've added updates from 7303 and 7305. Future updates
|
||||
* should go below the 7305 update.
|
||||
*
|
||||
* See https://www.drupal.org/node/2787123 for more info.
|
||||
*/
|
||||
function panels_update_7302() {
|
||||
if (!module_load_include('inc', 'ctools', 'includes/uuid')) {
|
||||
throw new DrupalUpdateException(t('Ctools UUID support not detected. You must update to a more recent version of the ctools module.'));
|
||||
}
|
||||
// Run the 7303 update first to avoid caching issues.
|
||||
// This *probably* should be placed right above update 7305, however it was
|
||||
// tested here and re-testing this update is difficult, so it stays here.
|
||||
panels_update_7303();
|
||||
|
||||
// Load the schema.
|
||||
$schema = panels_schema_5();
|
||||
$msg = array();
|
||||
@@ -462,6 +536,10 @@ function panels_update_7302() {
|
||||
|
||||
$dids = array_unique(array_merge($display_dids, $pane_dids));
|
||||
|
||||
// Before using panels_save_display(), we have to make sure any new fields
|
||||
// are added from future updates.
|
||||
panels_update_7305();
|
||||
|
||||
// If the Panels module is disabled we don't have access to
|
||||
// panels_load_displays().
|
||||
if (!function_exists('panels_load_displays')) {
|
||||
@@ -492,3 +570,122 @@ function panels_update_7303() {
|
||||
db_create_table($table_name, $schema[$table_name]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update "panels_pane" table field lengths to 255 chars.
|
||||
*/
|
||||
function panels_update_7304() {
|
||||
$schema = panels_schema_7();
|
||||
|
||||
$update_fields = array(
|
||||
'panels_pane' => array('subtype', 'panel', 'type'),
|
||||
);
|
||||
|
||||
foreach ($update_fields as $table => $fields) {
|
||||
foreach ($fields as $field_name) {
|
||||
db_change_field($table, $field_name, $field_name, $schema[$table]['fields'][$field_name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the "storage_type" and "storage_id" columns to "panels_display".
|
||||
*/
|
||||
function panels_update_7305() {
|
||||
$schema = panels_schema_8();
|
||||
|
||||
$new_fields = array(
|
||||
'panels_display' => array('storage_type', 'storage_id'),
|
||||
);
|
||||
|
||||
foreach ($new_fields as $table => $fields) {
|
||||
foreach ($fields as $field_name) {
|
||||
// Due to a previous failure, the column may already exist:
|
||||
if (!db_field_exists($table, $field_name)) {
|
||||
db_add_field($table, $field_name, $schema[$table]['fields'][$field_name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the storage type and id on existing page manager panels displays.
|
||||
*/
|
||||
function panels_update_7306() {
|
||||
if (!db_table_exists('page_manager_handlers')) {
|
||||
return t('Skipping update - page_manager is not installed.');
|
||||
}
|
||||
|
||||
// Get all page_manager_handlers that have a panels context.
|
||||
$result = db_query("SELECT pm.name, pm.conf FROM {page_manager_handlers} pm WHERE pm.handler = 'panel_context'");
|
||||
$page_manager_panels = array();
|
||||
foreach ($result as $row) {
|
||||
$conf = unserialize($row->conf);
|
||||
if (isset($conf['did'])) {
|
||||
$page_manager_panels[$conf['did']] = $row->name;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($page_manager_panels)) {
|
||||
// Check panels displays that only have empty storage types
|
||||
$result = db_query("SELECT pd.did FROM {panels_display} pd WHERE pd.did IN (:dids) AND storage_type = ''", array(':dids' => array_keys($page_manager_panels)));
|
||||
foreach ($result as $row) {
|
||||
db_update('panels_display')
|
||||
->fields(array(
|
||||
'storage_type' => 'page_manager',
|
||||
'storage_id' => $page_manager_panels[$row->did],
|
||||
))
|
||||
->condition('did', $row->did)
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a custom table for allowed types.
|
||||
*/
|
||||
function panels_update_7307() {
|
||||
$schema = panels_schema_9();
|
||||
|
||||
$table_name = 'panels_allowed_types';
|
||||
if (!db_table_exists($table_name)) {
|
||||
db_create_table($table_name, $schema[$table_name]);
|
||||
}
|
||||
|
||||
// Read existing allowed settings and store them in a new table.
|
||||
$variables = db_select('variable', 'v')
|
||||
->fields('v', array('name'))
|
||||
->condition('name', '%' . db_like('_allowed_types'), 'LIKE')
|
||||
->execute()
|
||||
->fetchCol();
|
||||
foreach ($variables as $name) {
|
||||
$module = str_replace('_allowed_types', '', $name);
|
||||
$variable = variable_get($name);
|
||||
foreach ($variable as $type => $allowed) {
|
||||
$allowed = empty($allowed) ? 0 : 1;
|
||||
db_merge('panels_allowed_types')
|
||||
->key(array('module' => $module, 'type' => $type))
|
||||
->fields(array(
|
||||
'module' => $module,
|
||||
'type' => $type,
|
||||
'allowed' => $allowed,
|
||||
))
|
||||
->execute();
|
||||
}
|
||||
variable_del($name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename style permissions.
|
||||
*/
|
||||
function panels_update_7308() {
|
||||
$permissions = array(
|
||||
'administer panels display styles',
|
||||
'administer panels pane styles',
|
||||
'administer panels region styles',
|
||||
);
|
||||
foreach (array_keys(user_roles(TRUE, 'administer panels styles')) as $rid) {
|
||||
user_role_grant_permissions($rid, $permissions);
|
||||
}
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@
|
||||
* Core functionality for the Panels engine.
|
||||
*/
|
||||
|
||||
define('PANELS_REQUIRED_CTOOLS_API', '2.0.8');
|
||||
define('PANELS_REQUIRED_CTOOLS_API', '2.0.9');
|
||||
|
||||
/**
|
||||
* The current working panels version.
|
||||
@@ -20,7 +20,7 @@ define('PANELS_REQUIRED_CTOOLS_API', '2.0.8');
|
||||
* ; Requires Panels v7.x-3.4 or newer.
|
||||
* dependencies[] = panels (>=3.4)
|
||||
*/
|
||||
define('PANELS_VERSION', '7.x-3.5');
|
||||
define('PANELS_VERSION', '7.x-3.8');
|
||||
|
||||
|
||||
define('PANELS_TITLE_FIXED', 0); // Hide title use to be true/false. So false remains old behavior.
|
||||
@@ -302,6 +302,11 @@ function panels_permission() {
|
||||
'title' => t("Change layouts with the Panels In-Place Editor"),
|
||||
'description' => t("Allows a user to change layouts with the IPE."),
|
||||
),
|
||||
'bypass access in place editing' => array(
|
||||
'title' => t("Bypass access checks when using Panels In-Place Editor"),
|
||||
'description' => t("Allows using IPE even if user does not have additional permissions granted by other modules."),
|
||||
'restrict access' => TRUE,
|
||||
),
|
||||
'administer advanced pane settings' => array(
|
||||
'title' => t("Configure advanced settings on Panel panes"),
|
||||
'description' => t(""),
|
||||
@@ -312,8 +317,20 @@ function panels_permission() {
|
||||
),
|
||||
'administer panels styles' => array(
|
||||
'title' => t("Administer Panels styles"),
|
||||
'description' => t("DEPRECATED: Modules using this permission should use specific style permissions. See Issue #2329419 for more info."),
|
||||
),
|
||||
'administer panels display styles' => array(
|
||||
'title' => t("Administer Panels display styles"),
|
||||
'description' => t("Allows a user to administer the styles of Panel displays."),
|
||||
),
|
||||
'administer panels pane styles' => array(
|
||||
'title' => t("Administer Panels pane styles"),
|
||||
'description' => t("Allows a user to administer the styles of Panel panes."),
|
||||
),
|
||||
'administer panels region styles' => array(
|
||||
'title' => t("Administer Panels region styles"),
|
||||
'description' => t("Allows a user to administer the styles of Panel regions."),
|
||||
),
|
||||
'use panels caching features' => array(
|
||||
'title' => t("Configure caching settings on Panels"),
|
||||
'description' => t("Allows a user to configure caching on Panels displays and panes."),
|
||||
@@ -329,17 +346,6 @@ function panels_permission() {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_flush_caches().
|
||||
*
|
||||
* We implement this so that we can be sure our legacy rendering state setting
|
||||
* in $conf is updated whenever caches are cleared.
|
||||
*/
|
||||
//function panels_flush_caches() {
|
||||
// $legacy = panels_get_legacy_state();
|
||||
// $legacy->determineStatus();
|
||||
//}
|
||||
|
||||
/**
|
||||
* Implements hook_flush_caches().
|
||||
*/
|
||||
@@ -404,6 +410,7 @@ function panels_ctools_plugin_type() {
|
||||
'display_renderers' => array(
|
||||
'classes' => array('renderer'),
|
||||
),
|
||||
'panels_storage' => array(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -658,7 +665,6 @@ function panels_edit_layout($display, $finish, $destination = NULL, $allowed_lay
|
||||
|
||||
/**
|
||||
* Forms the basis of a panel display
|
||||
*
|
||||
*/
|
||||
class panels_display {
|
||||
var $args = array();
|
||||
@@ -770,6 +776,55 @@ class panels_display {
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given user can perform the requested operation.
|
||||
*
|
||||
* @param string $op
|
||||
* An operation like: create, read, update, or delete.
|
||||
* @param object $account
|
||||
* (optional) The account to check access for.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if access is granted; otherwise FALSE.
|
||||
*/
|
||||
function access($op, $account = NULL) {
|
||||
global $user;
|
||||
|
||||
if (!$account) {
|
||||
$account = $user;
|
||||
}
|
||||
|
||||
// Even administrators need to go through the access system. However, to
|
||||
// support legacy plugins, user 1 gets full access no matter what.
|
||||
if ($account->uid == 1) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!in_array($op, array('create', 'read', 'update', 'delete', 'change layout'))) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (empty($this->storage_type) || empty($this->storage_id)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ($this->storage_type == 'unknown') {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$storage_plugin = panels_get_panels_storage_plugin($this->storage_type);
|
||||
if (!$storage_plugin) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$access_callback = panels_plugin_get_function('panels_storage', $storage_plugin, 'access callback');
|
||||
if (!$access_callback) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return $access_callback($this->storage_type, $this->storage_id, $op, $account);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1079,12 +1134,12 @@ function panels_export_display($display, $prefix = '') {
|
||||
$title_pid = $pid;
|
||||
}
|
||||
$pane->pid = $pid;
|
||||
$output .= ctools_export_object('panels_pane', $pane, $prefix . ' ');
|
||||
$output .= "$prefix " . '$display->content[\'' . $pane->pid . '\'] = $pane' . ";\n";
|
||||
$output .= ctools_export_object('panels_pane', $pane, $prefix);
|
||||
$output .= $prefix . '$display->content[\'' . $pane->pid . '\'] = $pane' . ";\n";
|
||||
if (!isset($region_counters[$pane->panel])) {
|
||||
$region_counters[$pane->panel] = 0;
|
||||
}
|
||||
$output .= "$prefix " . '$display->panels[\'' . $pane->panel . '\'][' . $region_counters[$pane->panel]++ .'] = \'' . $pane->pid . "';\n";
|
||||
$output .= $prefix . '$display->panels[\'' . $pane->panel . '\'][' . $region_counters[$pane->panel]++ .'] = \'' . $pane->pid . "';\n";
|
||||
}
|
||||
}
|
||||
$output .= $prefix . '$display->hide_title = ';
|
||||
@@ -1334,7 +1389,7 @@ function template_preprocess_panels_pane(&$vars) {
|
||||
$vars['pane_suffix'] = !empty($content->pane_suffix) ? $content->pane_suffix : '';
|
||||
|
||||
$vars['title'] = !empty($content->title) ? $content->title : '';
|
||||
$vars['title_heading'] = !empty($content->title_heading) ? $content->title_heading : 'h2';
|
||||
$vars['title_heading'] = !empty($content->title_heading) ? $content->title_heading : variable_get('override_title_heading', 'h2');
|
||||
$vars['title_attributes_array']['class'][] = 'pane-title';
|
||||
|
||||
$vars['feeds'] = !empty($content->feeds) ? implode(' ', $content->feeds) : '';
|
||||
@@ -1410,6 +1465,11 @@ function panels_ajax_router() {
|
||||
ctools_include('cleanstring');
|
||||
$renderer->clean_key = ctools_cleanstring($cache_key);
|
||||
|
||||
$op = $renderer->get_panels_storage_op_for_ajax($method);
|
||||
if (!$cache->display->access($op)) {
|
||||
return MENU_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
$output = call_user_func_array(array($renderer, $method), $args);
|
||||
|
||||
if (empty($output) && !empty($renderer->commands)) {
|
||||
@@ -1721,6 +1781,32 @@ function panels_page_wizard_panels_cache_set($key, $cache) {
|
||||
page_manager_set_wizard_cache($wizard_cache);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_default_page_manager_handlers_alter().
|
||||
*
|
||||
* If a default Panels display has no storage type, set it.
|
||||
*/
|
||||
function panels_default_page_manager_handlers_alter(&$handlers) {
|
||||
foreach ($handlers as &$handler) {
|
||||
if ($handler->handler == 'panel_context') {
|
||||
$display =& $handler->conf['display'];
|
||||
if (empty($display->storage_type)) {
|
||||
$display->storage_type = 'page_manager';
|
||||
$display->storage_id = $handler->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_default_page_manager_pages_alter().
|
||||
*/
|
||||
function panels_default_page_manager_pages_alter(&$pages) {
|
||||
foreach ($pages as &$page) {
|
||||
panels_default_page_manager_handlers_alter($page->default_handlers);
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// General utility functions
|
||||
|
||||
|
@@ -2,12 +2,7 @@
|
||||
// Ensure the $ alias is owned by jQuery.
|
||||
(function($) {
|
||||
|
||||
// randomly lock a pane.
|
||||
// @debug only
|
||||
Drupal.settings.Panels = Drupal.settings.Panels || {};
|
||||
Drupal.settings.Panels.RegionLock = {
|
||||
10: { 'top': false, 'left': true, 'middle': true }
|
||||
}
|
||||
|
||||
Drupal.PanelsIPE = {
|
||||
editors: {},
|
||||
@@ -31,6 +26,17 @@ Drupal.PanelsIPE = {
|
||||
|
||||
Drupal.behaviors.PanelsIPE = {
|
||||
attach: function(context) {
|
||||
// Remove any old editors.
|
||||
for (var i in Drupal.PanelsIPE.editors) {
|
||||
if (Drupal.settings.PanelsIPECacheKeys.indexOf(i) === -1) {
|
||||
// Clean-up a little bit and remove it.
|
||||
Drupal.PanelsIPE.editors[i].editing = false;
|
||||
Drupal.PanelsIPE.editors[i].changed = false;
|
||||
delete Drupal.PanelsIPE.editors[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize new editors.
|
||||
for (var i in Drupal.settings.PanelsIPECacheKeys) {
|
||||
var key = Drupal.settings.PanelsIPECacheKeys[i];
|
||||
$('div#panels-ipe-display-' + key + ':not(.panels-ipe-processed)')
|
||||
@@ -213,6 +219,8 @@ function DrupalPanelsIPE(cache_key, cfg) {
|
||||
|
||||
$('div.panels-ipe-sort-container', ipe.topParent).bind('sortstop', this.enableRegions);
|
||||
|
||||
// Refresh the control jQuery object.
|
||||
ipe.control = $(ipe.control.selector);
|
||||
$('.panels-ipe-form-container', ipe.control).append(formdata);
|
||||
|
||||
$('input:submit:not(.ajax-processed), button:not(.ajax-processed)', ipe.control).addClass('ajax-processed').each(function() {
|
||||
@@ -233,7 +241,7 @@ function DrupalPanelsIPE(cache_key, cfg) {
|
||||
// it clears out inline styles.
|
||||
$('.panels-ipe-on').show();
|
||||
ipe.showForm();
|
||||
ipe.topParent.addClass('panels-ipe-editing');
|
||||
$('body').add(ipe.topParent).addClass('panels-ipe-editing');
|
||||
|
||||
};
|
||||
|
||||
@@ -264,6 +272,10 @@ function DrupalPanelsIPE(cache_key, cfg) {
|
||||
// Re-show all the IPE non-editing meta-elements
|
||||
$('div.panels-ipe-off').show('fast');
|
||||
|
||||
// Refresh the container and control jQuery objects.
|
||||
ipe.container = $(ipe.container.selector);
|
||||
ipe.control = $(ipe.control.selector);
|
||||
|
||||
ipe.showButtons();
|
||||
// Re-hide all the IPE meta-elements
|
||||
$('div.panels-ipe-on').hide();
|
||||
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Hooks provided by Panels In-Place Editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allow modules to control access to the Panels IPE.
|
||||
*
|
||||
* @param panels_display $display
|
||||
* The panels display about to be rendered.
|
||||
*
|
||||
* @return TRUE|FALSE|NULL
|
||||
* Returns TRUE to allow access, FALSE to deny, or NULL if the module
|
||||
* implementing this hook doesn't care about access for the given display.
|
||||
*/
|
||||
function hook_panels_ipe_access(panels_display $display) {
|
||||
// We only care about displays with the 'panelizer' context.
|
||||
if (!isset($display->context['panelizer'])) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ($display->context['panelizer']->type[0] == 'entity:node') {
|
||||
// Allow or deny IPE access based on node type.
|
||||
return $display->context['panelizer']->data->type == 'awesome_page';
|
||||
}
|
||||
|
||||
// Otherwise, deny access to everything!
|
||||
return FALSE;
|
||||
}
|
@@ -1,15 +1,14 @@
|
||||
name = Panels In-Place Editor
|
||||
description = Provide a UI for managing some Panels directly on the frontend, instead of having to use the backend.
|
||||
package = "Panels"
|
||||
version = PANELS_VERSION
|
||||
dependencies[] = panels
|
||||
core = 7.x
|
||||
configure = admin/structure/panels
|
||||
files[] = panels_ipe.module
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-01-28
|
||||
version = "7.x-3.5"
|
||||
; Information added by Drupal.org packaging script on 2016-10-16
|
||||
version = "7.x-3.8"
|
||||
core = "7.x"
|
||||
project = "panels"
|
||||
datestamp = "1422472985"
|
||||
datestamp = "1476582295"
|
||||
|
||||
|
@@ -96,7 +96,7 @@ function template_preprocess_panels_ipe_pane_wrapper(&$vars) {
|
||||
}
|
||||
|
||||
// Add option to configure style in IPE
|
||||
if (user_access('administer panels styles')) {
|
||||
if (user_access('administer panels pane styles')) {
|
||||
$vars['links']['style'] = array(
|
||||
'title' => '<span>' . t('Style') . '</span>',
|
||||
'href' => $renderer->get_url('style-type', 'pane', $pane->pid),
|
||||
@@ -167,7 +167,7 @@ function template_preprocess_panels_ipe_add_pane_button(&$vars) {
|
||||
$vars['links'] = '';
|
||||
|
||||
// Add option to configure style in IPE
|
||||
if (user_access('administer panels styles')) {
|
||||
if (user_access('administer panels region styles')) {
|
||||
$vars['links']['style'] = array(
|
||||
'title' => '<span>' . t('Region style') . '</span>',
|
||||
'href' => $renderer->get_url('style-type', 'region', $region_id),
|
||||
@@ -221,6 +221,7 @@ function panels_ipe_get_cache_key($key = NULL) {
|
||||
*/
|
||||
function panels_ipe_toolbar_add_button($cache_key, $id, $button) {
|
||||
$buttons = &drupal_static('panels_ipe_toolbar_buttons', array());
|
||||
drupal_alter('panels_ipe_button', $button, $id, $cache_key);
|
||||
$buttons[$cache_key][$id] = $button;
|
||||
}
|
||||
|
||||
@@ -246,9 +247,11 @@ function panels_ipe_page_alter(&$page) {
|
||||
|
||||
function theme_panels_ipe_toolbar($vars) {
|
||||
$buttons = $vars['buttons'];
|
||||
ctools_include('cleanstring');
|
||||
|
||||
$output = "<div id='panels-ipe-control-container' class='clearfix'>";
|
||||
foreach ($buttons as $key => $ipe_buttons) {
|
||||
$key = ctools_cleanstring($key);
|
||||
$output .= "<div id='panels-ipe-control-$key' class='panels-ipe-control'>";
|
||||
|
||||
// Controls in this container will appear when the IPE is not on.
|
||||
|
@@ -7,12 +7,44 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
// The IPE operates in normal render mode, not admin mode.
|
||||
var $admin = FALSE;
|
||||
|
||||
// Whether or not the user has access.
|
||||
var $access = NULL;
|
||||
|
||||
function invoke_panels_ipe_access() {
|
||||
if (user_access('bypass access in place editing')) {
|
||||
return TRUE;
|
||||
}
|
||||
// Modules can return TRUE, FALSE or NULL, for allowed, disallowed,
|
||||
// or don't care - respectively. On the first FALSE, we deny access,
|
||||
// otherwise allow.
|
||||
foreach (module_invoke_all('panels_ipe_access', $this->display) as $result) {
|
||||
if ($result === FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function access() {
|
||||
if (is_null($this->access)) {
|
||||
$this->access = $this->invoke_panels_ipe_access();
|
||||
}
|
||||
return $this->access;
|
||||
}
|
||||
|
||||
function render() {
|
||||
$output = parent::render();
|
||||
return "<div id='panels-ipe-display-{$this->clean_key}' class='panels-ipe-display-container'>$output</div>";
|
||||
if ($this->access()) {
|
||||
return "<div id='panels-ipe-display-{$this->clean_key}' class='panels-ipe-display-container'>$output</div>";
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function add_meta() {
|
||||
if (!$this->access()) {
|
||||
return parent::add_meta();
|
||||
}
|
||||
|
||||
ctools_include('display-edit', 'panels');
|
||||
ctools_include('content');
|
||||
|
||||
@@ -42,7 +74,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
'#suffix' => '</div>',
|
||||
);
|
||||
|
||||
panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-startedit', $button);
|
||||
panels_ipe_toolbar_add_button($this->display->cache_key, 'panels-ipe-startedit', $button);
|
||||
|
||||
// @todo this actually should be an IPE setting instead.
|
||||
if (user_access('change layouts in place editing')) {
|
||||
@@ -63,7 +95,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
'#suffix' => '</div>',
|
||||
);
|
||||
|
||||
panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-change-layout', $button);
|
||||
panels_ipe_toolbar_add_button($this->display->cache_key, 'panels-ipe-change-layout', $button);
|
||||
}
|
||||
|
||||
ctools_include('ajax');
|
||||
@@ -72,6 +104,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
|
||||
ctools_add_css('panels_dnd', 'panels');
|
||||
ctools_add_css('panels_admin', 'panels');
|
||||
ctools_add_js('panels-base', 'panels');
|
||||
ctools_add_js('panels_ipe', 'panels_ipe');
|
||||
ctools_add_css('panels_ipe', 'panels_ipe');
|
||||
|
||||
@@ -95,6 +128,9 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
if (empty($output)) {
|
||||
return;
|
||||
}
|
||||
if (!$this->access()) {
|
||||
return $output;
|
||||
}
|
||||
|
||||
// If there are region locks, add them.
|
||||
if (!empty($pane->locks['type']) && $pane->locks['type'] == 'regions') {
|
||||
@@ -137,6 +173,10 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
}
|
||||
|
||||
function prepare_panes($panes) {
|
||||
if (!$this->access()) {
|
||||
return parent::prepare_panes($panes);
|
||||
}
|
||||
|
||||
// Set to admin mode just for this to ensure all panes are represented.
|
||||
$this->admin = TRUE;
|
||||
$panes = parent::prepare_panes($panes);
|
||||
@@ -144,6 +184,10 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
}
|
||||
|
||||
function render_pane_content(&$pane) {
|
||||
if (!$this->access()) {
|
||||
return parent::render_pane_content($pane);
|
||||
}
|
||||
|
||||
if (!empty($pane->shown) && panels_pane_access($pane, $this->display)) {
|
||||
$content = parent::render_pane_content($pane);
|
||||
}
|
||||
@@ -174,6 +218,10 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
* @param $panes
|
||||
*/
|
||||
function render_region($region_id, $panes) {
|
||||
if (!$this->access()) {
|
||||
return parent::render_region($region_id, $panes);
|
||||
}
|
||||
|
||||
// Generate this region's 'empty' placeholder pane from the IPE plugin.
|
||||
$empty_ph = theme('panels_ipe_placeholder_pane', array('region_id' => $region_id, 'region_title' => $this->plugins['layout']['regions'][$region_id]));
|
||||
|
||||
@@ -211,6 +259,19 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
// Break the lock.
|
||||
panels_edit_cache_break_lock($this->cache);
|
||||
}
|
||||
}
|
||||
|
||||
function get_panels_storage_op_for_ajax($method) {
|
||||
switch ($method) {
|
||||
case 'ajax_unlock_ipe':
|
||||
case 'ajax_save_form':
|
||||
return 'update';
|
||||
case 'ajax_change_layout':
|
||||
case 'ajax_set_layout':
|
||||
return 'change layout';
|
||||
}
|
||||
|
||||
return parent::get_panels_storage_op_for_ajax($method);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -284,6 +345,9 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
// rendered.
|
||||
$this->meta_location = 'inline';
|
||||
$this->commands[] = ajax_command_replace("#panels-ipe-display-{$this->clean_key}", panels_render_display($this->display, $this));
|
||||
$buttons = &drupal_static('panels_ipe_toolbar_buttons', array());
|
||||
$output = theme('panels_ipe_toolbar', array('buttons' => $buttons));
|
||||
$this->commands[] = ajax_command_replace('#panels-ipe-control-container', $output);
|
||||
}
|
||||
else {
|
||||
// Cancelled. Clear the cache.
|
||||
@@ -322,6 +386,9 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
// Filter out builders
|
||||
$layouts = array_filter($layouts, '_panels_builder_filter');
|
||||
|
||||
// Let other modules filter the layouts.
|
||||
drupal_alter('panels_layouts_available', $layouts);
|
||||
|
||||
// Define the current layout
|
||||
$current_layout = $this->plugins['layout']['name'];
|
||||
|
||||
|
@@ -1,13 +1,12 @@
|
||||
name = Mini panels
|
||||
description = Create mini panels that can be used as blocks by Drupal and panes by other panel modules.
|
||||
package = "Panels"
|
||||
version = PANELS_VERSION
|
||||
dependencies[] = panels
|
||||
core = 7.x
|
||||
files[] = plugins/export_ui/panels_mini_ui.class.php
|
||||
; Information added by Drupal.org packaging script on 2015-01-28
|
||||
version = "7.x-3.5"
|
||||
; Information added by Drupal.org packaging script on 2016-10-16
|
||||
version = "7.x-3.8"
|
||||
core = "7.x"
|
||||
project = "panels"
|
||||
datestamp = "1422472985"
|
||||
datestamp = "1476582295"
|
||||
|
||||
|
@@ -114,7 +114,7 @@ function panels_mini_uninstall() {
|
||||
$deltas[] = $panel_mini->pid;
|
||||
}
|
||||
|
||||
if ($deltas) {
|
||||
if (db_table_exists('block') && $deltas) {
|
||||
// Delete all configured blocks.
|
||||
db_delete('block')
|
||||
->condition('module', 'panels_mini')
|
||||
@@ -122,3 +122,61 @@ function panels_mini_uninstall() {
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_update_dependencies().
|
||||
*/
|
||||
function panels_mini_update_dependencies() {
|
||||
// Update 7301 requires panels storage support
|
||||
$dependencies['panels_mini'][7301] = array(
|
||||
'panels' => 7305,
|
||||
);
|
||||
|
||||
return $dependencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the storage type and id on existing mini panels.
|
||||
*/
|
||||
function panels_mini_update_7301() {
|
||||
if (!isset($sandbox['progress'])) {
|
||||
// Initialize batch update information.
|
||||
$sandbox['progress'] = (float)0;
|
||||
$sandbox['current_did'] = -1;
|
||||
$sandbox['max'] = db_query("SELECT COUNT(pd.did)
|
||||
FROM {panels_display} pd
|
||||
JOIN {panels_mini} pm ON pm.did = pd.did
|
||||
WHERE pd.storage_type = ''")->fetchField();
|
||||
}
|
||||
|
||||
// Set a limit of how many rows to process per batch.
|
||||
$limit = 1000;
|
||||
|
||||
// Run the query
|
||||
$result = db_query_range("SELECT pd.did, pm.name
|
||||
FROM {panels_display} pd
|
||||
JOIN {panels_mini} pm ON pm.did = pd.did
|
||||
WHERE pd.storage_type = '' AND pd.did > :current_did", 0, $limit, array(':current_did' => $sandbox['current_did']));
|
||||
|
||||
foreach ($result as $row) {
|
||||
db_update('panels_display')
|
||||
->fields(array(
|
||||
'storage_type' => 'panels_mini',
|
||||
'storage_id' => $row->name,
|
||||
))
|
||||
->condition('did', $row->did)
|
||||
->execute();
|
||||
|
||||
// Update our progress information.
|
||||
$sandbox['progress']++;
|
||||
$sandbox['current_did'] = $row->did;
|
||||
}
|
||||
|
||||
// Set the "finished" status, to tell batch engine whether this function
|
||||
// needs to run again.
|
||||
$sandbox['#finished'] = ($sandbox['progress'] >= $sandbox['max']) ? TRUE : ($sandbox['progress'] / $sandbox['max']);
|
||||
|
||||
if ($sandbox['#finished']) {
|
||||
return t('Added the storage type for panels_mini to relevant panels displays');
|
||||
}
|
||||
}
|
||||
|
@@ -116,6 +116,7 @@ function panels_mini_block_view($delta = 0) {
|
||||
|
||||
$panel_mini->context = $panel_mini->display->context = ctools_context_load_contexts($panel_mini, FALSE, $contexts);
|
||||
$panel_mini->display->css_id = panels_mini_get_id($panel_mini->name);
|
||||
$panel_mini->display->owner = $panel_mini;
|
||||
|
||||
$block = array();
|
||||
|
||||
@@ -146,6 +147,10 @@ function panels_mini_block_list_alter(&$blocks) {
|
||||
if (module_exists('page_manager')) {
|
||||
$current_page = page_manager_get_current_page();
|
||||
}
|
||||
|
||||
// Load add at once to save time.
|
||||
panels_mini_load_all();
|
||||
|
||||
foreach ($blocks as $key => $block) {
|
||||
if ($block->module != 'panels_mini') {
|
||||
// This block was added by a contrib module, leave it in the list.
|
||||
@@ -254,22 +259,30 @@ function panels_mini_load($name) {
|
||||
// We use array_key_exists because failed loads will be NULL and
|
||||
// isset() will try to load it again.
|
||||
if (!array_key_exists($name, $cache)) {
|
||||
ctools_include('export');
|
||||
$result = ctools_export_load_object('panels_mini', 'names', array($name));
|
||||
if (isset($result[$name])) {
|
||||
if (empty($result[$name]->display)) {
|
||||
$result[$name]->display = panels_load_display($result[$name]->did);
|
||||
if (!empty($result[$name]->title) && empty($result[$name]->display->title)) {
|
||||
$result[$name]->display->title = $result[$name]->title;
|
||||
}
|
||||
}
|
||||
$cache[$name] = $result[$name];
|
||||
if (!empty($result[$name]->title) && empty($result[$name]->admin_title)) {
|
||||
$cache[$name]->admin_title = $result[$name]->title;
|
||||
}
|
||||
$cid = 'panels_mini_load:' . $name;
|
||||
$result = cache_get($cid, 'cache_panels');
|
||||
if (!empty($result->data)) {
|
||||
$cache[$name] = $result->data;
|
||||
}
|
||||
else {
|
||||
$cache[$name] = NULL;
|
||||
ctools_include('export');
|
||||
$result = ctools_export_load_object('panels_mini', 'names', array($name));
|
||||
if (isset($result[$name])) {
|
||||
if (empty($result[$name]->display)) {
|
||||
$result[$name]->display = panels_load_display($result[$name]->did);
|
||||
if (!empty($result[$name]->title) && empty($result[$name]->display->title)) {
|
||||
$result[$name]->display->title = $result[$name]->title;
|
||||
}
|
||||
}
|
||||
$cache[$name] = $result[$name];
|
||||
if (!empty($result[$name]->title) && empty($result[$name]->admin_title)) {
|
||||
$cache[$name]->admin_title = $result[$name]->title;
|
||||
}
|
||||
cache_set($cid, $cache[$name], 'cache_panels', CACHE_TEMPORARY);
|
||||
}
|
||||
else {
|
||||
$cache[$name] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,6 +305,22 @@ function panels_mini_load_all($reset = FALSE) {
|
||||
if ($reset) {
|
||||
$cache = array();
|
||||
}
|
||||
else {
|
||||
$panel_names = db_select('panels_mini', 'pm')
|
||||
->fields('pm', array('name'))
|
||||
->execute();
|
||||
$cids = array();
|
||||
foreach ($panel_names as $name) {
|
||||
$cids[] = 'panels_mini_load:' . $name->name;
|
||||
}
|
||||
$output = cache_get_multiple($cids, 'cache_panels');
|
||||
foreach ($output as $mini) {
|
||||
if (!empty($mini->data)) {
|
||||
$mini = $mini->data;
|
||||
$cache[$mini->name] = $mini;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ctools_include('export');
|
||||
$minis = ctools_export_load_object('panels_mini');
|
||||
@@ -333,10 +362,14 @@ function panels_mini_load_all($reset = FALSE) {
|
||||
*/
|
||||
function panels_mini_save(&$mini) {
|
||||
if (!empty($mini->display)) {
|
||||
$mini->display->storage_id = $mini->name;
|
||||
$display = panels_save_display($mini->display);
|
||||
$mini->did = $display->did;
|
||||
}
|
||||
|
||||
// Clear the panels_mini_load cache.
|
||||
cache_clear_all('panels_mini_load:', 'cache_panels', TRUE);
|
||||
|
||||
$update = (isset($mini->pid) && $mini->pid != 'new') ? array('pid') : array();
|
||||
drupal_write_record('panels_mini', $mini, $update);
|
||||
|
||||
@@ -389,6 +422,24 @@ function panels_mini_ctools_plugin_directory($module, $plugin) {
|
||||
if ($module == 'ctools' && ($plugin == 'content_types' || $plugin == 'export_ui')) {
|
||||
return 'plugins/' . $plugin;
|
||||
}
|
||||
if ($module == 'panels' && $plugin == 'panels_storage') {
|
||||
return 'plugins/' . $plugin;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_default_panels_mini_alter().
|
||||
*
|
||||
* If a default Panels display has no storage type, set it.
|
||||
*/
|
||||
function panels_default_panels_mini_alter(&$mini_panels) {
|
||||
foreach ($mini_panels as &$mini_panel) {
|
||||
$display =& $mini_panel->display;
|
||||
if (empty($display->storage_type)) {
|
||||
$display->storage_type = 'panels_mini';
|
||||
$display->storage_id = $mini_panel->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -427,6 +478,9 @@ function panels_mini_panels_cache_get($key) {
|
||||
$cache->display = $item->display;
|
||||
$cache->display->context = ctools_context_load_contexts($item);
|
||||
$cache->display->cache_key = 'panels_mini:' . $key;
|
||||
$cache->display->storage_type = 'panels_mini';
|
||||
// Temporary storage id that's replaced in panels_mini_save().
|
||||
$cache->display->storage_id = 'panels_mini';
|
||||
$cache->content_types = panels_common_get_allowed_types('panels_mini', $cache->display->context);
|
||||
$cache->display_title = TRUE;
|
||||
|
||||
@@ -470,6 +524,15 @@ function panels_mini_panels_cache_save($key, $cache) {
|
||||
function panels_mini_panels_cache_break_lock($key, $cache) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_pre_render().
|
||||
*/
|
||||
function panels_mini_panels_pre_render($display, $renderer) {
|
||||
if (isset($display->owner->table) && $display->owner->table == 'panels_mini' && $renderer instanceof panels_renderer_standard) {
|
||||
$renderer->show_empty_layout = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_panels_dashboard_blocks().
|
||||
*
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* @file
|
||||
* Contains the content type plugin for a mini panel. While this does not
|
||||
* need to be broken out into a .inc file, it's convenient that we do so
|
||||
* that we don't load code unneccessarily. Plus it demonstrates plugins
|
||||
* that we don't load code unnecessarily. Plus it demonstrates plugins
|
||||
* in modules other than Panels itself.
|
||||
*
|
||||
*/
|
||||
@@ -68,8 +68,13 @@ function _panels_mini_panels_mini_content_type_content_type($mini) {
|
||||
$type['required context'] = array();
|
||||
foreach ($mini->requiredcontexts as $context) {
|
||||
$info = ctools_get_context($context['name']);
|
||||
// TODO: allow an optional setting
|
||||
$type['required context'][] = new ctools_context_required($context['identifier'], $info['context name']);
|
||||
// Check if the required context is actually required.
|
||||
if (!empty($context['optional'])) {
|
||||
$type['required context'][] = new ctools_context_optional($context['identifier'], $info['context name']);
|
||||
}
|
||||
else {
|
||||
$type['required context'][] = new ctools_context_required($context['identifier'], $info['context name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $type;
|
||||
|
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Provides a panels_storage plugin for mini panels.
|
||||
*/
|
||||
|
||||
// Plugin definition
|
||||
$plugin = array(
|
||||
'access callback' => 'panels_mini_panels_storage_access',
|
||||
);
|
||||
|
||||
/**
|
||||
* Access callback for panels storage.
|
||||
*/
|
||||
function panels_mini_panels_storage_access($storage_type, $storage_id, $op, $account) {
|
||||
if ($op == 'create') {
|
||||
return user_access('create mini panels', $account);
|
||||
}
|
||||
|
||||
return user_access('administer mini panels', $account);
|
||||
}
|
@@ -1,15 +1,14 @@
|
||||
name = Panel nodes
|
||||
description = Create nodes that are divided into areas with selectable content.
|
||||
package = "Panels"
|
||||
version = PANELS_VERSION
|
||||
dependencies[] = panels
|
||||
configure = admin/structure/panels
|
||||
core = 7.x
|
||||
files[] = panels_node.module
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-01-28
|
||||
version = "7.x-3.5"
|
||||
; Information added by Drupal.org packaging script on 2016-10-16
|
||||
version = "7.x-3.8"
|
||||
core = "7.x"
|
||||
project = "panels"
|
||||
datestamp = "1422472985"
|
||||
datestamp = "1476582295"
|
||||
|
||||
|
@@ -56,6 +56,18 @@ function panels_node_uninstall() {
|
||||
drupal_uninstall_schema('panels_node');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_update_dependencies().
|
||||
*/
|
||||
function panels_node_update_dependencies() {
|
||||
// Update 7301 requires panels storage support
|
||||
$dependencies['panels_node'][7301] = array(
|
||||
'panels' => 7305,
|
||||
);
|
||||
|
||||
return $dependencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_update to handle adding a pipeline
|
||||
*/
|
||||
@@ -69,3 +81,87 @@ function panels_node_update_6001() {
|
||||
db_add_field('panels_node', 'pipeline', $field);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate legacy Drupal 6 permissions to Drupal 7.
|
||||
*/
|
||||
function panels_node_update_7301() {
|
||||
$permissions = array(
|
||||
'create panel-nodes' => 'create panel content',
|
||||
'edit any panel-nodes' => 'edit any panel content',
|
||||
'edit own panel-nodes' => 'edit own panel content',
|
||||
'delete any panel-nodes' => 'delete any panel content',
|
||||
'delete own panel-nodes' => 'delete own panel content',
|
||||
);
|
||||
foreach ($permissions as $legacy_permission => $new_permission) {
|
||||
$query = db_select('role_permission', 'p')
|
||||
->fields('p', array('rid'))
|
||||
->condition('permission', $legacy_permission);
|
||||
$rids = $query->execute()->fetchCol();
|
||||
foreach ($rids as $rid) {
|
||||
// Insert the new permission if it doesn't already exist.
|
||||
db_merge('role_permission')
|
||||
->key(array(
|
||||
'rid' => $rid,
|
||||
'permission' => $new_permission,
|
||||
))
|
||||
->insertFields(array(
|
||||
'rid' => $rid,
|
||||
'permission' => $new_permission,
|
||||
'module' => 'node',
|
||||
))
|
||||
->execute();
|
||||
}
|
||||
|
||||
// Delete the legacy permission.
|
||||
db_delete('role_permission')
|
||||
->condition('permission', $legacy_permission)
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the storage type and id on existing panels nodes.
|
||||
*/
|
||||
function panels_node_update_7302() {
|
||||
if (!isset($sandbox['progress'])) {
|
||||
// Initialize batch update information.
|
||||
$sandbox['progress'] = (float)0;
|
||||
$sandbox['current_did'] = -1;
|
||||
$sandbox['max'] = db_query("SELECT COUNT(pd.did)
|
||||
FROM {panels_display} pd
|
||||
JOIN {panels_node} pn ON pn.did = pd.did
|
||||
WHERE pd.storage_type = ''")->fetchField();
|
||||
}
|
||||
|
||||
// Set a limit of how many rows to process per batch.
|
||||
$limit = 1000;
|
||||
|
||||
// Run the query
|
||||
$result = db_query_range("SELECT pd.did, pn.nid
|
||||
FROM {panels_display} pd
|
||||
JOIN {panels_node} pn ON pn.did = pd.did
|
||||
WHERE pd.storage_type = '' AND pd.did > :current_did", 0, $limit, array(':current_did' => $sandbox['current_did']));
|
||||
|
||||
foreach ($result as $row) {
|
||||
db_update('panels_display')
|
||||
->fields(array(
|
||||
'storage_type' => 'panels_node',
|
||||
'storage_id' => $row->nid,
|
||||
))
|
||||
->condition('did', $row->did)
|
||||
->execute();
|
||||
|
||||
// Update our progress information.
|
||||
$sandbox['progress']++;
|
||||
$sandbox['current_did'] = $row->did;
|
||||
}
|
||||
|
||||
// Set the "finished" status, to tell batch engine whether this function
|
||||
// needs to run again.
|
||||
$sandbox['#finished'] = ($sandbox['progress'] >= $sandbox['max']) ? TRUE : ($sandbox['progress'] / $sandbox['max']);
|
||||
|
||||
if ($sandbox['#finished']) {
|
||||
return t('Added the storage type for panels_node to relevant panels displays');
|
||||
}
|
||||
}
|
||||
|
@@ -17,33 +17,22 @@
|
||||
*/
|
||||
function panels_node_permission() {
|
||||
return array(
|
||||
'create panel-nodes' => array(
|
||||
'title' => t('Create panel nodes'),
|
||||
'description' => t('Create new panel nodes.'),
|
||||
),
|
||||
'edit any panel-nodes' => array(
|
||||
'title' => t('Edit any panel-nodes'),
|
||||
'description' => t('Edit all pre-existing panel nodes regardless of ownership.'),
|
||||
),
|
||||
'edit own panel-nodes' => array(
|
||||
'title' => t('Edit own panel nodes'),
|
||||
'description' => t('Edit panel nodes owned by this user.'),
|
||||
),
|
||||
'administer panel-nodes' => array(
|
||||
'title' => t('Administer panel nodes'),
|
||||
'description' => t('Full administrative access to panel nodes including create, update and delete all'),
|
||||
),
|
||||
'delete any panel-nodes' => array(
|
||||
'title' => t('Delete any panel nodes'),
|
||||
'description' => t('Delete any panel node regardless of ownership'),
|
||||
),
|
||||
'delete own panel-nodes' => array(
|
||||
'title' => t('Delete own panel nodes'),
|
||||
'description' => t('Delete any panel node owned by this user.'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_ctools_plugin_directory().
|
||||
*/
|
||||
function panels_node_ctools_plugin_directory($module, $plugin) {
|
||||
if ($module == 'panels' && $plugin == 'panels_storage') {
|
||||
return 'plugins/' . $plugin;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_menu().
|
||||
*/
|
||||
@@ -83,7 +72,7 @@ function panels_node_menu() {
|
||||
|
||||
$items['node/add/panel/choose-layout'] = array(
|
||||
'title' => 'Choose layout',
|
||||
'access arguments' => array('create panel-nodes'),
|
||||
'access callback' => 'panels_add_panel_access_callback',
|
||||
'page callback' => 'panels_node_add',
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
@@ -102,6 +91,13 @@ function panels_node_edit_node($node) {
|
||||
return node_access('update', $node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Access callback to determine if user has access to add panel nodes.
|
||||
*/
|
||||
function panels_add_panel_access_callback() {
|
||||
return user_access('create panel content') || user_access('administer panel-nodes');
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of node add page to force layout selection prior
|
||||
* to actually editing a node.
|
||||
@@ -113,7 +109,7 @@ function panels_node_add() {
|
||||
ctools_include('common', 'panels');
|
||||
|
||||
$layouts = panels_common_get_allowed_layouts('panels_node');
|
||||
return panels_common_print_layout_links($layouts, 'node/add/panel', array('query' => $_GET));
|
||||
return panels_common_print_layout_links($layouts, 'node/add/panel', array('query' => drupal_get_query_parameters()));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -156,19 +152,6 @@ function panels_node_node_access($node, $op, $account) {
|
||||
if (user_access('administer panel-nodes', $account)) {
|
||||
return NODE_ACCESS_ALLOW;
|
||||
}
|
||||
|
||||
if ($op == 'create' && user_access('create panel-nodes', $account)) {
|
||||
return NODE_ACCESS_ALLOW;
|
||||
}
|
||||
|
||||
if ($op == 'update' && (user_access('edit any panel-nodes', $account) || $node->uid == $account->uid && user_access('edit own panel-nodes', $account))) {
|
||||
return NODE_ACCESS_ALLOW;
|
||||
}
|
||||
|
||||
|
||||
if ($op == 'delete' && (user_access('delete any panel-nodes') || $node->uid == $account->uid && user_access('delete own panel-nodes'))) {
|
||||
return NODE_ACCESS_ALLOW;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,14 +166,12 @@ function panels_node_hook_form(&$node, &$form_state) {
|
||||
// and if that doesn't work present them with a list to pick from.
|
||||
$panel_layout = isset($node->panel_layout) ? $node->panel_layout : arg(3);
|
||||
if (empty($panel_layout)) {
|
||||
$opts = $_GET;
|
||||
unset($opts['q']);
|
||||
return drupal_goto('node/add/panel/choose-layout', $opts);
|
||||
drupal_goto('node/add/panel/choose-layout', array('query' => drupal_get_query_parameters()));
|
||||
}
|
||||
|
||||
$layout = panels_get_layout($panel_layout);
|
||||
if (empty($layout)) {
|
||||
return drupal_not_found();
|
||||
return MENU_NOT_FOUND;
|
||||
}
|
||||
$form['panels_node']['layout'] = array(
|
||||
'#type' => 'value',
|
||||
@@ -233,7 +214,7 @@ function panels_node_hook_form(&$node, &$form_state) {
|
||||
'#type' => 'radios',
|
||||
'#options' => $options,
|
||||
'#title' => t('Renderer'),
|
||||
'#default_value' => isset($node->panels_node['pipeline']) ? $node->panels_node['pipeline'] : 'standard',
|
||||
'#default_value' => isset($node->panels_node['pipeline']) ? $node->panels_node['pipeline'] : variable_get('panels_renderer_default', 'standard'),
|
||||
);
|
||||
|
||||
return $form;
|
||||
@@ -271,6 +252,8 @@ function panels_node_hook_insert(&$node) {
|
||||
// Create a new display and record that.
|
||||
$display = panels_new_display();
|
||||
$display->layout = $node->panels_node['layout'];
|
||||
$display->storage_type = 'panels_node';
|
||||
$display->storage_id = $node->nid;
|
||||
|
||||
// Special handling for nodes being imported from an export.module data dump.
|
||||
if (!empty($node->export_display)) {
|
||||
@@ -431,6 +414,19 @@ function panels_node_panels_dashboard_blocks(&$vars) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_ipe_access().
|
||||
*/
|
||||
function panels_node_panels_ipe_access($display) {
|
||||
// We only care about Panels displays from panels_node.
|
||||
if (isset($display->context['panel-node'])) {
|
||||
// Only allow access to use the IPE if the user has 'update' access to
|
||||
// the underlying node.
|
||||
$node = $display->context['panel-node']->data;
|
||||
return node_access('update', $node);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Callbacks for panel caching.
|
||||
|
||||
|
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Provides a panels_storage plugin for panels node.
|
||||
*/
|
||||
|
||||
// Plugin definition
|
||||
$plugin = array(
|
||||
'access callback' => 'panels_node_panels_storage_access',
|
||||
);
|
||||
|
||||
/**
|
||||
* Access callback for panels storage.
|
||||
*/
|
||||
function panels_node_panels_storage_access($storage_type, $storage_id, $op, $account) {
|
||||
if ($node = node_load($storage_id)) {
|
||||
if ($op == 'read') {
|
||||
$op = 'view';
|
||||
}
|
||||
return node_access($op, $node, $account);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +218,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
function get_display_links() {
|
||||
$links = array();
|
||||
|
||||
if (user_access('administer panels styles')) {
|
||||
if (user_access('administer panels display styles')) {
|
||||
$style_links = $this->get_style_links('display');
|
||||
$links[] = array(
|
||||
'title' => '<span class="dropdown-header">' . t('Style') . '</span>' . theme_links(array('links' => $style_links, 'attributes' => array(), 'heading' => array())),
|
||||
@@ -279,7 +280,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
),
|
||||
);
|
||||
|
||||
if (user_access('administer panels styles')) {
|
||||
if (user_access('administer panels region styles')) {
|
||||
$links[] = array(
|
||||
'title' => '<hr />',
|
||||
'html' => TRUE,
|
||||
@@ -513,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.
|
||||
*/
|
||||
@@ -560,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');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1500,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.
|
||||
@@ -1773,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(
|
||||
|
@@ -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;
|
||||
}
|
||||
@@ -474,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.
|
||||
@@ -581,12 +620,14 @@ class panels_renderer_standard {
|
||||
if (!empty($content)) {
|
||||
// Pass long the css_id that is usually available.
|
||||
if (!empty($pane->css['css_id'])) {
|
||||
$content->css_id = check_plain($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']);
|
||||
$class = ctools_context_keyword_substitute($pane->css['css_class'], array(), $this->display->context, array('css safe' => TRUE));
|
||||
$content->css_class = check_plain($class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,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
|
||||
|
@@ -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');
|
||||
|
@@ -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);
|
||||
}
|
@@ -194,7 +194,7 @@ function panels_stylizer_stylizer_style_settings_form($style_settings, $display,
|
||||
* Allow on-the-fly creation of styles in panes.
|
||||
*/
|
||||
function panels_stylizer_pane_add_style(&$renderer, $plugin, &$conf, $type, $pid, $step = NULL) {
|
||||
if (!user_access('administer panels styles')) {
|
||||
if (!user_access("administer panels $type styles")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ function panels_stylizer_pane_add_style(&$renderer, $plugin, &$conf, $type, $pid
|
||||
* preconfigured style.
|
||||
*/
|
||||
function panels_stylizer_edit_pane_style_form(&$form, &$form_state) {
|
||||
if (!user_access('administer panels styles') || !module_exists('stylizer')) {
|
||||
if (!user_access('administer panels pane styles') || !module_exists('stylizer')) {
|
||||
return;
|
||||
}
|
||||
ctools_include('dependent');
|
||||
@@ -322,7 +322,7 @@ function panels_stylizer_edit_pane_style_form(&$form, &$form_state) {
|
||||
* Validate to see if we need to check the preconfigured values.
|
||||
*/
|
||||
function panels_stylizer_edit_pane_style_form_validate(&$form, &$form_state) {
|
||||
if (!user_access('administer panels styles')) {
|
||||
if (!user_access('administer panels pane styles')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ function panels_stylizer_edit_pane_style_form_validate(&$form, &$form_state) {
|
||||
* Store the preconfigured values.
|
||||
*/
|
||||
function panels_stylizer_edit_pane_style_form_submit(&$form, &$form_state) {
|
||||
if (!user_access('administer panels styles')) {
|
||||
if (!user_access('administer panels pane styles')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -219,23 +219,23 @@ function panels_panel_context_tab_operation($handler, $contexts, $args) {
|
||||
* for the handler and pla
|
||||
*/
|
||||
function &panels_panel_context_get_display(&$handler) {
|
||||
if (isset($handler->conf['display'])) {
|
||||
return $handler->conf['display'];
|
||||
}
|
||||
if (!isset($handler->conf['display'])) {
|
||||
if (isset($handler->conf['did'])) {
|
||||
$handler->conf['display'] = panels_load_display($handler->conf['did']);
|
||||
}
|
||||
|
||||
if (isset($handler->conf['did'])) {
|
||||
$handler->conf['display'] = panels_load_display($handler->conf['did']);
|
||||
|
||||
// Check for a valid display. If no valid display can be loaded, something
|
||||
// is wrong and we'll create a new one.
|
||||
if (!empty($handler->conf['display'])) {
|
||||
return $handler->conf['display'];
|
||||
// Check for again for a valid display. If no valid display could be loaded,
|
||||
// something is wrong and we'll create a new one.
|
||||
if (empty($handler->conf['display'])) {
|
||||
$handler->conf['display'] = panels_new_display();
|
||||
}
|
||||
}
|
||||
|
||||
$handler->conf['display'] = panels_new_display();
|
||||
$display =& $handler->conf['display'];
|
||||
$display->storage_type = 'page_manager';
|
||||
$display->storage_id = !empty($handler->name) ? $handler->name : 'new';
|
||||
|
||||
return $handler->conf['display'];
|
||||
return $display;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -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);
|
||||
}
|
||||
@@ -318,19 +321,21 @@ function panels_panel_context_render($handler, $base_contexts, $args, $test = TR
|
||||
$panel_body_css = &drupal_static('panel_body_css');
|
||||
|
||||
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'] = $handler->conf['body_classes_to_remove'];
|
||||
$panel_body_css['body_classes_to_remove'] = check_plain($classes);
|
||||
}
|
||||
else{
|
||||
$panel_body_css['body_classes_to_remove'] .= ' ' . $handler->conf['body_classes_to_remove'];
|
||||
$panel_body_css['body_classes_to_remove'] .= ' ' . check_plain($classes);
|
||||
}
|
||||
}
|
||||
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'] = $handler->conf['body_classes_to_add'];
|
||||
$panel_body_css['body_classes_to_add'] = check_plain($classes);
|
||||
}
|
||||
else {
|
||||
$panel_body_css['body_classes_to_add'] .= ' '. $handler->conf['body_classes_to_add'];
|
||||
$panel_body_css['body_classes_to_add'] .= ' '. check_plain($classes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,8 +371,8 @@ function panels_panel_context_save(&$handler, $update) {
|
||||
ctools_include('css');
|
||||
ctools_css_clear('panel_context:' . $handler->name);
|
||||
|
||||
if (isset($page->conf['temp_layout'])) {
|
||||
unset($page->conf['temp_layout']);
|
||||
if (isset($handler->conf['temp_layout'])) {
|
||||
unset($handler->conf['temp_layout']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -738,6 +743,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'];
|
||||
|
||||
@@ -775,7 +784,7 @@ function panels_panel_context_edit_settings($form, &$form_state) {
|
||||
'#size' => 128,
|
||||
'#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(
|
||||
@@ -783,7 +792,7 @@ function panels_panel_context_edit_settings($form, &$form_state) {
|
||||
'#size' => 128,
|
||||
'#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');
|
||||
@@ -823,13 +832,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'],
|
||||
);
|
||||
|
||||
|
@@ -26,6 +26,12 @@
|
||||
|
||||
<?php if (!empty($columns)): ?>
|
||||
<div class="panels-section-columns">
|
||||
<div class="panels-section-columns-quickfilter container-inline">
|
||||
<label for="quick-filter"><?php print t('Quick-Filter'); ?> </label> <input type="text" name="quickfilter" class="form-text" />
|
||||
<script type="text/javascript">
|
||||
(function ($) { Drupal.Panels.AddContentModalQuickFilter(); })(jQuery);
|
||||
</script>
|
||||
</div>
|
||||
<?php foreach ($columns as $column_id => $column): ?>
|
||||
<div class="panels-section-column panels-section-column-<?php print $column_id; ?> ">
|
||||
<div class="inside">
|
||||
|
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Some rudimentary tests for entity handling, will be overridden by others.
|
||||
*/
|
||||
|
||||
abstract class PanelsEntityViewWebTestCase extends DrupalWebTestCase {
|
||||
|
||||
/**
|
||||
* Admin user.
|
||||
*
|
||||
* @var \StdClass
|
||||
*/
|
||||
protected $adminUser;
|
||||
|
||||
/**
|
||||
* The task handler used for managing a specific entity type.
|
||||
*
|
||||
* @var \StdClass
|
||||
*/
|
||||
protected $view_name = 'node_view';
|
||||
|
||||
/**
|
||||
* The label used for this entity's task handler.
|
||||
*
|
||||
* @var \StdClass
|
||||
*/
|
||||
protected $view_label = 'Node template';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function setUp(array $modules = array()) {
|
||||
$modules[] = 'panels';
|
||||
$modules[] = 'page_manager';
|
||||
|
||||
parent::setUp($modules);
|
||||
|
||||
$permissions = array(
|
||||
// Allow the user to access the Page Manager admin page.
|
||||
'use page manager',
|
||||
|
||||
// Basic permissions for the module.
|
||||
'use panels dashboard',
|
||||
|
||||
// General admin access.
|
||||
'access administration pages',
|
||||
);
|
||||
|
||||
// Reset the static variable used to identify permissions, otherwise it's
|
||||
// possible the permissions check in drupalCreateUser will fail.
|
||||
$this->checkPermissions(array(), TRUE);
|
||||
cache_clear_all();
|
||||
|
||||
// Create the admin user.
|
||||
$this->adminUser = $this->drupalCreateUser($permissions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the {ENTITY}_view toggle works correctly.
|
||||
*/
|
||||
function testToggle() {
|
||||
// Log in as the admin user.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
// Load the Panels dashboard.
|
||||
$this->drupalGet('admin/structure/panels');
|
||||
$this->assertResponse(200, 'Loaded the main Panels admin page.');
|
||||
|
||||
// Confirm that the Node View task handler is disabled.
|
||||
$this->assertText(t($this->view_label));
|
||||
$this->assertLinkByHref(url('admin/structure/pages/edit/' . $this->view_name, array('absolute' => FALSE)));
|
||||
$xpath = $this->xpath("//tr[contains(@class,:tr)]/td/div/div/ul/li[contains(@class,:li)]/a", array(':tr' => 'page-task-' . $this->view_name, ':li' => 'first'));
|
||||
$this->assertEqual($xpath[0][0], t('Enable'));
|
||||
|
||||
// Set the Node View handler to "off".
|
||||
variable_set('page_manager_' . $this->view_name . '_disabled', TRUE);
|
||||
|
||||
// Load the Panels dashboard again.
|
||||
$this->drupalGet('admin/structure/panels');
|
||||
$this->assertResponse(200, 'Loaded the main Panels admin page.');
|
||||
|
||||
// Confirm that the Node View task handler is still disabled.
|
||||
$this->assertText(t($this->view_label));
|
||||
$this->assertNoLinkByHref(url('admin/structure/pages/nojs/disable/' . $this->view_name, array('absolute' => FALSE)));
|
||||
$xpath = $this->xpath("//tr[contains(@class,:tr)]/td/div/div/ul/li[contains(@class,:li)]/a", array(':tr' => 'page-task-' . $this->view_name, ':li' => 'first'));
|
||||
$this->assertEqual($xpath[0][0], t('Enable'));
|
||||
|
||||
// Set the Node View handler to "on".
|
||||
variable_set('page_manager_' . $this->view_name . '_disabled', FALSE);
|
||||
|
||||
// Load the Panels dashboard again.
|
||||
$this->drupalGet('admin/structure/panels');
|
||||
$this->assertResponse(200, 'Loaded the main Panels admin page.');
|
||||
|
||||
// Confirm that the Node View task handler is now enabled.
|
||||
$this->assertLinkByHref(url('admin/structure/pages/nojs/disable/' . $this->view_name, array('absolute' => FALSE)));
|
||||
$xpath = $this->xpath("//tr[contains(@class,:tr)]/td/div/div/ul/li[contains(@class,:li)]/a", array(':tr' => 'page-task-' . $this->view_name, ':li' => 'last'));
|
||||
$this->assertEqual($xpath[0][0], t('Disable'));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Some rudimentary tests for the node_view handler.
|
||||
*/
|
||||
|
||||
class PanelsNodeViewWebTestCase extends PanelsEntityViewWebTestCase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Panels node_view tests',
|
||||
'description' => 'Test the standard node_view task handler.',
|
||||
'group' => 'Panels',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $view_name = 'node_view';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $view_label = 'Node template';
|
||||
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Some rudimentary tests for the term_view handler.
|
||||
*/
|
||||
|
||||
class PanelsTermViewWebTestCase extends PanelsEntityViewWebTestCase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Panels term_view tests',
|
||||
'description' => 'Test the standard term_view task handler.',
|
||||
'group' => 'Panels',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $view_name = 'term_view';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $view_label = 'Taxonomy term template';
|
||||
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Some rudimentary tests for the user_view handler.
|
||||
*/
|
||||
|
||||
class PanelsUserViewWebTestCase extends PanelsEntityViewWebTestCase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Panels user_view tests',
|
||||
'description' => 'Test the standard user_view task handler.',
|
||||
'group' => 'Panels',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $view_name = 'user_view';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $view_label = 'Users';
|
||||
|
||||
}
|
Reference in New Issue
Block a user