all contrib module security updates done
@@ -88,4 +88,4 @@ Known Issue http://drupal.org/node/207859
|
||||
secure pages doesn't know about. When trying to make non-secure ajax calls
|
||||
from a secure page, the browser denies the call.
|
||||
Solution:
|
||||
The solution is to simply add panels/* to your Secure Pages configuration.
|
||||
The solution is to simply add panels/* to your Secure Pages configuration.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
.dashboard-entry .dashboard-link {
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
div.panel-pane div.admin-links {
|
||||
font-size: xx-small;
|
||||
margin-right: 1em;
|
||||
@@ -40,11 +39,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;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
.layout-link {
|
||||
float: left;
|
||||
padding: 1em;
|
||||
@@ -11,6 +10,10 @@
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.layout-link span {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* general style for the layout-icon */
|
||||
.layout-icon .caption {
|
||||
width: 90px;
|
||||
@@ -141,12 +144,12 @@ table .argument-operation input {
|
||||
}
|
||||
|
||||
tr.changed td {
|
||||
background-color: #FFFFDD !important;
|
||||
background-color: #ffffdd !important;
|
||||
}
|
||||
|
||||
tr.changed td span.star {
|
||||
font-weight: bold;
|
||||
color: #E09010;
|
||||
color: #e09010;
|
||||
}
|
||||
|
||||
td select {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
#panels-dnd-main {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
@@ -42,7 +41,7 @@ div.panels-set-title-hide .panels-set-title {
|
||||
}
|
||||
|
||||
/* Add Icon */
|
||||
#panels-dnd-main div.panel-region .pane-add-link {
|
||||
#panels-dnd-main div.panel-region .pane-add-link {
|
||||
}
|
||||
#panels-dnd-main div.panel-region .pane-add-link img {
|
||||
display: none;
|
||||
@@ -127,24 +126,24 @@ div.panels-set-title-hide .panel-pane-is-title {
|
||||
}
|
||||
|
||||
.panel-portlet .changed div.grab-title {
|
||||
background-color: #FFFFDD !important;
|
||||
border-bottom: 1px solid #3D9CD7 !important;
|
||||
background-color: #ffffdd !important;
|
||||
border-bottom: 1px solid #3d9cd7 !important;
|
||||
color: black !important;
|
||||
}
|
||||
|
||||
.panel-portlet .changed.hidden-pane div.grab-title {
|
||||
background-color: #B4B488 !important;
|
||||
border-bottom: 1px solid #3D9CD7 !important;
|
||||
background-color: #b4b488 !important;
|
||||
border-bottom: 1px solid #3d9cd7 !important;
|
||||
}
|
||||
|
||||
.panel-portlet .changed div.grab-title span.star {
|
||||
font-weight: bold;
|
||||
color: #E09010;
|
||||
color: #e09010;
|
||||
}
|
||||
|
||||
.panel-portlet .grabber:hover {
|
||||
color: #fff;
|
||||
background-color: #2F78A5;
|
||||
background-color: #2f78a5;
|
||||
}
|
||||
|
||||
.panel-portlet.hidden-pane .grab-title:hover {
|
||||
@@ -175,7 +174,8 @@ div.panels-set-title-hide .panel-pane-is-title {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.panel-portlet .buttons input {
|
||||
.panel-portlet .buttons input,
|
||||
.panel-portlet .buttons button {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: inline;
|
||||
@@ -186,7 +186,7 @@ div.panels-set-title-hide .panel-pane-is-title {
|
||||
}
|
||||
|
||||
.panel-portlet .pane-title {
|
||||
font-size:110%;
|
||||
font-size: 110%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -346,7 +354,7 @@ a.close img {
|
||||
|
||||
.panels-section-column-categories .inside {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.panels-section-column-categories .content-type-button {
|
||||
padding-left: 10px;
|
||||
@@ -369,22 +377,29 @@ a.close img {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.content-type-button a {
|
||||
display: inline-block;
|
||||
width: 99%;
|
||||
}
|
||||
|
||||
.content-type-button a:focus {
|
||||
border: 1px dotted black;
|
||||
}
|
||||
|
||||
.content-type-button img {
|
||||
border: 2px solid white;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.content-type-button img:hover {
|
||||
border: 2px solid blue;
|
||||
}
|
||||
|
||||
.content-type-button div {
|
||||
.content-type-button div,
|
||||
.content-type-button span {
|
||||
width: 85%;
|
||||
position: relative;
|
||||
top: -5px;
|
||||
left: 2px;
|
||||
float: left;
|
||||
padding-left: 3px;
|
||||
padding-top: 5px;
|
||||
left: 3px;
|
||||
}
|
||||
|
||||
#panels-preview .modal-throbber-wrapper {
|
||||
@@ -416,7 +431,7 @@ a.close img {
|
||||
float: none;
|
||||
}
|
||||
|
||||
.panels-modal-content .modal-form .no-float label {
|
||||
.panels-modal-content .modal-form .no-float label {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
@@ -487,7 +502,6 @@ html.js div.panels-display-links div.ctools-dropdown-container ul li a {
|
||||
/* @group CTools Dropdown */
|
||||
#panels-dnd-main .ctools-dropdown a.ctools-dropdown-text-link,
|
||||
html.js div.panels-display-links a.ctools-dropdown-text-link {
|
||||
|
||||
background: url('../images/arrow-down-light.png') 0 3px no-repeat!important;
|
||||
padding-left: 12px;
|
||||
}
|
||||
@@ -507,7 +521,6 @@ html.js div.panels-display-links div.ctools-dropdown-container {
|
||||
|
||||
html.js #panels-dnd-main div.ctools-dropdown div.ctools-dropdown-container ul li,
|
||||
html.js div.panels-display-links div.ctools-dropdown-container ul li {
|
||||
|
||||
text-decoration: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
@@ -550,7 +563,7 @@ html.js #panels-dnd-main div.ctools-dropdown div.ctools-dropdown-container ul li
|
||||
html.js div.panels-display-links div.ctools-dropdown-container ul li .panels-sub-menu ul li a,
|
||||
html.js #panels-dnd-main div.ctools-dropdown div.ctools-dropdown-container ul li .panels-sub-menu span.panels-text,
|
||||
html.js div.panels-display-links div.ctools-dropdown-container ul li .panels-sub-menu span.panels-text {
|
||||
width:auto;
|
||||
width: auto;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
@@ -667,4 +680,3 @@ div.ctools-modal-content {
|
||||
top: -2em;
|
||||
margin-bottom: -2em;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
div.panels-page-type-container {
|
||||
clear: left;
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
|
||||
This module provides by default the ability to translate panel display and
|
||||
panel pane titles.
|
||||
Further it introduced an extension to the ctools content_types plugin.
|
||||
You can now define translatable settings which will be registered in i18n.
|
||||
Out of the box the module extends the custom content content_type to allow
|
||||
translation of the content.
|
||||
|
||||
Requirements:
|
||||
Ctools 7.x-1.x-dev (Jan 28-2014 or newer)
|
||||
Panels 7.x-3.x-dev (Jan 28-2014 or newer)
|
||||
|
||||
Plugin definition extension:
|
||||
------------------------------
|
||||
|
||||
This example shows how the content_type custom is extended:
|
||||
|
||||
#### Default: ####
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t('Custom content'),
|
||||
'no title override' => TRUE,
|
||||
'defaults' => array('admin_title' => '', 'title' => '', 'body' => '', 'format' => filter_fallback_format(), 'substitute' => TRUE),
|
||||
'js' => array('misc/autocomplete.js', 'misc/textarea.js', 'misc/collapse.js'),
|
||||
// Make sure the edit form is only used for some subtypes.
|
||||
'edit form' => '',
|
||||
'add form' => '',
|
||||
'edit text' => t('Edit'),
|
||||
'all contexts' => TRUE,
|
||||
);
|
||||
|
||||
#### Extended Configuration: ####
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t('Custom content'),
|
||||
'no title override' => TRUE,
|
||||
'defaults' => array('admin_title' => '', 'title' => '', 'body' => '', 'format' => filter_fallback_format(), 'substitute' => TRUE),
|
||||
'js' => array('misc/autocomplete.js', 'misc/textarea.js', 'misc/collapse.js'),
|
||||
// Make sure the edit form is only used for some subtypes.
|
||||
'edit form' => '',
|
||||
'add form' => '',
|
||||
'edit text' => t('Edit'),
|
||||
'all contexts' => TRUE,
|
||||
'i18n_settings' = array(
|
||||
'title',
|
||||
'body' => array('format' => 'plain_text'),
|
||||
'items|0|title'
|
||||
),
|
||||
);
|
||||
|
||||
The new key "i18n_settings" defines an array with the settings that are
|
||||
translatable. The array contains the names of the settings, they have to be
|
||||
available in the "defaults" array of the content definition. If you need to
|
||||
define a format use the name of the setting as the array item key and as item
|
||||
another array with the detail configuration. E.g
|
||||
'i18n_settings' = array('body' => array('format' => 'plain_text'))
|
||||
|
||||
If i18n_settings is a string it's used as callback. The expected return is an
|
||||
array equal to the one used in the fix configuration.
|
||||
You can even declare nested settings as translatable, to do so use '|' as
|
||||
delimiter.
|
||||
E.g. 'items|0|title' is evaluated as $settings['items'][0]['title']
|
||||
|
||||
#### Callback: ####
|
||||
/**
|
||||
* Plugins are described by creating a $plugin array which will be used
|
||||
* by the system that includes this file.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t('Custom content'),
|
||||
'no title override' => TRUE,
|
||||
'defaults' => array('admin_title' => '', 'title' => '', 'body' => '', 'format' => filter_fallback_format(), 'substitute' => TRUE),
|
||||
'js' => array('misc/autocomplete.js', 'misc/textarea.js', 'misc/collapse.js'),
|
||||
// Make sure the edit form is only used for some subtypes.
|
||||
'edit form' => '',
|
||||
'add form' => '',
|
||||
'edit text' => t('Edit'),
|
||||
'all contexts' => TRUE,
|
||||
'i18n_settings' => 'ctools_custom_content_type_i18n_settings',
|
||||
);
|
||||
|
||||
function ctools_custom_content_type_i18n_settings($conf) {
|
||||
return array(
|
||||
'title',
|
||||
'body' => array('format' => $conf['format']),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Internationalization (i18n) hooks.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_i18n_object_info().
|
||||
*/
|
||||
function i18n_panels_i18n_object_info() {
|
||||
$info['pane_configuration'] = array(
|
||||
'title' => t('Pane Configuration'),
|
||||
'key' => 'uuid',
|
||||
'string translation' => array(
|
||||
'textgroup' => 'panels',
|
||||
'type' => 'pane_configuration',
|
||||
'properties' => array(
|
||||
'title' => t('Pane Title'),
|
||||
),
|
||||
),
|
||||
);
|
||||
$info['display_configuration'] = array(
|
||||
'title' => t('Display Configuration'),
|
||||
'key' => 'uuid',
|
||||
'string translation' => array(
|
||||
'textgroup' => 'panels',
|
||||
'type' => 'display_configuration',
|
||||
'properties' => array(
|
||||
'title' => t('Display Title'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_i18n_string_info().
|
||||
*/
|
||||
function i18n_panels_i18n_string_info() {
|
||||
$groups['panels'] = array(
|
||||
'title' => t('Panels'),
|
||||
'description' => t('Translatable panels items: display and pane configuration items. E.g. Title.'),
|
||||
// This group doesn't have strings with format.
|
||||
'format' => FALSE,
|
||||
// This group can list all strings.
|
||||
'list' => FALSE,
|
||||
);
|
||||
return $groups;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
name = Panels translation
|
||||
description = Supports translatable panels items.
|
||||
dependencies[] = i18n
|
||||
dependencies[] = panels
|
||||
dependencies[] = i18n_string
|
||||
dependencies[] = i18n_translation
|
||||
package = Multilingual - Internationalization
|
||||
core = 7.x
|
||||
|
||||
; Information added by Drupal.org packaging script on 2020-07-05
|
||||
version = "7.x-3.10"
|
||||
core = "7.x"
|
||||
project = "panels"
|
||||
datestamp = "1593990788"
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Internationalization (i18n) submodule: Panels translation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_requirements().
|
||||
*/
|
||||
function i18n_panels_requirements($phase) {
|
||||
$requirements = array();
|
||||
// Check only for status report, to allow update / install.
|
||||
if ($phase == 'runtime') {
|
||||
// Check if the panels module runs with uuids.
|
||||
$requirements['uuid'] = array(
|
||||
'title' => t('Panels uuid support.'),
|
||||
'severity' => REQUIREMENT_OK,
|
||||
'value' => t('Available'),
|
||||
);
|
||||
if (!db_field_exists('panels_pane', 'uuid')) {
|
||||
$requirements['uuid']['severity'] = REQUIREMENT_ERROR;
|
||||
$requirements['uuid']['value'] = t('Not found. Please apply the provided patches and run the update script.');
|
||||
}
|
||||
}
|
||||
return $requirements;
|
||||
}
|
||||
@@ -0,0 +1,485 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Internationalization (i18n) submodule: Panels translation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fetch the i18n_settings of the content type if there are any.
|
||||
*
|
||||
* @param stdClass $pane
|
||||
* The pane to deal with.
|
||||
*
|
||||
* @return array|false
|
||||
* Settings or FALSE if none are present.
|
||||
*/
|
||||
function i18n_panels_get_i18n_settings($pane) {
|
||||
ctools_include('content');
|
||||
$content_type = ctools_get_content_type($pane->type);
|
||||
if (isset($content_type['i18n_settings'])) {
|
||||
if (is_string($content_type['i18n_settings']) && function_exists($content_type['i18n_settings'])) {
|
||||
$content_type['i18n_settings'] = $content_type['i18n_settings']($pane->configuration);
|
||||
}
|
||||
}
|
||||
// Provide the override title string as translation for all panes that have
|
||||
// this setting enabled.
|
||||
if (isset($pane->configuration['override_title']) && $pane->configuration['override_title']) {
|
||||
if (isset($content_type['i18n_settings']) && is_array($content_type['i18n_settings'])) {
|
||||
$content_type['i18n_settings'][] = 'override_title_text';
|
||||
}
|
||||
else {
|
||||
$content_type['i18n_settings'] = array('override_title_text');
|
||||
}
|
||||
}
|
||||
return isset($content_type['i18n_settings']) ? $content_type['i18n_settings'] : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the translation object of the pane.
|
||||
*
|
||||
* @param stdClass $pane
|
||||
* The pane to deal with.
|
||||
*
|
||||
* @return stdClass|FALSE
|
||||
* Returns FALSE if no translation is necessary.
|
||||
*/
|
||||
function i18n_panels_get_i18n_translation_object($pane) {
|
||||
$translation_object = array();
|
||||
|
||||
// Handle content type specific i18n settings.
|
||||
if ($i18n_settings = i18n_panels_get_i18n_settings($pane)) {
|
||||
// Register translatable settings.
|
||||
foreach ($i18n_settings as $i18n_setting => $settings) {
|
||||
if (!is_array($settings)) {
|
||||
$i18n_setting = $settings;
|
||||
$settings = array('format' => 'plain_text');
|
||||
}
|
||||
$translation_object[$i18n_setting] = NULL;
|
||||
$key_exists = FALSE;
|
||||
// Ensure a nested setting is "unpacked".
|
||||
$config_value = drupal_array_get_nested_value($pane->configuration, explode('|', $i18n_setting), $key_exists);
|
||||
// If we reached the end of the nested setting use the value as source.
|
||||
if ($key_exists) {
|
||||
$translation_object[$i18n_setting] = array(
|
||||
'string' => $config_value,
|
||||
'format' => $settings['format'],
|
||||
);
|
||||
$translation_object['panels_i18n_settings'][$i18n_setting] = $settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if this pane has a custom title enabled.
|
||||
if (!empty($pane->configuration['override_title'])) {
|
||||
$translation_object['title']['string'] = $pane->configuration['override_title_text'];
|
||||
}
|
||||
if (!empty($translation_object)) {
|
||||
return (object) $translation_object;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_pane_insert().
|
||||
*
|
||||
* @param stdClass $pane
|
||||
* The pane to deal with.
|
||||
*/
|
||||
function i18n_panels_panels_pane_insert($pane) {
|
||||
i18n_panels_panels_pane_update($pane);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_pane_update().
|
||||
*
|
||||
* @param stdClass $pane
|
||||
* The pane to deal with.
|
||||
*/
|
||||
function i18n_panels_panels_pane_update($pane) {
|
||||
if ($translation_object = i18n_panels_get_i18n_translation_object($pane)) {
|
||||
$translation_object->uuid = $pane->uuid;
|
||||
$status = i18n_string_object_update('pane_configuration', $translation_object);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_pane_delete().
|
||||
*
|
||||
* @param array $pids
|
||||
* Array with the panel ids to delete.
|
||||
*/
|
||||
function i18n_panels_panels_pane_delete($pids) {
|
||||
if (!empty($pids)) {
|
||||
// Fetch the uuids from the db.
|
||||
$uuids = db_select('panels_pane')
|
||||
->fields('panels_pane', array('uuid'))
|
||||
->condition('pid', $pids)
|
||||
->execute()
|
||||
->fetchCol();
|
||||
foreach ($uuids as $uuid) {
|
||||
// Create dummy pane with uuid as property.
|
||||
$pane = (object) array('uuid' => $uuid);
|
||||
i18n_string_object_remove('pane_configuration', $pane);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_pane_prerender().
|
||||
*
|
||||
* @param stdClass $pane
|
||||
* The pane to deal with.
|
||||
*/
|
||||
function i18n_panels_panels_pane_prerender($pane) {
|
||||
// Check if this pane has translations.
|
||||
if (isset($pane->uuid) && $translation_object = i18n_panels_get_i18n_translation_object($pane)) {
|
||||
$translation_object->uuid = $pane->uuid;
|
||||
// Send to translation.
|
||||
$translation_object = i18n_string_object_translate('pane_configuration', $translation_object);
|
||||
unset($translation_object->uuid, $translation_object->i18n_settings);
|
||||
foreach ($translation_object as $i18n_setting => $translated_setting) {
|
||||
if ($i18n_setting != 'panels_i18n_settings') {
|
||||
if (is_array($translated_setting)) {
|
||||
$translated_setting = $translated_setting['string'];
|
||||
}
|
||||
drupal_array_set_nested_value($pane->configuration, explode('|', $i18n_setting), $translated_setting);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_display_save().
|
||||
*
|
||||
* @param panels_display $display
|
||||
* The display to deal with.
|
||||
*/
|
||||
function i18n_panels_panels_display_save($display) {
|
||||
$status = i18n_string_object_update('display_configuration', $display);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_display_delete().
|
||||
*
|
||||
* @param int $did
|
||||
* Id of the display to delete.
|
||||
*/
|
||||
function i18n_panels_panels_delete_display($did) {
|
||||
// Fetch uuid to delete the translations.
|
||||
$uuid = db_select('panels_display')
|
||||
->fields('panels_display', array('uuid'))
|
||||
->condition('did', $did)
|
||||
->execute()
|
||||
->fetchColumn();
|
||||
// Build a dummy display.
|
||||
$display = (object) array('uuid' => $uuid);
|
||||
|
||||
// Check if this display was just saved in the db.
|
||||
if (!_18n_panels_is_exported_panels_display($display)) {
|
||||
// If the display was just saved in the db remove all translations.
|
||||
i18n_string_object_remove('display_configuration', $display);
|
||||
// Remove related pane translations too.
|
||||
$pids = db_select('panels_pane')
|
||||
->fields('panels_pane', array('pid'))
|
||||
->condition('did', $did)
|
||||
->execute()
|
||||
->fetchCol();
|
||||
i18n_panels_panels_pane_delete($pids);
|
||||
}
|
||||
else {
|
||||
// If the display is exported leave the translated strings but give the user
|
||||
// a hint how to clean up.
|
||||
drupal_set_message(
|
||||
t(
|
||||
'The reverted panels display(s) were exported, please run a <a href="!link">string refresh</a> to update the translatable strings.',
|
||||
array('!link' => url('admin/config/regional/translate/i18n_string'))
|
||||
),
|
||||
'warning',
|
||||
FALSE
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_pre_render().
|
||||
*
|
||||
* This function must not rely on the passed $renderer parameter. The parameter
|
||||
* could be empty because this function is reused in i18n_ctools_render_alter().
|
||||
*
|
||||
* @todo Check if a drupal_alter() in panels_display::get_title() is applicable.
|
||||
*
|
||||
* @see i18n_ctools_render_alter()
|
||||
*
|
||||
* @param panels_display $display
|
||||
* The display to deal with.
|
||||
* @param panels_renderer_standard $renderer
|
||||
* The renderer to deal with.
|
||||
*/
|
||||
function i18n_panels_panels_pre_render(&$display, $renderer) {
|
||||
// Avoid double translations.
|
||||
if (!isset($display->i18n_panels_title_translated)) {
|
||||
$translation = i18n_string_object_translate('display_configuration', $display);
|
||||
if (is_array($translation->title)) {
|
||||
$display->title = $translation->title['string'];
|
||||
}
|
||||
else {
|
||||
$display->title = $translation->title;
|
||||
}
|
||||
$display->i18n_panels_title_translated = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ctools_render_alter().
|
||||
*
|
||||
* Under some circumstances the title of the panel page is set before
|
||||
* hook_panels_pre_render() is fired. Such cases can be handled with this hook.
|
||||
*
|
||||
* @todo Check if a drupal_alter() in panels_display::get_title() is applicable.
|
||||
*/
|
||||
function i18n_ctools_render_alter(&$info, $page, $context) {
|
||||
// @todo Find a better way to detect a panels page.
|
||||
if ($page === TRUE && !empty($info['content']['#display']) && $info['content']['#display'] instanceof panels_display) {
|
||||
i18n_panels_panels_pre_render($info['content']['#display'], NULL);
|
||||
// Set the info title. This is used to set the page title.
|
||||
$info['title'] = $info['content']['#display']->get_title();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_ctools_plugin_post_alter().
|
||||
*
|
||||
* Register some translatable configuration settings for plugins.
|
||||
*/
|
||||
function i18n_panels_ctools_plugin_post_alter(&$plugin, $plugin_type_info) {
|
||||
if ($plugin_type_info['type'] == 'content_types') {
|
||||
// Modify custom content.
|
||||
if ($plugin['name'] == 'custom') {
|
||||
// Register callback to get the translatable settings.
|
||||
$plugin['i18n_settings'] = 'ctools_custom_content_type_i18n_settings';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to provide the translatable settings appropriate to the config.
|
||||
*
|
||||
* @param array $conf
|
||||
* Content type configuration.
|
||||
*
|
||||
* @return array
|
||||
* i18n_settings configuration.
|
||||
*/
|
||||
function ctools_custom_content_type_i18n_settings($conf) {
|
||||
return array(
|
||||
'title',
|
||||
'body' => array('format' => $conf['format']),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_i18n_string_list_TEXTGROUP_alter().
|
||||
*
|
||||
* Necessary to support the dynamic translatable settings defined by ctools
|
||||
* content types.
|
||||
*/
|
||||
function i18n_panels_i18n_string_list_panels_alter(&$strings, $type = NULL, $object = NULL) {
|
||||
if (isset($object->panels_i18n_settings)) {
|
||||
foreach ($object->panels_i18n_settings as $i18n_setting => $settings) {
|
||||
if (isset($object->{$i18n_setting})) {
|
||||
$strings['panels'][$type][$object->uuid][$i18n_setting] = $object->{$i18n_setting};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_i18n_string_list().
|
||||
*
|
||||
* @todo Figure out a generic solution to fetch exported displays.
|
||||
*/
|
||||
function i18n_panels_i18n_string_list($group) {
|
||||
$strings = array();
|
||||
if ($group == 'panels') {
|
||||
|
||||
// Fetch all available displays.
|
||||
$displays = _18n_panels_fetch_all_panel_displays();
|
||||
|
||||
foreach ($displays as $display) {
|
||||
if (empty($display->uuid)) {
|
||||
drupal_set_message(t('The display %display has no uuid, please resave or re-export it.', array('%display' => $display->did)), 'warning');
|
||||
continue;
|
||||
}
|
||||
// Avoid duplicated runs _18n_panels_fetch_all_panel_displays() probably
|
||||
// returns the same display twice, one for the db based and one for the
|
||||
// exported one.
|
||||
if (isset($strings['panels']['display_configuration'][$display->uuid])) {
|
||||
continue;
|
||||
}
|
||||
$strings['panels']['display_configuration'][$display->uuid]['title']['string'] = $display->title;
|
||||
foreach ($display->content as $pane) {
|
||||
if (empty($pane->uuid)) {
|
||||
// Fetch exported uuid and validate it.
|
||||
$uuid = str_replace('new-', '', $pane->pid);
|
||||
if (!ctools_uuid_is_valid($uuid)) {
|
||||
drupal_set_message(t('The pane %pane has no uuid, please resave or re-export it.', array('%pane' => $pane->pid)), 'warning');
|
||||
continue;
|
||||
}
|
||||
$pane->uuid = $uuid;
|
||||
}
|
||||
if ($translation_object = i18n_panels_get_i18n_translation_object($pane)) {
|
||||
// Split up all strings and add them to the list.
|
||||
$pane_strings = (array) $translation_object;
|
||||
unset($pane_strings['panels_i18n_settings']);
|
||||
foreach ($pane_strings as $key => $pane_string) {
|
||||
$strings['panels']['pane_configuration'][$pane->uuid][$key] = $pane_string;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $strings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the give display is exported or only stored in the db.
|
||||
*
|
||||
* @return boolean
|
||||
* TRUE if the display is available from code.
|
||||
*/
|
||||
function _18n_panels_is_exported_panels_display($display) {
|
||||
if (!isset($display->uuid)) {
|
||||
return FALSE;
|
||||
}
|
||||
$uuid = $display->uuid;
|
||||
// Check exported displays.
|
||||
ctools_include('export');
|
||||
$panels_display_temp = ctools_export_crud_load('panels_display', $uuid);
|
||||
$panels_mini_temp = ctools_export_crud_load('panels_mini', $uuid);
|
||||
if (
|
||||
!empty($panels_display_temp)
|
||||
|| !empty($panels_mini_temp)
|
||||
|| (module_exists('panelizer') && ctools_export_crud_load('panelizer_defaults', $uuid))
|
||||
) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Check page manager embedded displays.
|
||||
// @see _18n_panels_fetch_all_panel_displays()
|
||||
if (module_exists('page_manager')) {
|
||||
module_load_include('inc', 'page_manager', 'page_manager.admin');
|
||||
$tasks = page_manager_get_tasks_by_type('page');
|
||||
$pages = array('operations' => array(), 'tasks' => array());
|
||||
page_manager_get_pages($tasks, $pages);
|
||||
|
||||
foreach ($pages['tasks'] as $task) {
|
||||
$page = page_manager_cache_load($task);
|
||||
foreach ($page->handler_info as $id => $info) {
|
||||
$page_manager_handler = $page->handlers[$id];
|
||||
if ($page_manager_handler->handler == 'panel_context') {
|
||||
$is_exported = ($page_manager_handler->export_type == (EXPORT_IN_CODE | EXPORT_IN_DATABASE) || (isset($page->subtask['storage']) && $page->subtask['storage'] == t('Overridden')));
|
||||
if (!empty($page_manager_handler->conf['display'])) {
|
||||
$panels_display = $page_manager_handler->conf['display'];
|
||||
if ($panels_display->uuid == $uuid) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
elseif ($is_exported && isset($page_manager_handler->conf['did'])) {
|
||||
$panels_display = panels_load_display($page_manager_handler->conf['did']);
|
||||
if (isset($panels_display->uuid) && $panels_display->uuid == $uuid) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of really all available panel displays.
|
||||
*
|
||||
* The list is statically cached. Use the parameter $reset to refresh the list
|
||||
* during the same request.
|
||||
* Probably returns the same display twice - once with the db based and once
|
||||
* the exported one.
|
||||
*
|
||||
* @todo I bet there are better ways to solve this mess.
|
||||
*
|
||||
* @param bool $reset
|
||||
* Reset the static cache.
|
||||
*
|
||||
* @return array
|
||||
* List of all panel displays.
|
||||
*/
|
||||
function _18n_panels_fetch_all_panel_displays($reset = FALSE) {
|
||||
$displays = &drupal_static(__FUNCTION__, array());
|
||||
if (!empty($displays) && !$reset) {
|
||||
return $displays;
|
||||
}
|
||||
|
||||
// Fetch db based displays.
|
||||
$dids = db_select('panels_display')->fields('panels_display', array('did'))->execute()->fetchCol();
|
||||
$displays = panels_load_displays($dids);
|
||||
|
||||
// Fetch exported displays.
|
||||
ctools_include('export');
|
||||
foreach (ctools_export_crud_load_all('panels_display') as $panels_display) {
|
||||
if (!empty($panels_display->uuid)) {
|
||||
$displays['exported-' . $panels_display->uuid] = $panels_display;
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch mini panels.
|
||||
$mini_panels = ctools_export_crud_load_all('panels_mini');
|
||||
foreach ($mini_panels as $pane) {
|
||||
if (!empty($pane->display->uuid)) {
|
||||
$displays['exported-' . $pane->display->uuid] = $pane->display;
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch in page manager embedded displays.
|
||||
if (module_exists('page_manager')) {
|
||||
module_load_include('inc', 'page_manager', 'page_manager.admin');
|
||||
$tasks = page_manager_get_tasks_by_type('page');
|
||||
$pages = array('operations' => array(), 'tasks' => array());
|
||||
page_manager_get_pages($tasks, $pages);
|
||||
|
||||
foreach ($pages['tasks'] as $task) {
|
||||
$page = page_manager_cache_load($task);
|
||||
$task_info = page_manager_get_task_subtasks($page->task);
|
||||
foreach ($page->handler_info as $id => $info) {
|
||||
$page_manager_handler = $page->handlers[$id];
|
||||
if ($page_manager_handler->handler == 'panel_context') {
|
||||
|
||||
// @todo Is there really no better way to check this?
|
||||
$is_exported = ($page_manager_handler->export_type == (EXPORT_IN_CODE | EXPORT_IN_DATABASE) || (isset($page->subtask['storage']) && $page->subtask['storage'] == t('Overridden')));
|
||||
|
||||
if (!empty($page_manager_handler->conf['display'])) {
|
||||
$panels_display = $page_manager_handler->conf['display'];
|
||||
$displays['exported-' . $panels_display->uuid] = $panels_display;
|
||||
}
|
||||
elseif ($is_exported && isset($page_manager_handler->conf['did'])) {
|
||||
$panels_display = panels_load_display($page_manager_handler->conf['did']);
|
||||
if (isset($panels_display->uuid)) {
|
||||
$displays['exported-' . $panels_display->uuid] = $panels_display;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch panelizer displays.
|
||||
if (module_exists('panelizer')) {
|
||||
// Fetch all default handlers.
|
||||
$panelizer_defaults = ctools_export_crud_load_all('panelizer_defaults');
|
||||
foreach ($panelizer_defaults as $panelizer_default) {
|
||||
$displays['exported-' . $panelizer_default->display->uuid] = $panelizer_default->display;
|
||||
}
|
||||
}
|
||||
return $displays;
|
||||
}
|
||||
@@ -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
|
||||
@@ -77,7 +79,10 @@ function template_preprocess_panels_add_content_link(&$vars) {
|
||||
$vars['description'] = isset($vars['content_type']['description']) ? $vars['content_type']['description'] : $vars['title'];
|
||||
$vars['icon'] = ctools_content_admin_icon($vars['content_type']);
|
||||
$vars['url'] = $vars['renderer']->get_url('add-pane', $vars['region'], $vars['content_type']['type_name'], $vars['content_type']['subtype_name']);
|
||||
|
||||
$vars['image_button'] = ctools_ajax_image_button($vars['icon'], $vars['url'], $vars['description'], 'panels-modal-add-config');
|
||||
$vars['text_button'] = ctools_ajax_text_button($vars['title'], $vars['url'], $vars['description'], 'panels-modal-add-config');
|
||||
$subtype_class = 'add-content-link-' . str_replace('_', '-', $vars['content_type']['subtype_name']);
|
||||
$vars['image_button'] = ctools_ajax_image_button($vars['icon'], $vars['url'], $vars['description'], $subtype_class . '-image-button panels-modal-add-config');
|
||||
$vars['text_button'] = ctools_ajax_text_button($vars['title'], $vars['url'], $vars['description'], $subtype_class . '-text-button panels-modal-add-config');
|
||||
if (function_exists('ctools_ajax_icon_text_button')) {
|
||||
$vars['icon_text_button'] = ctools_ajax_icon_text_button($vars['title'], $vars['icon'], $vars['url'], $vars['description'], $subtype_class . '-icon-text-button panels-modal-add-config');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* @file callbacks.inc
|
||||
* @file Callbacks.inc
|
||||
* Minor menu callbacks for Panels helpers.
|
||||
*/
|
||||
|
||||
@@ -46,7 +46,7 @@ function panels_panels_dashboard_blocks(&$vars) {
|
||||
'description' => t('Custom layouts can add more, site-specific layouts that you can use in your panels.'),
|
||||
);
|
||||
|
||||
// Load all mini panels and their displays.
|
||||
// Load all mini panels and their displays.
|
||||
ctools_include('export');
|
||||
$items = ctools_export_crud_load_all('panels_layout');
|
||||
$count = 0;
|
||||
@@ -97,7 +97,7 @@ function template_preprocess_panels_dashboard(&$vars) {
|
||||
$function($vars);
|
||||
}
|
||||
|
||||
// Add in any default links for modules that are not active
|
||||
// Add in any default links for modules that are not active.
|
||||
panels_dashboard_final_blocks($vars);
|
||||
|
||||
// If page manager module is enabled, add a very low eight block to
|
||||
@@ -138,7 +138,7 @@ function template_preprocess_panels_dashboard(&$vars) {
|
||||
'class' => 'dashboard-create',
|
||||
);
|
||||
|
||||
// Turn the links into a block
|
||||
// Turn the links into a block.
|
||||
foreach ($vars['links'] as $link) {
|
||||
$vars['blocks']['links']['content'] .= theme('panels_dashboard_link', array('link' => $link));
|
||||
}
|
||||
@@ -148,7 +148,7 @@ function template_preprocess_panels_dashboard(&$vars) {
|
||||
$vars['left'] = '';
|
||||
$vars['right'] = '';
|
||||
|
||||
// Render all the blocks
|
||||
// Render all the blocks.
|
||||
foreach ($vars['blocks'] as $block) {
|
||||
$section = !empty($block['section']) ? $block['section'] : 'left';
|
||||
$vars[$section] .= theme('panels_dashboard_block', array('block' => $block));
|
||||
@@ -172,6 +172,22 @@ function panels_admin_settings_page() {
|
||||
}
|
||||
}
|
||||
|
||||
ctools_include('plugins', 'panels');
|
||||
$pipelines = panels_get_renderer_pipelines();
|
||||
$options = array();
|
||||
foreach ($pipelines as $key => $value) {
|
||||
$options[$key] = $value->admin_title;
|
||||
}
|
||||
if (count($options) > 1) {
|
||||
$form['panels_renderer_default'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Default renderer'),
|
||||
'#options' => $options,
|
||||
'#default_value' => variable_get('panels_renderer_default', 'standard'),
|
||||
'#description' => t('The default renderer for new panel pages.'),
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($form)) {
|
||||
return array('#value' => t('There are currently no settings to change, but additional plugins or modules may provide them in the future.'));
|
||||
}
|
||||
@@ -186,4 +202,3 @@ function panels_admin_panel_context_page() {
|
||||
ctools_include('common', 'panels');
|
||||
return drupal_get_form('panels_common_settings', 'panels_page');
|
||||
}
|
||||
|
||||
|
||||
@@ -39,12 +39,11 @@
|
||||
*
|
||||
* @see panels_edit_layout()
|
||||
* @see _panels_edit_layout()
|
||||
*
|
||||
*/
|
||||
class panels_allowed_layouts {
|
||||
|
||||
/**
|
||||
* Specifies whether newly-added layouts (as in, new .inc files) should be automatically
|
||||
* Specifies whether newly-added layouts (as in, new .inc files) should be automatically
|
||||
* allowed (TRUE) or disallowed (FALSE) for $this. Defaults to TRUE, which is more
|
||||
* permissive but less of an administrative hassle if/when you add new layouts. Note
|
||||
* that this parameter will be derived from $allowed_layouts if a value is passed in.
|
||||
@@ -52,19 +51,20 @@ class panels_allowed_layouts {
|
||||
var $allow_new = TRUE;
|
||||
|
||||
/**
|
||||
* Optional member. If provided, the Panels API will generate a drupal variable using
|
||||
* Optional member. If provided, the Panels API will generate a drupal variable using
|
||||
* variable_set($module_name . 'allowed_layouts', serialize($this)), thereby handling the
|
||||
* storage of this object entirely within the Panels API. This object will be
|
||||
* called and rebuilt by panels_edit_layout() if the same $module_name string is passed in
|
||||
* for the $allowed_types parameter. \n
|
||||
* This is primarily intended for convenience - client modules doing heavy-duty implementations
|
||||
* of the Panels API will probably want to create their own storage method.
|
||||
*
|
||||
* @see panels_edit_layout()
|
||||
*/
|
||||
var $module_name = NULL;
|
||||
|
||||
/**
|
||||
* An associative array of all available layouts, keyed by layout name (as defined
|
||||
* An associative array of all available layouts, keyed by layout name (as defined
|
||||
* in the corresponding layout plugin definition), with value = 1 if the layout is
|
||||
* allowed, and value = 0 if the layout is not allowed.
|
||||
* Calling array_filter(panels_allowed_layouts::$allowed_layout_settings) will return an associative array
|
||||
@@ -82,15 +82,14 @@ class panels_allowed_layouts {
|
||||
|
||||
/**
|
||||
* Constructor function; loads the $allowed_layout_settings array with initial values according
|
||||
* to $start_allowed
|
||||
* to $start_allowed.
|
||||
*
|
||||
* @param bool $start_allowed
|
||||
* $start_allowed determines whether all available layouts will be marked
|
||||
* as allowed or not allowed on the initial call to panels_allowed_layouts::set_allowed()
|
||||
*
|
||||
* $start_allowed determines whether all available layouts will be marked
|
||||
* as allowed or not allowed on the initial call to panels_allowed_layouts::set_allowed()
|
||||
*/
|
||||
function panels_allowed_layouts($start_allowed = TRUE) {
|
||||
// TODO would be nice if there was a way to just fetch the names easily
|
||||
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;
|
||||
}
|
||||
@@ -121,6 +120,7 @@ class panels_allowed_layouts {
|
||||
* drupal_goto('</path/to/desired/redirect>');
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @endcode \n
|
||||
*
|
||||
* If $allowed_layouts->form_state == 'failed-validate' || 'render', then you'll need to return
|
||||
@@ -135,8 +135,8 @@ class panels_allowed_layouts {
|
||||
* you to control where the user ends up next.
|
||||
*
|
||||
* @param string $title
|
||||
* Used to set the title of the allowed layouts form. If no value is given, defaults to
|
||||
* 'Panels: Allowed Layouts'.
|
||||
* Used to set the title of the allowed layouts form. If no value is given, defaults to
|
||||
* 'Panels: Allowed Layouts'.
|
||||
*
|
||||
* @return mixed $result
|
||||
* - On the first passthrough when the form is being rendered, $result is the form's structured
|
||||
@@ -147,11 +147,11 @@ class panels_allowed_layouts {
|
||||
function set_allowed($title = 'Panels: Allowed Layouts') {
|
||||
$this->sync_with_available();
|
||||
$form_id = 'panels_common_set_allowed_layouts';
|
||||
// TODO switch to drupal_build_form(); need to pass by ref
|
||||
// TODO switch to drupal_build_form(); need to pass by ref.
|
||||
$form = drupal_retrieve_form($form_id, $this, $title);
|
||||
|
||||
if ($result = drupal_process_form($form_id, $form)) {
|
||||
// successful submit
|
||||
// Successful submit.
|
||||
$this->form_state = 'submit';
|
||||
return $result;
|
||||
}
|
||||
@@ -192,7 +192,6 @@ class panels_allowed_layouts {
|
||||
* If you don't serialize the second parameter of variable_get() and the variable name you provide
|
||||
* can't be found, an E_STRICT warning will be generated for trying to unserialize an entity
|
||||
* that has not been serialized.
|
||||
*
|
||||
*/
|
||||
function save() {
|
||||
if (!is_null($this->module_name)) {
|
||||
@@ -217,6 +216,7 @@ class panels_allowed_layouts {
|
||||
}
|
||||
return $layouts;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,7 +292,7 @@ function panels_common_settings($form, &$form_state, $module_name = 'panels_comm
|
||||
'#tree' => TRUE,
|
||||
);
|
||||
|
||||
// cheat a bit
|
||||
// Cheat a bit.
|
||||
$content_types['other'] = array('title' => t('Other'), 'weight' => 10);
|
||||
foreach ($content_types as $id => $info) {
|
||||
if (isset($allowed[$id])) {
|
||||
@@ -338,25 +338,35 @@ function panels_common_settings($form, &$form_state, $module_name = 'panels_comm
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit hook for panels_common_settings
|
||||
* Submit hook for panels_common_settings.
|
||||
*/
|
||||
function panels_common_settings_validate($form, &$form_state) {
|
||||
panels_common_allowed_layouts_form_validate($form, $form_state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit hook for panels_common_settings
|
||||
* Submit hook for panels_common_settings.
|
||||
*/
|
||||
function panels_common_settings_submit($form, &$form_state) {
|
||||
panels_common_allowed_layouts_form_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']);
|
||||
$values = $form_state['values']['content_types'][$allowed]['options'];
|
||||
// If new content of the type is not added, storing a lisy of disabled
|
||||
// content is not needed.
|
||||
if (!$form_state['values']['panels_common_default'][$allowed]) {
|
||||
$values = array_filter($values);
|
||||
}
|
||||
$allowed_content_types = array_merge($allowed_content_types, $values);
|
||||
}
|
||||
// Values from checkboxes are the same string as they key, but we only need
|
||||
// to store the boolean value.
|
||||
foreach ($allowed_content_types as &$value) {
|
||||
$value = (bool) $value;
|
||||
}
|
||||
variable_set($module_name . '_allowed_types', $allowed_content_types);
|
||||
}
|
||||
@@ -367,8 +377,7 @@ function panels_common_settings_submit($form, &$form_state) {
|
||||
* Based upon the settings, get the allowed types for this node.
|
||||
*/
|
||||
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
|
||||
|
||||
// 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);
|
||||
|
||||
@@ -402,8 +411,8 @@ function panels_common_get_allowed_types($module, $contexts = array(), $has_cont
|
||||
* @ingroup forms
|
||||
*
|
||||
* @param array $allowed_layouts
|
||||
* The set of allowed layouts that should be used as the default values
|
||||
* for this form. If none is provided, then by default no layouts will be restricted.
|
||||
* The set of allowed layouts that should be used as the default values
|
||||
* for this form. If none is provided, then by default no layouts will be restricted.
|
||||
*/
|
||||
function panels_common_allowed_layouts_form(&$form, &$form_state, $module_name) {
|
||||
// Fetch our allowed layouts from variables.
|
||||
@@ -416,6 +425,7 @@ function panels_common_allowed_layouts_form(&$form, &$form_state, $module_name)
|
||||
|
||||
$form_state['allowed_layouts'] = &$allowed_layouts;
|
||||
|
||||
ctools_add_js('panels-base', 'panels');
|
||||
ctools_add_js('layout', 'panels');
|
||||
|
||||
$form['layout_selection'] = array(
|
||||
@@ -457,17 +467,17 @@ function panels_common_allowed_layouts_form_submit($form, &$form_state) {
|
||||
function panels_common_get_allowed_layout_object($module_name) {
|
||||
$allowed_layouts = unserialize(variable_get($module_name . "_allowed_layouts", serialize('')));
|
||||
|
||||
// if no parameter was provided, or the variable_get failed
|
||||
// If no parameter was provided, or the variable_get failed.
|
||||
if (!$allowed_layouts) {
|
||||
// still no dice. simply creates a dummy version where all layouts
|
||||
// Still no dice. simply creates a dummy version where all layouts
|
||||
// are allowed.
|
||||
$allowed_layouts = new panels_allowed_layouts();
|
||||
$allowed_layouts->allow_new = TRUE;
|
||||
$allowed_layouts->module_name = $module_name;
|
||||
}
|
||||
|
||||
// sanitize allowed layout listing; this is redundant if the
|
||||
// $allowed_layouts param was null, but the data is cached anyway
|
||||
// Sanitize allowed layout listing; this is redundant if the
|
||||
// $allowed_layouts param was null, but the data is cached anyway.
|
||||
$allowed_layouts->sync_with_available();
|
||||
|
||||
return $allowed_layouts;
|
||||
@@ -477,11 +487,12 @@ function panels_common_get_allowed_layout_object($module_name) {
|
||||
* Get the allowed layouts for the given module.
|
||||
*/
|
||||
function panels_common_get_allowed_layouts($module_name) {
|
||||
ctools_include('plugins', 'panels');
|
||||
$available_layouts = panels_get_layouts();
|
||||
if (empty($module_name)) {
|
||||
return $available_layouts;
|
||||
}
|
||||
else if (is_object($module_name)) {
|
||||
elseif (is_object($module_name)) {
|
||||
$allowed_layouts = $module_name;
|
||||
}
|
||||
else {
|
||||
@@ -496,7 +507,7 @@ function panels_common_get_allowed_layouts($module_name) {
|
||||
}
|
||||
}
|
||||
|
||||
// Sort
|
||||
// Sort.
|
||||
$layouts = array();
|
||||
|
||||
asort($order);
|
||||
@@ -584,7 +595,6 @@ function panels_common_print_layout_links($layouts, $base_path, $link_options =
|
||||
// We're doing these dependencies completely manualy, which is unusual, but
|
||||
// the process code only supports doing them in a form.
|
||||
// @todo modify dependent.inc to make this easier.
|
||||
|
||||
$dependencies = array();
|
||||
foreach ($options as $category => $links) {
|
||||
$dependencies['panels-layout-category-' . $category] = array(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
/**
|
||||
* @file
|
||||
* Core Panels API include file containing various display-editing functions.
|
||||
* This includes all the basic editing forms (content, layout, layout settings)
|
||||
@@ -40,7 +40,7 @@ function _panels_edit($display, $destination, $content_types, $title = FALSE) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Form definition for the panels display editor
|
||||
* Form definition for the panels display editor.
|
||||
*
|
||||
* No validation function is necessary, as all 'validation' is handled
|
||||
* either in the lead-up to form rendering (through the selection of
|
||||
@@ -48,6 +48,7 @@ function _panels_edit($display, $destination, $content_types, $title = FALSE) {
|
||||
* the ajax modals & content types.
|
||||
*
|
||||
* @ingroup forms
|
||||
*
|
||||
* @see panels_edit_display_submit()
|
||||
*/
|
||||
function panels_edit_display_form($form, &$form_state) {
|
||||
@@ -157,7 +158,7 @@ function panels_edit_display_form_submit($form, &$form_state) {
|
||||
$display->panels[$region_id] = array();
|
||||
if ($panes) {
|
||||
$pids = explode(',', $panes);
|
||||
// need to filter the array, b/c passing it in a hidden field can generate trash
|
||||
// Need to filter the array, b/c passing it in a hidden field can generate trash.
|
||||
foreach (array_filter($pids) as $pid) {
|
||||
if ($old_content[$pid]) {
|
||||
$display->panels[$region_id][] = $pid;
|
||||
@@ -221,7 +222,7 @@ function panels_edit_display_settings_form($form, &$form_state) {
|
||||
ctools_include('dependent');
|
||||
|
||||
if ($form_state['display_title']) {
|
||||
$form['display_title'] = array (
|
||||
$form['display_title'] = array(
|
||||
'#tree' => TRUE,
|
||||
);
|
||||
|
||||
@@ -240,7 +241,7 @@ function panels_edit_display_settings_form($form, &$form_state) {
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => $display->title,
|
||||
'#title' => t('Title'),
|
||||
'#description' => t('The title of this panel. If left blank, a default title may be used. Set to No Title if you want the title to actually be blank.'),
|
||||
'#description' => t('The title of this panel. If left blank, a default title may be used. If you want the title actually to be blank, change the "Title type" dropdown from "Manually Set" to "No Title".'),
|
||||
'#process' => array('ctools_dependent_process'),
|
||||
'#dependency' => array('edit-display-title-hide-title' => array(PANELS_TITLE_FIXED)),
|
||||
'#maxlength' => 255,
|
||||
@@ -252,16 +253,15 @@ function panels_edit_display_settings_form($form, &$form_state) {
|
||||
// We have to create a manual fieldset because fieldsets do not support IDs.
|
||||
// Use 'hidden' instead of 'markup' so that the process will run.
|
||||
// Add js for collapsible fieldsets manually
|
||||
// drupal_add_js('misc/form.js');
|
||||
// drupal_add_js('misc/collapse.js');
|
||||
// $form['display_title']['contexts_prefix'] = array(
|
||||
// '#type' => 'hidden',
|
||||
// '#id' => 'edit-display-substitutions',
|
||||
// '#prefix' => '<div><fieldset id="edit-display-substitutions" class="collapsed collapsible"><legend>' . t('Substitutions') . '</legend><div class="fieldset-wrapper">',
|
||||
// '#process' => array('ctools_dependent_process'),
|
||||
// '#dependency' => array('edit-display-title-hide-title' => array(PANELS_TITLE_FIXED)),
|
||||
// );
|
||||
|
||||
// drupal_add_js('misc/form.js');
|
||||
// drupal_add_js('misc/collapse.js');
|
||||
// $form['display_title']['contexts_prefix'] = array(
|
||||
// '#type' => 'hidden',
|
||||
// '#id' => 'edit-display-substitutions',
|
||||
// '#prefix' => '<div><fieldset id="edit-display-substitutions" class="collapsed collapsible"><legend>' . t('Substitutions') . '</legend><div class="fieldset-wrapper">',
|
||||
// '#process' => array('ctools_dependent_process'),
|
||||
// '#dependency' => array('edit-display-title-hide-title' => array(PANELS_TITLE_FIXED)),
|
||||
// );
|
||||
$rows = array();
|
||||
foreach ($display->context as $context) {
|
||||
foreach (ctools_context_get_converters('%' . check_plain($context->keyword) . ':', $context) as $keyword => $title) {
|
||||
@@ -279,17 +279,15 @@ function panels_edit_display_settings_form($form, &$form_state) {
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
'#value' => theme('table', array('header' => $header, 'rows' => $rows)),
|
||||
// '#process' => array('form_process_fieldset', 'ctools_dependent_process'),
|
||||
// '#id' => 'edit-display-title-context',
|
||||
// '#dependency' => array('edit-display-title-hide-title' => array(PANELS_TITLE_FIXED)),
|
||||
// '#process' => array('form_process_fieldset', 'ctools_dependent_process'), // '#id' => 'edit-display-title-context',
|
||||
// '#dependency' => array('edit-display-title-hide-title' => array(PANELS_TITLE_FIXED)),
|
||||
);
|
||||
// $form['display_title']['contexts_suffix'] = array(
|
||||
// '#value' => '</div></fieldset></div>',
|
||||
// );
|
||||
// $form['display_title']['contexts_suffix'] = array( // '#value' => '</div></fieldset></div>',
|
||||
// );.
|
||||
}
|
||||
}
|
||||
|
||||
// TODO doc the ability to do this as part of the API
|
||||
// TODO doc the ability to do this as part of the API.
|
||||
if (!empty($layout['settings form']) && function_exists($layout['settings form'])) {
|
||||
$form['layout_settings'] = $layout['settings form']($display, $layout, $display->layout_settings);
|
||||
}
|
||||
@@ -302,7 +300,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 +310,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Handle the forms for changing a display's layout.
|
||||
*/
|
||||
|
||||
@@ -33,7 +32,7 @@ function _panels_edit_layout($display, $finish, $destination, $allowed_layouts)
|
||||
if (empty($_POST) || empty($_POST['form_id']) || $_POST['form_id'] != 'panels_change_layout') {
|
||||
$output = drupal_build_form('panels_choose_layout', $form_state);
|
||||
if (!empty($form_state['executed'])) {
|
||||
// upon submission go to next form.
|
||||
// Upon submission go to next form.
|
||||
$change_form_state['layout'] = $_SESSION['layout'][$display->did] = $form_state['layout'];
|
||||
$change_form = TRUE;
|
||||
}
|
||||
@@ -94,6 +93,7 @@ function panels_choose_layout($form, &$form_state) {
|
||||
}
|
||||
}
|
||||
|
||||
ctools_add_js('panels-base', 'panels');
|
||||
ctools_add_js('layout', 'panels');
|
||||
|
||||
$form['categories'] = array(
|
||||
@@ -146,7 +146,6 @@ function panels_choose_layout($form, &$form_state) {
|
||||
$js['CTools']['dependent'] = $dependencies;
|
||||
drupal_add_js($js, 'setting');
|
||||
|
||||
|
||||
if (empty($form_state['no buttons'])) {
|
||||
$form['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
@@ -292,7 +291,7 @@ function panels_change_layout_submit($form, &$form_state) {
|
||||
foreach ($form_state['values']['panel']['pane'] as $region_id => $panes) {
|
||||
if ($panes) {
|
||||
$pids = explode(',', $panes);
|
||||
// need to filter the array, b/c passing it in a hidden field can generate trash
|
||||
// Need to filter the array, b/c passing it in a hidden field can generate trash.
|
||||
foreach (array_filter($pids) as $pid) {
|
||||
$switch[$pid] = $region_id;
|
||||
}
|
||||
@@ -320,6 +319,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,22 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Legacy state manager for Panels.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Legacy state manager for Panels.
|
||||
*
|
||||
* Checks all possible ways (using discovery of patterned method names) in which
|
||||
* Panels may need to operate in legacy mode,
|
||||
* sets variables as appropriate, and returns an informational
|
||||
*
|
||||
* sets variables as appropriate, and returns an informational.
|
||||
*/
|
||||
class PanelsLegacyState {
|
||||
var $legacy = NULL;
|
||||
|
||||
/**
|
||||
* Translation wrapper.
|
||||
*/
|
||||
function t() {
|
||||
$func = get_t();
|
||||
$args = func_get_args();
|
||||
return call_user_func_array($func, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Status.
|
||||
*/
|
||||
function getStatus() {
|
||||
if (!isset($this->legacy)) {
|
||||
$this->determineStatus();
|
||||
@@ -29,7 +39,7 @@ class PanelsLegacyState {
|
||||
*/
|
||||
function determineStatus() {
|
||||
$this->legacy = array();
|
||||
foreach(get_class_methods($this) as $method) {
|
||||
foreach (get_class_methods($this) as $method) {
|
||||
if (strtolower(substr($method, 0, 5)) == 'check') {
|
||||
$this->legacy[$method] = $this->$method();
|
||||
}
|
||||
@@ -37,5 +47,4 @@ class PanelsLegacyState {
|
||||
$this->legacy = array_filter($this->legacy);
|
||||
}
|
||||
|
||||
// At this time there are no legacy checks.
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ function panels_page_wizard_add_layout(&$form, &$form_state) {
|
||||
'#value' => '</fieldset>',
|
||||
);
|
||||
|
||||
// $form_state['cache'] = FALSE;
|
||||
// $form_state['cache'] = FALSE;.
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,6 @@ function panels_page_wizard_add_content(&$form, &$form_state) {
|
||||
|
||||
// Panels provides this caching mechanism to make it easy to use the
|
||||
// wizard to cache the display.
|
||||
|
||||
$cache = panels_edit_cache_get('panels_page_wizard:' . $form_state['plugin']['name']);
|
||||
|
||||
$form_state['renderer'] = panels_get_renderer_handler('editor', $cache->display);
|
||||
@@ -68,14 +67,14 @@ function panels_page_wizard_add_content(&$form, &$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add content form submit handler
|
||||
* Add content form submit handler.
|
||||
*
|
||||
* This is not a proper submit handler, it is meant to be called by a form's
|
||||
* submit handler to handle submission.
|
||||
*/
|
||||
function panels_page_wizard_add_content_submit(&$form, &$form_state) {
|
||||
// Call the normal panels edit form submit to make sure values are stored
|
||||
// on the display
|
||||
// on the display.
|
||||
panels_edit_display_form_submit($form, $form_state);
|
||||
$cache = &$form_state['wizard cache'];
|
||||
|
||||
@@ -83,4 +82,3 @@ function panels_page_wizard_add_content_submit(&$form, &$form_state) {
|
||||
$cache->display = &$form_state['display'];
|
||||
unset($cache->display_cache);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
function panels_default_panels_renderer_pipeline() {
|
||||
$pipelines = array();
|
||||
|
||||
$pipeline = new stdClass;
|
||||
$pipeline = new stdClass();
|
||||
$pipeline->disabled = FALSE; /* Edit this to true to make a default pipeline disabled initially */
|
||||
$pipeline->api_version = 1;
|
||||
$pipeline->name = 'standard';
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Contains helper code for plugins and contexts.
|
||||
*/
|
||||
|
||||
@@ -41,7 +40,7 @@ function panels_get_regions($layout, $display) {
|
||||
* The cached content, or FALSE to indicate no cached content exists.
|
||||
*/
|
||||
function panels_get_cached_content($display, $args, $context, $pane = NULL) {
|
||||
// Never use cache on a POST
|
||||
// Never use cache on a POST.
|
||||
if (!empty($_POST)) {
|
||||
return FALSE;
|
||||
}
|
||||
@@ -59,7 +58,7 @@ function panels_get_cached_content($display, $args, $context, $pane = NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// restore it.
|
||||
// Restore it.
|
||||
$cache->restore();
|
||||
return $cache;
|
||||
}
|
||||
@@ -68,7 +67,7 @@ function panels_get_cached_content($display, $args, $context, $pane = NULL) {
|
||||
* Store cached content for a given display and possibly pane.
|
||||
*/
|
||||
function panels_set_cached_content($cache, $display, $args, $context, $pane = NULL) {
|
||||
// Never use cache on a POST
|
||||
// Never use cache on a POST.
|
||||
if (!empty($_POST)) {
|
||||
return FALSE;
|
||||
}
|
||||
@@ -82,7 +81,7 @@ function panels_set_cached_content($cache, $display, $args, $context, $pane = NU
|
||||
|
||||
$conf = $pane ? $pane->cache['settings'] : $display->cache['settings'];
|
||||
|
||||
// snapshot it.
|
||||
// Snapshot it.
|
||||
$cache->cache();
|
||||
return $function($conf, $cache, $display, $args, $context, $pane);
|
||||
}
|
||||
@@ -125,7 +124,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();
|
||||
@@ -154,7 +153,7 @@ class panels_cache_object {
|
||||
|
||||
$this->ready = TRUE;
|
||||
|
||||
// Simple replacement for head
|
||||
// Simple replacement for head.
|
||||
$this->head = str_replace($this->head, '', drupal_add_html_head());
|
||||
|
||||
// Slightly less simple for CSS:
|
||||
@@ -173,15 +172,36 @@ class panels_cache_object {
|
||||
$start = $this->js;
|
||||
$this->js = array();
|
||||
|
||||
// Use the advanced mapping function from Drupal >= 7.23 if available.
|
||||
$array_mapping_func = function_exists('drupal_array_diff_assoc_recursive') ? 'drupal_array_diff_assoc_recursive' : 'array_diff_assoc';
|
||||
|
||||
// If there are any differences between the old and the new javascript then
|
||||
// store them to be added later.
|
||||
if ($diff = array_diff_assoc($js, $start)) {
|
||||
$this->js = $diff;
|
||||
}
|
||||
|
||||
// Special case the settings key and get the difference of the data.
|
||||
if ($settings_diff = array_diff_assoc($js['settings']['data'], $start['settings']['data'])) {
|
||||
$this->js['settings'] = $settings_diff;
|
||||
if ($diff = $array_mapping_func($js, $start)) {
|
||||
// Iterate over the diff to ensure we keep the keys on merge and don't add
|
||||
// unnecessary items.
|
||||
foreach ($diff as $key => $diff_data) {
|
||||
// Special case the settings key and get the difference of the data.
|
||||
if ($key === 'settings') {
|
||||
// Iterate over the diff to ensure we keep the keys on merge and don't
|
||||
// add unnecessary items.
|
||||
if (isset($diff[$key]['data'])) {
|
||||
foreach ($diff[$key]['data'] as $settings_key => $settings_data) {
|
||||
// Merge the changes with the base to get a complete settings
|
||||
// array.
|
||||
$this->js[$key]['data'][] = drupal_array_merge_deep($settings_data, $diff[$key]['data'][$settings_key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->js[$key] = $diff_data;
|
||||
// Check if the key was present already and if so merge the changes
|
||||
// with the original data to get the full settings array.
|
||||
if (isset($start[$key])) {
|
||||
$this->js[$key] = drupal_array_merge_deep($start[$key], $this->js[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// And for tokens:
|
||||
@@ -213,7 +233,7 @@ class panels_cache_object {
|
||||
drupal_add_js($args['data'], $args);
|
||||
}
|
||||
else {
|
||||
foreach ($args as $setting) {
|
||||
foreach ($args['data'] as $setting) {
|
||||
drupal_add_js($setting, 'setting');
|
||||
}
|
||||
}
|
||||
@@ -227,6 +247,7 @@ class panels_cache_object {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -391,7 +412,7 @@ function panels_get_renderer_handler($plugin, &$display) {
|
||||
* Choose a renderer for a display based on a render pipeline setting.
|
||||
*/
|
||||
function panels_get_renderer($pipeline_name, &$display) {
|
||||
// Load the pipeline
|
||||
// Load the pipeline.
|
||||
ctools_include('export');
|
||||
$pipeline = ctools_export_crud_load('panels_renderer_pipeline', $pipeline_name);
|
||||
|
||||
@@ -422,7 +443,7 @@ function panels_get_renderer($pipeline_name, &$display) {
|
||||
return $renderer;
|
||||
}
|
||||
|
||||
// Fall through. If no renderer is selected, use the standard renderer
|
||||
// Fall through. If no renderer is selected, use the standard renderer.
|
||||
return panels_get_renderer_handler('standard', $display);
|
||||
}
|
||||
|
||||
@@ -433,9 +454,9 @@ function panels_get_renderer($pipeline_name, &$display) {
|
||||
*/
|
||||
function _panels_renderer_pipeline_sort($a, $b) {
|
||||
if ($a->weight == $b->weight) {
|
||||
if ($a->admin_title == $b->admin_title) {
|
||||
return 0;
|
||||
}
|
||||
if ($a->admin_title == $b->admin_title) {
|
||||
return 0;
|
||||
}
|
||||
return ($a->admin_title < $b->admin_title) ? -1 : 1;
|
||||
}
|
||||
return ($a->weight < $b->weight) ? -1 : 1;
|
||||
@@ -457,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.
|
||||
*
|
||||
|
||||
@@ -16,7 +16,7 @@ Drupal.Panels.bindClickDelete = function(context) {
|
||||
$('a.pane-delete:not(.pane-delete-processed)', context)
|
||||
.addClass('pane-delete-processed')
|
||||
.click(function() {
|
||||
if (confirm('Remove this pane?')) {
|
||||
if (confirm(Drupal.t('Remove this pane?'))) {
|
||||
var id = '#' + $(this).attr('id').replace('pane-delete-', '');
|
||||
$(id).remove();
|
||||
Drupal.Panels.Draggable.savePositions();
|
||||
@@ -80,7 +80,7 @@ Drupal.Panels.Draggable = {
|
||||
regionId: 'panel-region-',
|
||||
|
||||
// What to add to the front of a the id to get the form id for a panel
|
||||
formId: 'input#edit-',
|
||||
formId: '#edit-',
|
||||
|
||||
maxWidth: 250,
|
||||
|
||||
@@ -492,8 +492,8 @@ Drupal.behaviors.PanelsDisplayEditor = {
|
||||
Drupal.Panels.Draggable.savePositions();
|
||||
|
||||
// Bind buttons.
|
||||
$('input#panels-hide-all', context).click(Drupal.Panels.clickHideAll);
|
||||
$('input#panels-show-all', context).click(Drupal.Panels.clickShowAll);
|
||||
$('#panels-hide-all', context).click(Drupal.Panels.clickHideAll);
|
||||
$('#panels-show-all', context).click(Drupal.Panels.clickShowAll);
|
||||
|
||||
Drupal.Panels.bindClickDelete(context);
|
||||
|
||||
@@ -513,6 +513,11 @@ Drupal.behaviors.PanelsDisplayEditor = {
|
||||
$('#panels-preview').html(html);
|
||||
});
|
||||
|
||||
// Bind modal detach behaviors to cancel current form.
|
||||
$(document).bind('CToolsDetachBehaviors', function(event, context) {
|
||||
$('#edit-cancel-style', context).trigger('click');
|
||||
});
|
||||
|
||||
var setTitleClass = function () {
|
||||
if ($('#edit-display-title-hide-title').val() == 2) {
|
||||
$('#panels-dnd-main').removeClass('panels-set-title-hide');
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
|
||||
(function ($) {
|
||||
Drupal.Panels = Drupal.Panels || {};
|
||||
|
||||
Drupal.Panels.autoAttach = function() {
|
||||
if ($.browser.msie) {
|
||||
// If IE, attach a hover event so we can see our admin links.
|
||||
$("div.panel-pane").hover(
|
||||
function() {
|
||||
$('div.panel-hide', this).addClass("panel-hide-hover"); return true;
|
||||
},
|
||||
function() {
|
||||
$('div.panel-hide', this).removeClass("panel-hide-hover"); return true;
|
||||
}
|
||||
);
|
||||
$("div.admin-links").hover(
|
||||
function() {
|
||||
$(this).addClass("admin-links-hover"); return true;
|
||||
},
|
||||
function(){
|
||||
$(this).removeClass("admin-links-hover"); return true;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
$(Drupal.Panels.autoAttach);
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Hooks provided by Panels.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allow modules to provide their own caching mechanism for the display editor.
|
||||
*
|
||||
* @param string $argument
|
||||
* The second half of the cache key. Full key module:TASK_NAME:HANDLER_NAME
|
||||
* passed part: TASK_NAME:HANDLER_NAME
|
||||
* @param object $cache
|
||||
* The display to cache.
|
||||
*/
|
||||
function hook_panels_cache_set($argument, $cache) {
|
||||
list($handler, $item) = _panels_mini_panels_cache_get($argument);
|
||||
$item->mini_panels_display_cache = $cache;
|
||||
$handler->edit_cache_set_key($item, $argument);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow modules to provide their own caching mechanism for the display editor.
|
||||
*
|
||||
* @param string $argument
|
||||
* The second half of the cache key. Full key module:TASK_NAME:HANDLER_NAME
|
||||
* passed part: TASK_NAME:HANDLER_NAME
|
||||
*
|
||||
* @return stdClass|NULL
|
||||
* The cached display or NULL if the cache wasn't hit.
|
||||
*/
|
||||
function hook_panels_cache_get($argument) {
|
||||
ctools_include('common', 'panels');
|
||||
list($handler, $item) = _panels_mini_panels_cache_get($argument);
|
||||
if (isset($item->mini_panels_display_cache)) {
|
||||
return $item->mini_panels_display_cache;
|
||||
}
|
||||
|
||||
$cache = new stdClass();
|
||||
$cache->display = $item->display;
|
||||
$cache->display->context = ctools_context_load_contexts($item);
|
||||
$cache->display->cache_key = 'panels_mini:' . $argument;
|
||||
$cache->content_types = panels_common_get_allowed_types('panels_mini', $cache->display->context);
|
||||
$cache->display_title = TRUE;
|
||||
|
||||
// @TODO support locking.
|
||||
$cache->locked = FALSE;
|
||||
|
||||
return $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow modules to provide their own caching mechanism for the display editor.
|
||||
*
|
||||
* @param string $argument
|
||||
* The second half of the cache key. Full key module:TASK_NAME:HANDLER_NAME
|
||||
* passed part: TASK_NAME:HANDLER_NAME
|
||||
* @param object $cache
|
||||
* The display to cache.
|
||||
*
|
||||
* @return stdClass
|
||||
* The cached display.
|
||||
*/
|
||||
function hook_panels_cache_save($argument, $cache) {
|
||||
list($handler, $item) = _panels_mini_panels_cache_get($argument);
|
||||
$item->display = $cache->display;
|
||||
panels_mini_save($item);
|
||||
|
||||
$handler->edit_cache_clear($item);
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow modules to provide their own caching mechanism for the display editor.
|
||||
*
|
||||
* @param string $argument
|
||||
* The second half of the cache key. Full key module:TASK_NAME:HANDLER_NAME
|
||||
* passed part: TASK_NAME:HANDLER_NAME
|
||||
* @param object $cache
|
||||
* The cached display.
|
||||
*/
|
||||
function hook_panels_cache_clear($argument, $cache) {
|
||||
list($handler, $item) = _panels_mini_panels_cache_get($argument);
|
||||
$handler->edit_cache_clear($item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow modules to adjust the rendering array of the panels dashboard.
|
||||
*
|
||||
* @param array $vars
|
||||
* The output variables.
|
||||
*/
|
||||
function hook_panels_dashboard_blocks(&$vars) {
|
||||
$vars['links']['panels_node'] = array(
|
||||
'title' => l(t('Panel node'), 'node/add/panel'),
|
||||
'description' => t('Panel nodes are node content and appear in your searches, but are more limited than panel pages.'),
|
||||
'weight' => -1,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow to alter the pane content to render.
|
||||
*
|
||||
* This happens after the keyword substitution.
|
||||
*
|
||||
* @param object $content
|
||||
* The content block to render.
|
||||
* @param object $pane
|
||||
* The pane object.
|
||||
* @param array $args
|
||||
* The display arguments.
|
||||
* @param array $contexts
|
||||
* Array with the used contexts.
|
||||
*/
|
||||
function hook_panels_pane_content_alter($content, $pane, $args, $contexts) {
|
||||
// Don't display titles.
|
||||
unset($content->title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow modules to provide a mechanism to break locks.
|
||||
*
|
||||
* @param string $argument
|
||||
* The second half of the cache key. Full key module:TASK_NAME:HANDLER_NAME
|
||||
* passed part: TASK_NAME:HANDLER_NAME
|
||||
* @param object $cache
|
||||
* The cached display.
|
||||
*/
|
||||
function hook_panels_edit_cache_break_lock($argument, $cache) {
|
||||
$cache->locked = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired before a panels display is rendered.
|
||||
*
|
||||
* Last chance to modify the panels display or add output before the keyword
|
||||
* substitution runs and the panels display is rendered.
|
||||
*
|
||||
* @param panels_display $panels_display
|
||||
* The panels display that will be rendered.
|
||||
* @param object $renderer
|
||||
* The renderer object that will be used to render.
|
||||
*
|
||||
* @return string
|
||||
* Additional output to add before the panels display.
|
||||
*/
|
||||
function hook_panels_pre_render($panels_display, $renderer) {
|
||||
$translation = i18n_string_object_translate('panels_display_configuration', $panels_display);
|
||||
$panels_display->title = $translation->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired after a panels display is rendered.
|
||||
*
|
||||
* Allow to add additional output after the output of the panels display.
|
||||
*
|
||||
* @param panels_display $panels_display
|
||||
* The rendered panels display.
|
||||
* @param object $renderer
|
||||
* The used renderer object.
|
||||
*
|
||||
* @return string
|
||||
* Additional output to add after the panels display.
|
||||
*/
|
||||
function hook_panels_post_render($panels_display, $renderer) {
|
||||
return t('Output proudly sponsored by panels.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired before a new pane is inserted in the storage.
|
||||
*
|
||||
* @param object $pane
|
||||
* Pane that will be rendered.
|
||||
*/
|
||||
function hook_panels_pane_insert($pane) {
|
||||
// Check if this pane has a custom title enabled.
|
||||
if (!empty($pane->configuration['override_title'])) {
|
||||
$translation_object = (object) array(
|
||||
'pid' => $pane->pid,
|
||||
'title' => $pane->configuration['override_title_text'],
|
||||
);
|
||||
$status = i18n_string_object_update('panels_pane_configuration', $translation_object);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired before a changed pane is updated in the storage.
|
||||
*
|
||||
* @param object $pane
|
||||
* Pane that will be rendered.
|
||||
*/
|
||||
function hook_panels_pane_update($pane) {
|
||||
// Check if this pane has a custom title enabled.
|
||||
if (!empty($pane->configuration['override_title'])) {
|
||||
$translation_object = (object) array(
|
||||
'pid' => $pane->pid,
|
||||
'title' => $pane->configuration['override_title_text'],
|
||||
);
|
||||
$status = i18n_string_object_update('panels_pane_configuration', $translation_object);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired before a panel is rendered.
|
||||
*
|
||||
* Last chance to modify the pane before the keyword substitution runs and the
|
||||
* pane is rendered.
|
||||
*
|
||||
* @param object $pane
|
||||
* Pane that will be rendered.
|
||||
*/
|
||||
function hook_panels_pane_prerender($pane) {
|
||||
// Check if this pane has a custom title enabled.
|
||||
if (!empty($pane->configuration['override_title'])) {
|
||||
$translation_object = (object) array(
|
||||
'pid' => $pane->pid,
|
||||
'title' => $pane->configuration['override_title_text'],
|
||||
);
|
||||
$translation_object = i18n_string_object_translate('panels_pane_configuration', $translation_object);
|
||||
$pane->configuration['override_title_text'] = $translation_object->title;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired before panes are deleted.
|
||||
*
|
||||
* @param array $pids
|
||||
* Array with the panel id's to delete.
|
||||
*/
|
||||
function hook_panels_pane_delete($pids) {
|
||||
foreach ($pids as $pid) {
|
||||
// Create dummy pane with pid as property.
|
||||
$pane = (object) array('pid' => $pid);
|
||||
i18n_string_object_remove('panels_pane_configuration', $pane);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired after a display is saved.
|
||||
*
|
||||
* @param panels_display $display
|
||||
* The display to save.
|
||||
*/
|
||||
function hook_panels_display_save($display) {
|
||||
i18n_string_object_update('display_configuration', $display);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired before a display is deleted.
|
||||
*
|
||||
* @param int $did
|
||||
* Id of the display to delete.
|
||||
*/
|
||||
function hook_panels_delete_display($did) {
|
||||
$uuid = db_select('panels_display')
|
||||
->fields('panels_display', array('uuid'))
|
||||
->condition('did', $did)
|
||||
->execute()
|
||||
->fetchColumn();
|
||||
$display = (object) array('uuid' => $uuid);
|
||||
i18n_string_object_remove('display_configuration', $display);
|
||||
}
|
||||
@@ -10,9 +10,16 @@ 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 2012-08-18
|
||||
version = "7.x-3.3"
|
||||
; 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 2020-07-05
|
||||
version = "7.x-3.10"
|
||||
core = "7.x"
|
||||
project = "panels"
|
||||
datestamp = "1345319572"
|
||||
|
||||
datestamp = "1593990788"
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test requirements for installation and running.
|
||||
*/
|
||||
@@ -17,7 +21,7 @@ function panels_requirements_install() {
|
||||
// Assume that if the user is running an installation profile that both
|
||||
// Panels and CTools are the same release.
|
||||
if (!(defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'install')) {
|
||||
// apparently the install process doesn't include .module files,
|
||||
// Apparently the install process doesn't include .module files,
|
||||
// so we need to force the issue in order for our versioning
|
||||
// check to work.
|
||||
if (!defined('PANELS_REQUIRED_CTOOLS_API')) {
|
||||
@@ -30,24 +34,114 @@ function panels_requirements_install() {
|
||||
include_once drupal_get_path('module', 'ctools') . '/ctools.module';
|
||||
}
|
||||
if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
|
||||
$requirements['panels_ctools'] = array(
|
||||
'title' => $t('CTools API Version'),
|
||||
'value' => CTOOLS_API_VERSION,
|
||||
'severity' => REQUIREMENT_ERROR,
|
||||
'description' => t('The CTools API version is too old for Panels. Panels needs at least %version.', array('%version' => PANELS_REQUIRED_CTOOLS_API))
|
||||
);
|
||||
$requirements['panels_ctools'] = array(
|
||||
'title' => $t('CTools API Version'),
|
||||
'value' => CTOOLS_API_VERSION,
|
||||
'severity' => REQUIREMENT_ERROR,
|
||||
'description' => t('The CTools API version is too old for Panels. Panels needs at least %version.', array('%version' => PANELS_REQUIRED_CTOOLS_API)),
|
||||
);
|
||||
}
|
||||
}
|
||||
return $requirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_schema().
|
||||
* Implements of hook_schema().
|
||||
*/
|
||||
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_4();
|
||||
// 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_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() {
|
||||
$schema = panels_schema_5();
|
||||
|
||||
$schema['cache_panels'] = drupal_get_schema_unprocessed('system', 'cache');
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
function panels_schema_5() {
|
||||
$schema = panels_schema_4();
|
||||
|
||||
$schema['panels_display']['fields']['uuid'] = array(
|
||||
'type' => 'char',
|
||||
'length' => '36',
|
||||
);
|
||||
$schema['panels_display']['export']['key'] = 'uuid';
|
||||
$schema['panels_display']['export']['key name'] = 'UUID';
|
||||
|
||||
$schema['panels_pane']['fields']['uuid'] = array(
|
||||
'type' => 'char',
|
||||
'length' => '36',
|
||||
);
|
||||
$schema['panels_pane']['export']['key'] = 'uuid';
|
||||
$schema['panels_pane']['export']['key name'] = 'UUID';
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
function panels_schema_4() {
|
||||
@@ -218,7 +312,7 @@ function panels_schema_3() {
|
||||
),
|
||||
'primary key' => array('pid'),
|
||||
'indexes' => array(
|
||||
'did_idx' => array('did')
|
||||
'did_idx' => array('did'),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -355,9 +449,7 @@ function panels_update_7300() {
|
||||
*/
|
||||
function panels_update_7301() {
|
||||
// Load the schema.
|
||||
|
||||
// Due to a previous failure, the field may already exist:
|
||||
|
||||
$schema = panels_schema_4();
|
||||
$table = 'panels_pane';
|
||||
$field = 'locks';
|
||||
@@ -375,3 +467,214 @@ function panels_update_7301() {
|
||||
|
||||
return t('panels_pane.lock field already existed, update skipped.');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
// Add the uuid column to the pane table.
|
||||
$table = 'panels_pane';
|
||||
$field = 'uuid';
|
||||
// Due to a previous failure, the column may already exist:
|
||||
if (!db_field_exists($table, $field)) {
|
||||
$spec = $schema[$table]['fields'][$field];
|
||||
db_add_field($table, $field, $spec);
|
||||
$msg[] = t('Added panels_pane.uuid column.');
|
||||
}
|
||||
|
||||
// Add the uuid column to the display table.
|
||||
$table = 'panels_display';
|
||||
$field = 'uuid';
|
||||
// Due to a previous failure, the column may already exist:
|
||||
if (!db_field_exists($table, $field)) {
|
||||
$spec = $schema[$table]['fields'][$field];
|
||||
db_add_field($table, $field, $spec);
|
||||
$msg[] = t('Added panels_display.uuid column.');
|
||||
}
|
||||
|
||||
if (empty($msg)) {
|
||||
$msg[] = t('UUID column already present in the panels_display & panels_pane tables.');
|
||||
}
|
||||
|
||||
// Update all DB-based panes & displays to ensure that they all contain a UUID.
|
||||
$display_dids = db_select('panels_display')
|
||||
->fields('panels_display', array('did'))
|
||||
->condition(db_or()
|
||||
->condition('uuid', '')
|
||||
->isNull('uuid')
|
||||
)
|
||||
->execute()
|
||||
->fetchCol();
|
||||
|
||||
// Check the panes as well, for paranoia.
|
||||
$pane_dids = db_select('panels_pane')
|
||||
->distinct()
|
||||
->fields('panels_pane', array('did'))
|
||||
->condition(db_or()
|
||||
->condition('uuid', '')
|
||||
->isNull('uuid')
|
||||
)
|
||||
->execute()
|
||||
->fetchCol();
|
||||
|
||||
$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')) {
|
||||
module_load_include('module', 'panels');
|
||||
}
|
||||
if ($displays = panels_load_displays($dids)) {
|
||||
foreach ($displays as $display) {
|
||||
// A display save also triggers pane saves.
|
||||
panels_save_display($display);
|
||||
}
|
||||
$msg[] = t('Generated UUIDs for database-based panel displays and panes.');
|
||||
}
|
||||
else {
|
||||
$msg[] = t('No database-based panel displays or panes for which to generate UUIDs.');
|
||||
}
|
||||
|
||||
return implode("\n", $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a custom cache table for Panels.
|
||||
*/
|
||||
function panels_update_7303() {
|
||||
$schema = panels_schema_6();
|
||||
|
||||
$table_name = 'cache_panels';
|
||||
if (!db_table_exists($table_name)) {
|
||||
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]);
|
||||
}
|
||||
|
||||
/*
|
||||
The version of this update hook in release 3.8 included code that
|
||||
converted storage of allowed_types configuration from variables to the new
|
||||
table, and also deleted existing allowed_types configuration variables.
|
||||
See https://www.drupal.org/node/2479879.
|
||||
|
||||
In order to prevent data loss on sites that had not yet updated to 3.8, the
|
||||
conversion and variable-deletion code has been removed from this update hook.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
div.panels-ipe-handlebar-wrapper ul {
|
||||
float: right;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
div.panels-ipe-handlebar-wrapper li {
|
||||
margin: 0 0 0 .5em;
|
||||
float: right;
|
||||
}
|
||||
|
||||
div.panels-ipe-draghandle span.panels-ipe-draghandle-icon {
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.panels-ipe-placeholder {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div.panels-ipe-newblock {
|
||||
left: 30px;
|
||||
right: auto;
|
||||
}
|
||||
|
||||
div.panels-ipe-handlebar-wrapper li a span,
|
||||
div.panels-ipe-newblock a span {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div.panels-ipe-newblock a.style {
|
||||
margin-left: .5em;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.panels-ipe-editing .panels-ipe-region {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/** ============================================================================
|
||||
* Controller form markup
|
||||
*/
|
||||
|
||||
.ipe-throbber {
|
||||
right: 49%;
|
||||
right: auto;
|
||||
}
|
||||
|
||||
div.panels-ipe-control .form-submit {
|
||||
padding: 0 34px 2px 0.8em;
|
||||
}
|
||||
|
||||
#panels-ipe-save,
|
||||
#panels-ipe-cancel {
|
||||
background-position: 86% 0;
|
||||
}
|
||||
|
||||
div.panels-ipe-pseudobutton-container a.panels-ipe-startedit {
|
||||
padding-right: 34px;
|
||||
padding-left: 10px;
|
||||
background-position: 93% 9px;
|
||||
}
|
||||
|
||||
div.panels-ipe-pseudobutton-container a.panels-ipe-change-layout {
|
||||
padding-right: 34px;
|
||||
padding-left: 10px;
|
||||
background-position: 93% 9px;
|
||||
}
|
||||
@@ -21,12 +21,13 @@ html.overlay-open body.panels-ipe {
|
||||
}
|
||||
|
||||
div.panels-ipe-handlebar-wrapper {
|
||||
border-bottom: 1px solid #CCC;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.panels-ipe-editing div.panels-ipe-portlet-wrapper {
|
||||
margin-top: 1em;
|
||||
border: 1px solid #CCC;
|
||||
border: 1px solid #ccc;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Hide empty panes when not editing them. */
|
||||
@@ -39,7 +40,7 @@ div.panels-ipe-handlebar-wrapper {
|
||||
}
|
||||
|
||||
.panels-ipe-editing div.panels-ipe-portlet-wrapper:hover {
|
||||
border: 1px dashed #CCC;
|
||||
border: 1px dashed #ccc;
|
||||
}
|
||||
|
||||
.panels-ipe-editing .panels-ipe-sort-container {
|
||||
@@ -56,12 +57,12 @@ div.panels-ipe-handlebar-wrapper {
|
||||
|
||||
.panels-ipe-editing .panels-ipe-sort-container .ui-sortable-placeholder {
|
||||
border: 2px dashed #999;
|
||||
background-color: #FFFF99;
|
||||
background-color: #ffff99;
|
||||
margin: 1em 0;
|
||||
-moz-border-radius: 0;
|
||||
-khtml-border-radius: 0;
|
||||
-webkit-border-radius: 0;
|
||||
border-radius: 0;
|
||||
-khtml-border-radius: 0;
|
||||
-webkit-border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
div.panels-ipe-handlebar-wrapper ul {
|
||||
@@ -82,20 +83,19 @@ div.panels-ipe-handlebar-wrapper li {
|
||||
|
||||
div.panels-ipe-draghandle,
|
||||
div.panels-ipe-nodraghandle {
|
||||
background: #E9E9E9;
|
||||
background-image: linear-gradient(bottom, #D5D5D5 0%, #FCFCFC 100%);
|
||||
background-image: -o-linear-gradient(bottom, #D5D5D5 0%, #FCFCFC 100%);
|
||||
background-image: -moz-linear-gradient(bottom, #D5D5D5 0%, #FCFCFC 100%);
|
||||
background-image: -webkit-linear-gradient(bottom, #D5D5D5 0%, #FCFCFC 100%);
|
||||
background-image: -ms-linear-gradient(bottom, #D5D5D5 0%, #FCFCFC 100%);
|
||||
background: #e9e9e9;
|
||||
background-image: linear-gradient(bottom, #d5d5d5 0%, #fcfcfc 100%);
|
||||
background-image: -o-linear-gradient(bottom, #d5d5d5 0%, #fcfcfc 100%);
|
||||
background-image: -moz-linear-gradient(bottom, #d5d5d5 0%, #fcfcfc 100%);
|
||||
background-image: -webkit-linear-gradient(bottom, #d5d5d5 0%, #fcfcfc 100%);
|
||||
background-image: -ms-linear-gradient(bottom, #d5d5d5 0%, #fcfcfc 100%);
|
||||
background-image: -webkit-gradient(
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #D5D5D5),
|
||||
color-stop(1, #FCFCFC)
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #d5d5d5),
|
||||
color-stop(1, #fcfcfc)
|
||||
);
|
||||
|
||||
padding: 8px 7px;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ div.panels-ipe-placeholder {
|
||||
padding: .5em;
|
||||
position: relative;
|
||||
margin-top: .5em;
|
||||
background-color: #ECFAFF;
|
||||
background-color: #ecfaff;
|
||||
color: #999;
|
||||
font: 15px/1.3em "Open Sans", "Lucida Grande", Tahoma, Verdana, sans-serif;
|
||||
text-transform: none;
|
||||
@@ -151,9 +151,9 @@ div.panels-ipe-placeholder h3 {
|
||||
}
|
||||
|
||||
div.panels-ipe-newblock {
|
||||
-webkit-box-shadow: 0px 0 5px 5px #ECFAFF;
|
||||
-moz-box-shadow: 0px 0 5px 5px #ECFAFF;
|
||||
box-shadow: 0px 0 5px 5px #ECFAFF;
|
||||
-webkit-box-shadow: 0px 0 5px 5px #ecfaff;
|
||||
-moz-box-shadow: 0px 0 5px 5px #ecfaff;
|
||||
box-shadow: 0px 0 5px 5px #ecfaff;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 50%;
|
||||
@@ -163,38 +163,40 @@ div.panels-ipe-newblock {
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
div.panels-ipe-newblock li {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
div.panels-ipe-handlebar-wrapper li a,
|
||||
div.panels-ipe-dragtitle span,
|
||||
div.panels-ipe-newblock a,
|
||||
span.panels-ipe-draghandle-icon {
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
padding: 0 8px 1px;
|
||||
font: bold 12px/32px 'Open Sans', 'Lucida Sans', 'Lucida Grande', verdana sans-serif;
|
||||
text-decoration: none;
|
||||
height: 33px;
|
||||
color: #666;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
-moz-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
|
||||
background: #FAFAFA;
|
||||
background-image: linear-gradient(bottom, #E9EAEC 0%, #FAFAFA 100%);
|
||||
background-image: -o-linear-gradient(bottom, #E9EAEC 0%, #FAFAFA 100%);
|
||||
background-image: -moz-linear-gradient(bottom, #E9EAEC 0%, #FAFAFA 100%);
|
||||
background-image: -webkit-linear-gradient(bottom, #E9EAEC 0%, #FAFAFA 100%);
|
||||
background-image: -ms-linear-gradient(bottom, #E9EAEC 0%, #FAFAFA 100%);
|
||||
padding: 0 8px 1px;
|
||||
font: bold 12px/32px 'Open Sans', 'Lucida Sans', 'Lucida Grande', verdana sans-serif;
|
||||
text-decoration: none;
|
||||
height: 33px;
|
||||
color: #666;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
-moz-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
background: #fafafa;
|
||||
background-image: linear-gradient(bottom, #e9eaec 0%, #fafafa 100%);
|
||||
background-image: -o-linear-gradient(bottom, #e9eaec 0%, #fafafa 100%);
|
||||
background-image: -moz-linear-gradient(bottom, #e9eaec 0%, #fafafa 100%);
|
||||
background-image: -webkit-linear-gradient(bottom, #e9eaec 0%, #fafafa 100%);
|
||||
background-image: -ms-linear-gradient(bottom, #e9eaec 0%, #fafafa 100%);
|
||||
background-image: -webkit-gradient(
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #E9EAEC),
|
||||
color-stop(1, #FAFAFA)
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #e9eaec),
|
||||
color-stop(1, #fafafa)
|
||||
);
|
||||
|
||||
-webkit-box-shadow: 0px 3px 3px 0px #d2d2d2;
|
||||
-moz-box-shadow: 0px 3px 3px 0px #d2d2d2;
|
||||
box-shadow: 0px 3px 3px 0px #d2d2d2;
|
||||
@@ -215,6 +217,10 @@ div.panels-ipe-handlebar-wrapper li.edit a span {
|
||||
background-image: url(../images/icon-settings.png);
|
||||
}
|
||||
|
||||
div.panels-ipe-handlebar-wrapper li.css a span {
|
||||
background-image: url(../images/icon-css.png);
|
||||
}
|
||||
|
||||
div.panels-ipe-handlebar-wrapper li.style a span,
|
||||
div.panels-ipe-newblock a.style span {
|
||||
background-image: url(../images/icon-style.png);
|
||||
@@ -236,19 +242,21 @@ div.panels-ipe-handlebar-wrapper li.delete a span {
|
||||
div.panels-ipe-handlebar-wrapper li a:hover,
|
||||
div.panels-ipe-dragtitle span:hover,
|
||||
div.panels-ipe-newblock a:hover,
|
||||
span.panels-ipe-draghandle-icon:hover {
|
||||
background: #E6E6E6;
|
||||
background-image: linear-gradient(bottom, #C5C5C5 0%, #FAFAFA 100%);
|
||||
background-image: -o-linear-gradient(bottom, #C5C5C5 0%, #FAFAFA 100%);
|
||||
background-image: -moz-linear-gradient(bottom, #C5C5C5 0%, #FAFAFA 100%);
|
||||
background-image: -webkit-linear-gradient(bottom, #C5C5C5 0%, #FAFAFA 100%);
|
||||
background-image: -ms-linear-gradient(bottom, #C5C5C5 0%, #FAFAFA 100%);
|
||||
span.panels-ipe-draghandle-icon:hover,
|
||||
div.panels-ipe-handlebar-wrapper li a:focus,
|
||||
div.panels-ipe-newblock a:focus {
|
||||
background: #e6e6e6;
|
||||
background-image: linear-gradient(bottom, #c5c5c5 0%, #fafafa 100%);
|
||||
background-image: -o-linear-gradient(bottom, #c5c5c5 0%, #fafafa 100%);
|
||||
background-image: -moz-linear-gradient(bottom, #c5c5c5 0%, #fafafa 100%);
|
||||
background-image: -webkit-linear-gradient(bottom, #c5c5c5 0%, #fafafa 100%);
|
||||
background-image: -ms-linear-gradient(bottom, #c5c5c5 0%, #fafafa 100%);
|
||||
background-image: -webkit-gradient(
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #C5C5C5),
|
||||
color-stop(1, #FAFAFA)
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #c5c5c5),
|
||||
color-stop(1, #fafafa)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -257,19 +265,18 @@ div.panels-ipe-dragtitle span:active,
|
||||
div.panels-ipe-newblock a:active,
|
||||
span.panels-ipe-draghandle-icon:active {
|
||||
outline: none;
|
||||
background-image: linear-gradient(bottom, #FFFFFF 0%, #E9EAEC 100%);
|
||||
background-image: -o-linear-gradient(bottom, #FFFFFF 0%, #E9EAEC 100%);
|
||||
background-image: -moz-linear-gradient(bottom, #FFFFFF 0%, #E9EAEC 100%);
|
||||
background-image: -webkit-linear-gradient(bottom, #FFFFFF 0%, #E9EAEC 100%);
|
||||
background-image: -ms-linear-gradient(bottom, #FFFFFF 0%, #E9EAEC 100%);
|
||||
background-image: linear-gradient(bottom, #ffffff 0%, #e9eaec 100%);
|
||||
background-image: -o-linear-gradient(bottom, #ffffff 0%, #e9eaec 100%);
|
||||
background-image: -moz-linear-gradient(bottom, #ffffff 0%, #e9eaec 100%);
|
||||
background-image: -webkit-linear-gradient(bottom, #ffffff 0%, #e9eaec 100%);
|
||||
background-image: -ms-linear-gradient(bottom, #ffffff 0%, #e9eaec 100%);
|
||||
background-image: -webkit-gradient(
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #FFFFFF),
|
||||
color-stop(1, #E9EAEC)
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #ffffff),
|
||||
color-stop(1, #e9eaec)
|
||||
);
|
||||
|
||||
-webkit-box-shadow: 0px 0px 0px 0px #fff;
|
||||
-moz-box-shadow: 0px 0px 0px 0px #fff;
|
||||
box-shadow: 0px 0px 0px 0px #fff;
|
||||
@@ -352,19 +359,18 @@ div.panels-ipe-control .form-submit {
|
||||
background-image: -moz-linear-gradient(bottom, #383838 0%, #666666 100%);
|
||||
background-image: -webkit-linear-gradient(bottom, #383838 0%, #666666 100%);
|
||||
background-image: -ms-linear-gradient(bottom, #383838 0%, #666666 100%);
|
||||
|
||||
background-image: -webkit-gradient(
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #383838),
|
||||
color-stop(1, #666666)
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #383838),
|
||||
color-stop(1, #666666)
|
||||
);
|
||||
border: 0;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
color: #CCC;
|
||||
color: #ccc;
|
||||
display: inline-block;
|
||||
font: bold 12px/33px "Open Sans", "Lucida Grande", Tahoma, Verdana, sans-serif;
|
||||
height: 33px;
|
||||
@@ -375,9 +381,14 @@ div.panels-ipe-control .form-submit {
|
||||
padding: 0 0.8em 2px 34px;
|
||||
}
|
||||
|
||||
input#panels-ipe-save, input#panels-ipe-cancel,
|
||||
input#panels-ipe-save:hover, input#panels-ipe-cancel:hover,
|
||||
input#panels-ipe-save:active, input#panels-ipe-cancel:active {
|
||||
div.panels-ipe-control input.panels-ipe-save,
|
||||
div.panels-ipe-control input.panels-ipe-cancel,
|
||||
div.panels-ipe-control input.panels-ipe-save:hover,
|
||||
div.panels-ipe-control input.panels-ipe-cancel:hover,
|
||||
div.panels-ipe-control input.panels-ipe-save:focus,
|
||||
div.panels-ipe-control input.panels-ipe-cancel:focus,
|
||||
div.panels-ipe-control input.panels-ipe-save:active,
|
||||
div.panels-ipe-control input.panels-ipe-cancel:active {
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
@@ -385,96 +396,96 @@ div.panels-ipe-pseudobutton-container a {
|
||||
height: 33px;
|
||||
padding: 0 0.8em;
|
||||
display: inline-block;
|
||||
color: #CCC;
|
||||
color: #ccc;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
input#panels-ipe-save {
|
||||
div.panels-ipe-control .panels-ipe-save {
|
||||
background-image: url(../images/icon-save.png);
|
||||
background-image: url(../images/icon-save.png), linear-gradient(bottom, #383838 0%, #666666 100%);
|
||||
background-image: url(../images/icon-save.png), -o-linear-gradient(bottom, #383838 0%, #666666 100%);
|
||||
background-image: url(../images/icon-save.png), -moz-linear-gradient(bottom, #383838 0%, #666666 100%);
|
||||
background-image: url(../images/icon-save.png), -webkit-linear-gradient(bottom, #383838 0%, #666666 100%);
|
||||
background-image: url(../images/icon-save.png), -ms-linear-gradient(bottom, #383838 0%, #666666 100%);
|
||||
|
||||
background-image: url(../images/icon-save.png), -webkit-gradient(
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #383838),
|
||||
color-stop(1, #666666)
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #383838),
|
||||
color-stop(1, #666666)
|
||||
);
|
||||
}
|
||||
|
||||
input#panels-ipe-cancel {
|
||||
div.panels-ipe-control .panels-ipe-cancel {
|
||||
background-image: url(../images/icon-close.png);
|
||||
background-image: url(../images/icon-close.png), linear-gradient(bottom, #383838 0%, #666666 100%);
|
||||
background-image: url(../images/icon-close.png), -o-linear-gradient(bottom, #383838 0%, #666666 100%);
|
||||
background-image: url(../images/icon-close.png), -moz-linear-gradient(bottom, #383838 0%, #666666 100%);
|
||||
background-image: url(../images/icon-close.png), -webkit-linear-gradient(bottom, #383838 0%, #666666 100%);
|
||||
background-image: url(../images/icon-close.png), -ms-linear-gradient(bottom, #383838 0%, #666666 100%);
|
||||
|
||||
background-image: url(../images/icon-close.png), -webkit-gradient(
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #383838),
|
||||
color-stop(1, #666666)
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #383838),
|
||||
color-stop(1, #666666)
|
||||
);
|
||||
}
|
||||
|
||||
div.panels-ipe-pseudobutton-container:hover,
|
||||
div.panels-ipe-control .form-submit:hover {
|
||||
div.panels-ipe-control .form-submit:hover,
|
||||
div.panels-ipe-pseudobutton-container:focus,
|
||||
div.panels-ipe-control .form-submit:focus {
|
||||
background: #999999;
|
||||
background-image: linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
background-image: -o-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
background-image: -moz-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
background-image: -webkit-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
background-image: -ms-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
background-image: linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: -o-linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: -moz-linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: -webkit-linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: -ms-linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: -webkit-gradient(
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #3D3D3D),
|
||||
color-stop(1, #999999)
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #3d3d3d),
|
||||
color-stop(1, #999999)
|
||||
);
|
||||
|
||||
color: #FFF;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
div.panels-ipe-pseudobutton-container a:hover {
|
||||
color: #FFF;
|
||||
div.panels-ipe-pseudobutton-container a:hover,
|
||||
div.panels-ipe-pseudobutton-container a:focus {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
input#panels-ipe-cancel:hover {
|
||||
background-image: url(../images/icon-close.png), linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
background-image: url(../images/icon-close.png), -o-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
background-image: url(../images/icon-close.png), -moz-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
background-image: url(../images/icon-close.png), -webkit-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
background-image: url(../images/icon-close.png), -ms-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
|
||||
div.panels-ipe-control .panels-ipe-cancel:hover,
|
||||
div.panels-ipe-control .panels-ipe-cancel:focus {
|
||||
background-image: url(../images/icon-close.png), linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: url(../images/icon-close.png), -o-linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: url(../images/icon-close.png), -moz-linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: url(../images/icon-close.png), -webkit-linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: url(../images/icon-close.png), -ms-linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: url(../images/icon-close.png), -webkit-gradient(
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #3D3D3D),
|
||||
color-stop(1, #999999)
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #3d3d3d),
|
||||
color-stop(1, #999999)
|
||||
);
|
||||
}
|
||||
|
||||
input#panels-ipe-save:hover {
|
||||
background-image: url(../images/icon-save.png), linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
background-image: url(../images/icon-save.png), -o-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
background-image: url(../images/icon-save.png), -moz-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
background-image: url(../images/icon-save.png), -webkit-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
background-image: url(../images/icon-save.png), -ms-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
|
||||
|
||||
div.panels-ipe-control .panels-ipe-save:hover,
|
||||
div.panels-ipe-control .panels-ipe-save:focus {
|
||||
background-image: url(../images/icon-save.png), linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: url(../images/icon-save.png), -o-linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: url(../images/icon-save.png), -moz-linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: url(../images/icon-save.png), -webkit-linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: url(../images/icon-save.png), -ms-linear-gradient(bottom, #3d3d3d 0%, #999999 100%);
|
||||
background-image: url(../images/icon-save.png), -webkit-gradient(
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #3D3D3D),
|
||||
color-stop(1, #999999)
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #3d3d3d),
|
||||
color-stop(1, #999999)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -486,54 +497,59 @@ div.panels-ipe-control .form-submit:active {
|
||||
background-image: -moz-linear-gradient(bottom, #616161 0%, #333333 100%);
|
||||
background-image: -webkit-linear-gradient(bottom, #616161 0%, #333333 100%);
|
||||
background-image: -ms-linear-gradient(bottom, #616161 0%, #333333 100%);
|
||||
|
||||
background-image: -webkit-gradient(
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #616161),
|
||||
color-stop(1, #333333)
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #616161),
|
||||
color-stop(1, #333333)
|
||||
);
|
||||
|
||||
color: #CCC;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
div.panels-ipe-pseudobutton-container a:active {
|
||||
color: #CCC;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
input#panels-ipe-cancel:active {
|
||||
div.panels-ipe-control .panels-ipe-cancel:active {
|
||||
background-image: url(../images/icon-close.png), linear-gradient(bottom, #616161 0%, #333333 100%);
|
||||
background-image: url(../images/icon-close.png), -o-linear-gradient(bottom, #616161 0%, #333333 100%);
|
||||
background-image: url(../images/icon-close.png), -moz-linear-gradient(bottom, #616161 0%, #333333 100%);
|
||||
background-image: url(../images/icon-close.png), -webkit-linear-gradient(bottom, #616161 0%, #333333 100%);
|
||||
background-image: url(../images/icon-close.png), -ms-linear-gradient(bottom, #616161 0%, #333333 100%);
|
||||
|
||||
background-image: url(../images/icon-close.png), -webkit-gradient(
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #616161),
|
||||
color-stop(1, #333333)
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #616161),
|
||||
color-stop(1, #333333)
|
||||
);
|
||||
}
|
||||
|
||||
input#panels-ipe-save:active {
|
||||
div.panels-ipe-control .panels-ipe-save:active {
|
||||
background-image: url(../images/icon-save.png), linear-gradient(bottom, #616161 0%, #333333 100%);
|
||||
background-image: url(../images/icon-save.png), -o-linear-gradient(bottom, #616161 0%, #333333 100%);
|
||||
background-image: url(../images/icon-save.png), -moz-linear-gradient(bottom, #616161 0%, #333333 100%);
|
||||
background-image: url(../images/icon-save.png), -webkit-linear-gradient(bottom, #616161 0%, #333333 100%);
|
||||
background-image: url(../images/icon-save.png), -ms-linear-gradient(bottom, #616161 0%, #333333 100%);
|
||||
|
||||
background-image: url(../images/icon-save.png), -webkit-gradient(
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #616161),
|
||||
color-stop(1, #333333)
|
||||
linear,
|
||||
left bottom,
|
||||
left top,
|
||||
color-stop(0, #616161),
|
||||
color-stop(1, #333333)
|
||||
);
|
||||
}
|
||||
|
||||
div.panels-ipe-control .panels-ipe-save,
|
||||
div.panels-ipe-control .panels-ipe-cancel,
|
||||
div.panels-ipe-control .panels-ipe-save:hover,
|
||||
div.panels-ipe-control .panels-ipe-cancel:hover,
|
||||
div.panels-ipe-control .panels-ipe-save:active,
|
||||
div.panels-ipe-control .panels-ipe-cancel:active {
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
div.panels-ipe-pseudobutton-container a.panels-ipe-startedit {
|
||||
padding-left: 34px;
|
||||
background: url(../images/icon-configure.png) no-repeat 10px 9px;
|
||||
@@ -552,3 +568,7 @@ div.panels-ipe-button-container {
|
||||
form#panels-ipe-edit-control-form {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.panels-ipe-dragbar-admin-title {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 285 B After Width: | Height: | Size: 285 B |
|
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 546 B |
|
After Width: | Height: | Size: 449 B |
|
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 247 B |
@@ -11,7 +11,7 @@
|
||||
function panels_ipe_default_panels_renderer_pipeline() {
|
||||
$pipelines = array();
|
||||
|
||||
$pipeline = new stdClass;
|
||||
$pipeline = new stdClass();
|
||||
$pipeline->disabled = FALSE; /* Edit this to true to make a default pipeline disabled initially */
|
||||
$pipeline->api_version = 1;
|
||||
$pipeline->name = 'ipe';
|
||||
|
||||
@@ -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: {},
|
||||
@@ -15,9 +10,11 @@ Drupal.PanelsIPE = {
|
||||
$('a.pane-delete:not(.pane-delete-processed)', context)
|
||||
.addClass('pane-delete-processed')
|
||||
.click(function() {
|
||||
if (confirm('Remove this pane?')) {
|
||||
if (confirm(Drupal.t('Remove this pane?'))) {
|
||||
$(this).parents('div.panels-ipe-portlet-wrapper').fadeOut('medium', function() {
|
||||
var $sortable = $(this).closest('.ui-sortable');
|
||||
$(this).empty().remove();
|
||||
$sortable.trigger('sortremove');
|
||||
});
|
||||
$(this).parents('div.panels-ipe-display-container').addClass('changed');
|
||||
}
|
||||
@@ -29,16 +26,31 @@ 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)')
|
||||
.addClass('panels-ipe-processed')
|
||||
.each(function() {
|
||||
// If we're replacing an old IPE, clean it up a little.
|
||||
if (Drupal.PanelsIPE.editors[key]) {
|
||||
Drupal.PanelsIPE.editors[key].editing = false;
|
||||
}
|
||||
Drupal.PanelsIPE.editors[key] = new DrupalPanelsIPE(key);
|
||||
Drupal.PanelsIPE.editors[key].showContainer();
|
||||
});
|
||||
}
|
||||
$('.panels-ipe-hide-bar').once('panels-ipe-hide-bar-processed').click(function() {
|
||||
$('.panels-ipe-hide-bar').once('panels-ipe-hide-bar').click(function() {
|
||||
Drupal.PanelsIPE.editors[key].hideContainer();
|
||||
});
|
||||
Drupal.PanelsIPE.bindClickDelete(context);
|
||||
@@ -71,6 +83,7 @@ function DrupalPanelsIPE(cache_key, cfg) {
|
||||
items: 'div.panels-ipe-portlet-wrapper',
|
||||
handle: 'div.panels-ipe-draghandle',
|
||||
cancel: '.panels-ipe-nodrag',
|
||||
tolerance: 'pointer',
|
||||
dropOnEmpty: true
|
||||
}, cfg.sortableOptions || {});
|
||||
|
||||
@@ -92,6 +105,22 @@ function DrupalPanelsIPE(cache_key, cfg) {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// If a user navigates away from a locked IPE, cancel the lock in the background.
|
||||
$(window).bind('beforeunload', function() {
|
||||
if (!ipe.editing) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ipe.topParent && ipe.topParent.hasClass('changed')) {
|
||||
ipe.changed = true;
|
||||
}
|
||||
|
||||
if (ipe.changed) {
|
||||
return Drupal.t('This will discard all unsaved changes. Are you sure?');
|
||||
}
|
||||
});
|
||||
|
||||
// If a user navigates away from a locked IPE, cancel the lock in the background.
|
||||
$(window).bind('unload', function() {
|
||||
ipe.cancelLock(true);
|
||||
@@ -170,6 +199,7 @@ function DrupalPanelsIPE(cache_key, cfg) {
|
||||
};
|
||||
|
||||
this.initEditing = function(formdata) {
|
||||
ipe.editing = true;
|
||||
ipe.topParent = $('div#panels-ipe-display-' + cache_key);
|
||||
ipe.backup = this.topParent.clone();
|
||||
|
||||
@@ -190,9 +220,11 @@ 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)', ipe.control).addClass('ajax-processed').each(function() {
|
||||
$('input:submit:not(.ajax-processed), button:not(.ajax-processed)', ipe.control).addClass('ajax-processed').each(function() {
|
||||
var element_settings = {};
|
||||
|
||||
element_settings.url = $(this.form).attr('action');
|
||||
@@ -210,18 +242,7 @@ function DrupalPanelsIPE(cache_key, cfg) {
|
||||
// it clears out inline styles.
|
||||
$('.panels-ipe-on').show();
|
||||
ipe.showForm();
|
||||
ipe.topParent.addClass('panels-ipe-editing');
|
||||
|
||||
//Reposition the "Add new pane" button
|
||||
$('.panels-ipe-newblock').each(function() {
|
||||
var link_width_half = parseInt($(this).children('a').outerWidth() / 2);
|
||||
|
||||
$(this).css('margin-left', '-' + link_width_half + 'px');
|
||||
|
||||
$(this).css('margin-top', '-' + parseInt($(this).children('a').outerHeight() / 2) + 'px');
|
||||
|
||||
$(this).parents('.panels-ipe-placeholder').find('h3').css('width', parseInt(($(this).parents('.panels-ipe-placeholder').width() / 2) - link_width_half) + 'px');
|
||||
});
|
||||
$('body').add(ipe.topParent).addClass('panels-ipe-editing');
|
||||
|
||||
};
|
||||
|
||||
@@ -246,18 +267,22 @@ function DrupalPanelsIPE(cache_key, cfg) {
|
||||
};
|
||||
|
||||
this.endEditing = function() {
|
||||
ipe.editing = false;
|
||||
ipe.lockPath = null;
|
||||
$('.panels-ipe-form-container', ipe.control).empty();
|
||||
$('.panels-ipe-form-container').empty();
|
||||
// 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();
|
||||
if (ipe.topParent) {
|
||||
ipe.topParent.removeClass('panels-ipe-editing');
|
||||
$('div.panels-ipe-sort-container', ipe.topParent).sortable("destroy");
|
||||
}
|
||||
|
||||
$('.panels-ipe-editing').removeClass('panels-ipe-editing');
|
||||
$('div.panels-ipe-sort-container.ui-sortable', ipe.topParent).sortable("destroy");
|
||||
};
|
||||
|
||||
this.saveEditing = function() {
|
||||
@@ -273,7 +298,7 @@ function DrupalPanelsIPE(cache_key, cfg) {
|
||||
val += id;
|
||||
}
|
||||
});
|
||||
$('input[name="panel[pane][' + region + ']"]', ipe.control).val(val);
|
||||
$('[name="panel[pane][' + region + ']"]', ipe.control).val(val);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -287,6 +312,7 @@ function DrupalPanelsIPE(cache_key, cfg) {
|
||||
// @todo this isn't ideal but I can't seem to figure out how to keep an unprocessed backup
|
||||
// that will later get processed.
|
||||
$('.ctools-use-modal-processed', ipe.topParent).removeClass('ctools-use-modal-processed');
|
||||
$('.panels-ipe-hide-bar-processed', ipe.topParent).removeClass('panels-ipe-hide-bar-processed');
|
||||
$('.pane-delete-processed', ipe.topParent).removeClass('pane-delete-processed');
|
||||
ipe.topParent.fadeIn('medium');
|
||||
Drupal.attachBehaviors();
|
||||
@@ -310,7 +336,7 @@ function DrupalPanelsIPE(cache_key, cfg) {
|
||||
|
||||
this.createSortContainers = function() {
|
||||
$('div.panels-ipe-region', this.topParent).each(function() {
|
||||
$('div.panels-ipe-portlet-marker', this).parent()
|
||||
$(this).children('div.panels-ipe-portlet-marker').parent()
|
||||
.wrapInner('<div class="panels-ipe-sort-container" />');
|
||||
|
||||
// Move our gadgets outside of the sort container so that sortables
|
||||
@@ -318,9 +344,6 @@ function DrupalPanelsIPE(cache_key, cfg) {
|
||||
$('div.panels-ipe-portlet-static', this).each(function() {
|
||||
$(this).prependTo($(this).parent().parent());
|
||||
});
|
||||
|
||||
// Also remove the last panel separator.
|
||||
$('div.panel-separator', this).filter(':last').remove();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -334,6 +357,8 @@ $(function() {
|
||||
Drupal.PanelsIPE.editors[data.key].initEditing(data.data);
|
||||
Drupal.PanelsIPE.editors[data.key].lockPath = data.lockPath;
|
||||
}
|
||||
Drupal.attachBehaviors();
|
||||
|
||||
};
|
||||
|
||||
Drupal.ajax.prototype.commands.IPEsetLockState = function(ajax, data, status) {
|
||||
@@ -342,6 +367,12 @@ $(function() {
|
||||
}
|
||||
};
|
||||
|
||||
Drupal.ajax.prototype.commands.addNewPane = function(ajax, data, status) {
|
||||
if (Drupal.PanelsIPE.editors[data.key]) {
|
||||
Drupal.PanelsIPE.editors[data.key].changed = true;
|
||||
}
|
||||
};
|
||||
|
||||
Drupal.ajax.prototype.commands.cancelIPE = function(ajax, data, status) {
|
||||
if (Drupal.PanelsIPE.editors[data.key]) {
|
||||
Drupal.PanelsIPE.editors[data.key].cancelIPE();
|
||||
@@ -366,12 +397,45 @@ $(function() {
|
||||
}
|
||||
};
|
||||
|
||||
Drupal.ajax.prototype.commands.insertNewPane = function(ajax, data, status) {
|
||||
IPEContainerSelector = '#panels-ipe-regionid-' + data.regionId + ' div.panels-ipe-sort-container';
|
||||
firstPaneSelector = IPEContainerSelector + ' div.panels-ipe-portlet-wrapper:first';
|
||||
// Insert the new pane before the first existing pane in the region, if
|
||||
// any.
|
||||
if ($(firstPaneSelector).length) {
|
||||
insertData = {
|
||||
'method': 'before',
|
||||
'selector': firstPaneSelector,
|
||||
'data': data.renderedPane,
|
||||
'settings': null
|
||||
}
|
||||
Drupal.ajax.prototype.commands.insert(ajax, insertData, status);
|
||||
}
|
||||
// Else, insert it as a first child of the container. Doing so might fall
|
||||
// outside of the wrapping markup for the style, but it's the best we can
|
||||
// do.
|
||||
else {
|
||||
insertData = {
|
||||
'method': 'prepend',
|
||||
'selector': IPEContainerSelector,
|
||||
'data': data.renderedPane,
|
||||
'settings': null
|
||||
}
|
||||
Drupal.ajax.prototype.commands.insert(ajax, insertData, status);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Override the eventResponse on ajax.js so we can add a little extra
|
||||
* behavior.
|
||||
*/
|
||||
Drupal.ajax.prototype.ipeReplacedEventResponse = Drupal.ajax.prototype.eventResponse;
|
||||
Drupal.ajax.prototype.eventResponse = function (element, event) {
|
||||
if (element.ipeCancelThis) {
|
||||
element.ipeCancelThis = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($(this.element).attr('id') == 'panels-ipe-cancel') {
|
||||
if (!Drupal.PanelsIPE.editors[this.element_settings.ipe_cache_key].cancelEditing()) {
|
||||
return false;
|
||||
@@ -404,7 +468,7 @@ $(function() {
|
||||
|
||||
Drupal.ajax.prototype.ipeReplacedBeforeSerialize = Drupal.ajax.prototype.beforeSerialize;
|
||||
Drupal.ajax.prototype.beforeSerialize = function (element_settings, options) {
|
||||
if ($(this.element).attr('id') == 'panels-ipe-save') {
|
||||
if ($(this.element).hasClass('panels-ipe-save')) {
|
||||
Drupal.PanelsIPE.editors[this.element_settings.ipe_cache_key].saveEditing();
|
||||
};
|
||||
return this.ipeReplacedBeforeSerialize(element_settings, options);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -6,9 +6,8 @@ core = 7.x
|
||||
configure = admin/structure/panels
|
||||
files[] = panels_ipe.module
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-08-18
|
||||
version = "7.x-3.3"
|
||||
; Information added by Drupal.org packaging script on 2020-07-05
|
||||
version = "7.x-3.10"
|
||||
core = "7.x"
|
||||
project = "panels"
|
||||
datestamp = "1345319572"
|
||||
|
||||
datestamp = "1593990788"
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implementation of hook_ctools_plugin_directory().
|
||||
*/
|
||||
@@ -73,34 +77,35 @@ function theme_panels_ipe_placeholder_pane($vars) {
|
||||
return $output;
|
||||
}
|
||||
|
||||
function theme_panels_ipe_pane_wrapper($vars) {
|
||||
$output = $vars['output'];
|
||||
function template_preprocess_panels_ipe_pane_wrapper(&$vars) {
|
||||
$pane = $vars['pane'];
|
||||
$display = $vars['display'];
|
||||
$renderer = $vars['renderer'];
|
||||
|
||||
$content_type = ctools_get_content_type($pane->type);
|
||||
$subtype = ctools_content_get_subtype($content_type, $pane->subtype);
|
||||
$links = array();
|
||||
$vars['links'] = array();
|
||||
|
||||
if (ctools_content_editable($content_type, $subtype, $pane->configuration)) {
|
||||
$links['edit'] = array(
|
||||
$vars['links']['edit'] = array(
|
||||
'title' => isset($content_type['edit text']) ? '<span>' . $content_type['edit text'] . '</span>' : '<span>' . t('Settings') . '</span>',
|
||||
'href' => $renderer->get_url('edit-pane', $pane->pid),
|
||||
'query' => drupal_get_destination(),
|
||||
'html' => TRUE,
|
||||
'attributes' => array(
|
||||
'class' => array('ctools-use-modal', 'panels-ipe-hide-bar'),
|
||||
'title' => isset($content_type['edit text']) ? $content_type['edit text'] : t('Settings'),
|
||||
// 'id' => "pane-edit-panel-pane-$pane->pid",
|
||||
// 'id' => "pane-edit-panel-pane-$pane->pid",.
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Add option to configure style in IPE
|
||||
if (user_access('administer panels styles')) {
|
||||
$links['style'] = array(
|
||||
// Add option to configure style in IPE.
|
||||
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),
|
||||
'query' => drupal_get_destination(),
|
||||
'html' => TRUE,
|
||||
'attributes' => array(
|
||||
'class' => array('ctools-use-modal', 'panels-ipe-hide-bar'),
|
||||
@@ -109,9 +114,23 @@ function theme_panels_ipe_pane_wrapper($vars) {
|
||||
);
|
||||
}
|
||||
|
||||
// Add option to configure CSS.
|
||||
if (user_access('administer advanced pane settings')) {
|
||||
$vars['links']['css'] = array(
|
||||
'title' => '<span>' . t('CSS') . '</span>',
|
||||
'href' => $renderer->get_url('pane-css', $pane->pid),
|
||||
'query' => drupal_get_destination(),
|
||||
'html' => TRUE,
|
||||
'attributes' => array(
|
||||
'class' => array('ctools-use-modal', 'panels-ipe-hide-bar'),
|
||||
'title' => t('CSS'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Deleting is managed entirely in the js; this is just an attachment point
|
||||
// for it
|
||||
$links['delete'] = array(
|
||||
// for it.
|
||||
$vars['links']['delete'] = array(
|
||||
'title' => '<span>' . t('Delete') . '</span>',
|
||||
'href' => '#',
|
||||
'html' => TRUE,
|
||||
@@ -122,19 +141,38 @@ function theme_panels_ipe_pane_wrapper($vars) {
|
||||
),
|
||||
);
|
||||
|
||||
$context = array(
|
||||
'pane' => $pane,
|
||||
'display' => $display,
|
||||
'renderer' => $renderer,
|
||||
);
|
||||
drupal_alter('panels_ipe_pane_links', $vars['links'], $context);
|
||||
|
||||
}
|
||||
|
||||
function theme_panels_ipe_pane_wrapper($vars) {
|
||||
$output = $vars['output'];
|
||||
$pane = $vars['pane'];
|
||||
$display = $vars['display'];
|
||||
|
||||
$attributes = array(
|
||||
'class' => 'panels-ipe-linkbar',
|
||||
);
|
||||
|
||||
$links = theme('links', array('links' => $links, 'attributes' => $attributes));
|
||||
$type = ctools_get_content_type($pane->type);
|
||||
$title = '<span class = "panels-ipe-dragbar-admin-title">' . ctools_content_admin_title($type, $pane->subtype, $pane->configuration, $display->context) . '</span>';
|
||||
|
||||
$links = theme('links', array('links' => $vars['links'], 'attributes' => $attributes));
|
||||
|
||||
if (!empty($pane->locks['type']) && $pane->locks['type'] == 'immovable') {
|
||||
$links = '<div class="panels-ipe-dragbar panels-ipe-nodraghandle clearfix">' . $links . '</div>';
|
||||
$links = '<div class="panels-ipe-dragbar panels-ipe-nodraghandle clearfix">' . $links . $title . '</div>';
|
||||
}
|
||||
else {
|
||||
$links = '<div class="panels-ipe-dragbar panels-ipe-draghandle clearfix">' . $links . '<span class="panels-ipe-draghandle-icon"><span class="panels-ipe-draghandle-icon-inner"></span></span></div>';
|
||||
$links = '<div class="panels-ipe-dragbar panels-ipe-draghandle clearfix">' . $links . $title . '<span class="panels-ipe-draghandle-icon"><span class="panels-ipe-draghandle-icon-inner"></span></span></div>';
|
||||
}
|
||||
|
||||
$handlebar = '<div class="panels-ipe-handlebar-wrapper panels-ipe-on">' . $links . '</div>';
|
||||
|
||||
return $handlebar . $output;
|
||||
}
|
||||
|
||||
@@ -142,40 +180,53 @@ function theme_panels_ipe_region_wrapper($vars) {
|
||||
return $vars['controls'] . $vars['output'];
|
||||
}
|
||||
|
||||
function theme_panels_ipe_add_pane_button($vars) {
|
||||
function template_preprocess_panels_ipe_add_pane_button(&$vars) {
|
||||
$region_id = $vars['region_id'];
|
||||
$display = $vars['display'];
|
||||
$renderer = $vars['renderer'];
|
||||
$link = '';
|
||||
$vars['links'] = array();
|
||||
|
||||
// Add option to configure style in IPE
|
||||
if (user_access('administer panels styles')) {
|
||||
$link .= ' ' . l('<span>' . t('Region style') . '</span>', $renderer->get_url('style-type', 'region', $region_id), array(
|
||||
// Add option to configure style in IPE.
|
||||
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),
|
||||
'html' => TRUE,
|
||||
'attributes' => array(
|
||||
'class' => array('ctools-use-modal', 'style', 'panels-ipe-hide-bar'),
|
||||
'class' => array('ctools-use-modal', 'panels-ipe-hide-bar', 'style'),
|
||||
'title' => t('Region style'),
|
||||
),
|
||||
'html' => TRUE,
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
// Add option to add items in the IPE
|
||||
$link .= ' ' . l('<span>' . t('Add new pane') . '</span>', $renderer->get_url('select-content', $region_id), array(
|
||||
'attributes' => array(
|
||||
'class' => array('ctools-use-modal', 'add', 'panels-ipe-hide-bar'),
|
||||
'title' => t('Add new pane'),
|
||||
),
|
||||
'html' => TRUE,
|
||||
));
|
||||
// Add option to add items in the IPE.
|
||||
$vars['links']['add-pane'] = array(
|
||||
'title' => '<span>' . t('Add new pane') . '</span>',
|
||||
'href' => $renderer->get_url('select-content', $region_id),
|
||||
'attributes' => array(
|
||||
'class' => array('ctools-use-modal', 'add', 'panels-ipe-hide-bar'),
|
||||
'title' => t('Add new pane'),
|
||||
),
|
||||
'html' => TRUE,
|
||||
);
|
||||
|
||||
$context = array(
|
||||
'region_id' => $region_id,
|
||||
'display' => $display,
|
||||
'renderer' => $renderer,
|
||||
);
|
||||
drupal_alter('panels_ipe_region_links', $vars['links'], $context);
|
||||
|
||||
return '<div class="panels-ipe-newblock panels-ipe-on">' . $link . '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
function panels_ipe_get_cache_key($key = NULL) {
|
||||
return array();
|
||||
function theme_panels_ipe_add_pane_button($vars) {
|
||||
$attributes = array(
|
||||
'class' => array('panels-ipe-linkbar', 'inline'),
|
||||
);
|
||||
|
||||
$links = theme('links', array('links' => $vars['links'], 'attributes' => $attributes));
|
||||
|
||||
return '<div class="panels-ipe-newblock panels-ipe-on">' . $links . '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,11 +234,12 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_footer()
|
||||
* Implementation of hook_footer().
|
||||
*
|
||||
* Adds the IPE control container.
|
||||
*
|
||||
@@ -208,9 +260,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.
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
'renderer' => 'panels_renderer_ipe',
|
||||
);
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Renderer class for all In-Place Editor (IPE) behavior.
|
||||
*/
|
||||
@@ -7,12 +11,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');
|
||||
|
||||
@@ -22,13 +58,13 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
// @todo we may need an else to load the cache, but I am not sure we
|
||||
// actually need to load it if we already have our cache key, and doing
|
||||
// so is a waste of resources.
|
||||
|
||||
ctools_include('cleanstring');
|
||||
$this->clean_key = ctools_cleanstring($this->display->cache_key);
|
||||
$button = array(
|
||||
'#type' => 'link',
|
||||
'#title' => t('Customize this page'),
|
||||
'#href' => $this->get_url('save_form'),
|
||||
'#options' => array('query' => drupal_get_destination()),
|
||||
'#id' => 'panels-ipe-customize-page',
|
||||
'#attributes' => array(
|
||||
'class' => array('panels-ipe-startedit', 'panels-ipe-pseudobutton'),
|
||||
@@ -41,7 +77,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')) {
|
||||
@@ -49,6 +85,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
'#type' => 'link',
|
||||
'#title' => t('Change layout'),
|
||||
'#href' => $this->get_url('change_layout'),
|
||||
'#options' => array('query' => drupal_get_destination()),
|
||||
'#attributes' => array(
|
||||
'class' => array('panels-ipe-change-layout', 'panels-ipe-pseudobutton', 'ctools-modal-layout'),
|
||||
),
|
||||
@@ -57,11 +94,11 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
'ipe_cache_key' => $this->clean_key,
|
||||
),
|
||||
|
||||
'#prefix' => '<div class="panels-ipe-pseudobutton-container">',
|
||||
'#suffix' => '</div>',
|
||||
'#prefix' => '<div class="panels-ipe-pseudobutton-container">',
|
||||
'#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');
|
||||
@@ -70,6 +107,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');
|
||||
|
||||
@@ -89,10 +127,24 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
* @param $pane
|
||||
*/
|
||||
function render_pane(&$pane) {
|
||||
// Temporarily change $_GET['q'] so that panes think the current path is
|
||||
// the original path when rendering.
|
||||
$ajax_path = $_GET['q'];
|
||||
if (!empty($_GET['destination'])) {
|
||||
$_GET['q'] = $_GET['destination'];
|
||||
}
|
||||
|
||||
$output = parent::render_pane($pane);
|
||||
|
||||
// Reset $_GET['q'] to the AJAX path.
|
||||
$_GET['q'] = $ajax_path;
|
||||
|
||||
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') {
|
||||
@@ -118,13 +170,13 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
|
||||
if (empty($pane->IPE_empty)) {
|
||||
// Add an inner layer wrapper to the pane content before placing it into
|
||||
// draggable portlet
|
||||
// draggable portlet.
|
||||
$output = "<div class=\"panels-ipe-portlet-content\">$output</div>";
|
||||
}
|
||||
else {
|
||||
$output = "<div class=\"panels-ipe-portlet-content panels-ipe-empty-pane\">$output</div>";
|
||||
}
|
||||
// Hand it off to the plugin/theme for placing draggers/buttons
|
||||
// Hand it off to the plugin/theme for placing draggers/buttons.
|
||||
$output = theme('panels_ipe_pane_wrapper', array('output' => $output, 'pane' => $pane, 'display' => $this->display, 'renderer' => $this));
|
||||
|
||||
if (!empty($pane->locks['type']) && $pane->locks['type'] == 'immovable') {
|
||||
@@ -134,15 +186,36 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
return "<div id=\"panels-ipe-paneid-{$pane->pid}\" class=\"panels-ipe-portlet-wrapper panels-ipe-portlet-marker\">" . $output . "</div>";
|
||||
}
|
||||
|
||||
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);
|
||||
$this->admin = FALSE;
|
||||
}
|
||||
|
||||
function render_pane_content(&$pane) {
|
||||
$content = parent::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);
|
||||
}
|
||||
// Ensure that empty panes have some content.
|
||||
if (empty($content) || empty($content->content)) {
|
||||
if (empty($content)) {
|
||||
$content = new stdClass();
|
||||
}
|
||||
|
||||
// Get the administrative title.
|
||||
$content_type = ctools_get_content_type($pane->type);
|
||||
$title = ctools_content_admin_title($content_type, $pane->subtype, $pane->configuration, $this->display->context);
|
||||
|
||||
$content->content = t('Placeholder for empty "@title"', array('@title' => $title));
|
||||
$content->content = t('Placeholder for empty or inaccessible "@title"', array('@title' => html_entity_decode($title, ENT_QUOTES)));
|
||||
// Add these to prevent notices.
|
||||
$content->type = 'panels_ipe';
|
||||
$content->subtype = 'panels_ipe';
|
||||
@@ -159,6 +232,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]));
|
||||
|
||||
@@ -198,6 +275,23 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX callback to unlock the IPE.
|
||||
*
|
||||
@@ -223,15 +317,16 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
|
||||
// Reset the $_POST['ajax_html_ids'] values to preserve
|
||||
// proper IDs on form elements when they are rebuilt
|
||||
// by the Panels IPE without refreshing the page
|
||||
// by the Panels IPE without refreshing the page.
|
||||
$_POST['ajax_html_ids'] = array();
|
||||
|
||||
$form_state = array(
|
||||
'renderer' => $this,
|
||||
'display' => &$this->display,
|
||||
'content_types' => $this->cache->content_types,
|
||||
'rerender' => FALSE,
|
||||
'no_redirect' => TRUE,
|
||||
// Panels needs this to make sure that the layout gets callbacks
|
||||
// Panels needs this to make sure that the layout gets callbacks.
|
||||
'layout' => $this->plugins['layout'],
|
||||
);
|
||||
|
||||
@@ -244,7 +339,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
'command' => 'initIPE',
|
||||
'key' => $this->clean_key,
|
||||
'data' => drupal_render($output),
|
||||
'lockPath' => $this->get_url('unlock_ipe'),
|
||||
'lockPath' => url($this->get_url('unlock_ipe')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -268,6 +363,12 @@ 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);
|
||||
|
||||
$storage_id = $this->cache->display->storage_id;
|
||||
cache_clear_all('panels_mini_load:' . $storage_id, 'cache_panels', TRUE);
|
||||
}
|
||||
else {
|
||||
// Cancelled. Clear the cache.
|
||||
@@ -303,10 +404,13 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
$layouts = panels_common_get_allowed_layouts('panels_page');
|
||||
}
|
||||
|
||||
// Filter out builders
|
||||
// Filter out builders.
|
||||
$layouts = array_filter($layouts, '_panels_builder_filter');
|
||||
|
||||
// Define the current layout
|
||||
// Let other modules filter the layouts.
|
||||
drupal_alter('panels_layouts_available', $layouts);
|
||||
|
||||
// Define the current layout.
|
||||
$current_layout = $this->plugins['layout']['name'];
|
||||
|
||||
$output = panels_common_print_layout_links($layouts, $this->get_url('set_layout'), array('attributes' => array('class' => array('use-ajax'))), $current_layout);
|
||||
@@ -315,7 +419,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
$this->commands[] = array(
|
||||
'command' => 'IPEsetLockState',
|
||||
'key' => $this->clean_key,
|
||||
'lockPath' => $this->get_url('unlock_ipe'),
|
||||
'lockPath' => url($this->get_url('unlock_ipe')),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -331,7 +435,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
|
||||
// Reset the $_POST['ajax_html_ids'] values to preserve
|
||||
// proper IDs on form elements when they are rebuilt
|
||||
// by the Panels IPE without refreshing the page
|
||||
// by the Panels IPE without refreshing the page.
|
||||
$_POST['ajax_html_ids'] = array();
|
||||
|
||||
$output = drupal_build_form('panels_change_layout', $form_state);
|
||||
@@ -344,7 +448,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
if (!empty($form_state['clicked_button']['#save-display'])) {
|
||||
// Saved. Save the cache.
|
||||
panels_edit_cache_save($this->cache);
|
||||
$this->display->skip_cache;
|
||||
$this->display->skip_cache = TRUE;
|
||||
|
||||
// Since the layout changed, we have to update these things in the
|
||||
// renderer in order to get the right settings.
|
||||
@@ -391,9 +495,18 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
$pane = $this->display->content[$pid];
|
||||
}
|
||||
|
||||
$this->commands[] = ajax_command_prepend("#panels-ipe-regionid-{$pane->panel} div.panels-ipe-sort-container", $this->render_pane($pane));
|
||||
$this->commands[] = array(
|
||||
'command' => 'insertNewPane',
|
||||
'regionId' => $pane->panel,
|
||||
'renderedPane' => $this->render_pane($pane),
|
||||
);
|
||||
$this->commands[] = ajax_command_changed("#panels-ipe-display-{$this->clean_key}");
|
||||
$this->commands[] = array(
|
||||
'command' => 'addNewPane',
|
||||
'key' => $this->clean_key,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -402,8 +515,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
|
||||
function panels_ipe_edit_control_form($form, &$form_state) {
|
||||
$display = &$form_state['display'];
|
||||
// @todo -- this should be unnecessary as we ensure cache_key is set in add_meta()
|
||||
// $display->cache_key = isset($display->cache_key) ? $display->cache_key : $display->did;
|
||||
|
||||
// $display->cache_key = isset($display->cache_key) ? $display->cache_key : $display->did;
|
||||
// Annoyingly, theme doesn't have access to form_state so we have to do this.
|
||||
$form['#display'] = $display;
|
||||
|
||||
@@ -430,12 +542,14 @@ function panels_ipe_edit_control_form($form, &$form_state) {
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Save'),
|
||||
'#id' => 'panels-ipe-save',
|
||||
'#attributes' => array('class' => array('panels-ipe-save')),
|
||||
'#submit' => array('panels_edit_display_form_submit'),
|
||||
'#save-display' => TRUE,
|
||||
);
|
||||
$form['buttons']['cancel'] = array(
|
||||
'#type' => 'submit',
|
||||
'#id' => 'panels-ipe-cancel',
|
||||
'#attributes' => array('class' => array('panels-ipe-cancel')),
|
||||
'#value' => t('Cancel'),
|
||||
);
|
||||
return $form;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @file
|
||||
* Custom CSS for the Mini Panels module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Customize the CTools wizard trail / breadcrumb used on the edit pages for
|
||||
* Mini Panels as a stop-gap measure until the UX can be completely re-done.
|
||||
*/
|
||||
.wizard-trail {
|
||||
text-align: right;
|
||||
}
|
||||
@@ -4,9 +4,9 @@ package = "Panels"
|
||||
dependencies[] = panels
|
||||
core = 7.x
|
||||
files[] = plugins/export_ui/panels_mini_ui.class.php
|
||||
; Information added by drupal.org packaging script on 2012-08-18
|
||||
version = "7.x-3.3"
|
||||
|
||||
; Information added by Drupal.org packaging script on 2020-07-05
|
||||
version = "7.x-3.10"
|
||||
core = "7.x"
|
||||
project = "panels"
|
||||
datestamp = "1345319572"
|
||||
|
||||
datestamp = "1593990788"
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implementation of hook_schema().
|
||||
*/
|
||||
@@ -105,7 +109,7 @@ function panels_mini_uninstall() {
|
||||
foreach ($result as $panel_mini) {
|
||||
// Delete all associated displays.
|
||||
if (!function_exists('panels_delete_display')) {
|
||||
require_once drupal_get_path('module', 'panels') .'/panels.module';
|
||||
require_once drupal_get_path('module', 'panels') . '/panels.module';
|
||||
}
|
||||
if ($panels_exists) {
|
||||
panels_delete_display($panel_mini->did);
|
||||
@@ -114,7 +118,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 +126,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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ function panels_mini_menu() {
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
);
|
||||
|
||||
// Also provide settings on the main panel UI
|
||||
// Also provide settings on the main panel UI.
|
||||
$items['admin/structure/panels/settings/panels-mini'] = array(
|
||||
'title' => 'Mini panels',
|
||||
'page callback' => 'panels_mini_settings',
|
||||
@@ -59,8 +59,7 @@ function panels_mini_settings() {
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Allow the rest of the system access to mini panels
|
||||
|
||||
// Allow the rest of the system access to mini panels.
|
||||
/**
|
||||
* Implementation of hook_block_info().
|
||||
*/
|
||||
@@ -91,7 +90,7 @@ function panels_mini_block_info() {
|
||||
* @see panels_mini_panels_mini_content_type_render().
|
||||
*/
|
||||
function panels_mini_block_view($delta = 0) {
|
||||
// static recursion protection.
|
||||
// Static recursion protection.
|
||||
static $viewing = array();
|
||||
if (!empty($viewing[$delta])) {
|
||||
return;
|
||||
@@ -112,9 +111,11 @@ function panels_mini_block_view($delta = 0) {
|
||||
$contexts = ctools_context_match_required_contexts($panel_mini->requiredcontexts, $current_page['contexts']);
|
||||
}
|
||||
}
|
||||
drupal_alter('panels_mini_block_contexts', $contexts, $panel_mini);
|
||||
|
||||
$panel_mini->context = $panel_mini->display->context = ctools_context_load_contexts($panel_mini, FALSE, $contexts);
|
||||
$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();
|
||||
|
||||
@@ -130,8 +131,8 @@ function panels_mini_block_view($delta = 0) {
|
||||
*/
|
||||
function panels_mini_block_configure($delta = 0) {
|
||||
return array(
|
||||
'admin-shortcut' => array(
|
||||
'#value' => l(t('Manage this mini-panel'), 'admin/structure/mini-panels/' . $delta . '/edit')
|
||||
'admin_shortcut' => array(
|
||||
'#markup' => l(t('Manage this mini-panel'), 'admin/structure/mini-panels/list/' . $delta . '/edit'),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -142,9 +143,14 @@ function panels_mini_block_configure($delta = 0) {
|
||||
* Remove the block if the required contexts are not available.
|
||||
*/
|
||||
function panels_mini_block_list_alter(&$blocks) {
|
||||
$current_page = FALSE;
|
||||
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.
|
||||
@@ -178,6 +184,44 @@ function panels_mini_block_list_alter(&$blocks) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_get_pane_links_alter().
|
||||
*/
|
||||
function panels_mini_get_pane_links_alter(&$links, $pane, $content_type) {
|
||||
if ($pane->type == 'panels_mini') {
|
||||
$links['top']['edit_panels_mini'] = array(
|
||||
'title' => t('Edit mini panel'),
|
||||
'href' => url('admin/structure/mini-panels/list/' . $pane->subtype . '/edit/content', array('absolute' => TRUE)),
|
||||
'attributes' => array('target' => array('_blank')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_contextual_links_view_alter().
|
||||
*/
|
||||
function panels_mini_contextual_links_view_alter(&$element, $items) {
|
||||
|
||||
// Add contextual links to all mini panel blocks with bid property.
|
||||
if (isset($element['#element']['#block']) && isset($element['#element']['#block']->bid) && strpos((string) $element['#element']['#block']->bid, 'panels_mini') === 0) {
|
||||
|
||||
$admin_pages = array(
|
||||
t('Configure mini panel settings') => 'basic',
|
||||
t('Configure mini panel context') => 'context',
|
||||
t('Configure mini panel layout') => 'layout',
|
||||
t('Configure mini panel content') => 'content',
|
||||
);
|
||||
|
||||
foreach ($admin_pages as $title => $tail) {
|
||||
$element['#links']['mini-panels-' . $tail] = array(
|
||||
'title' => $title,
|
||||
'href' => 'admin/structure/mini-panels/list/' . $element['#element']['#block']->delta . '/edit/' . $tail,
|
||||
'query' => drupal_get_destination(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Statically store all used IDs to ensure all mini panels get a unique id.
|
||||
*/
|
||||
@@ -197,7 +241,6 @@ function panels_mini_get_id($name) {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Database functions.
|
||||
|
||||
/**
|
||||
* Create a new page with defaults appropriately set from schema.
|
||||
*/
|
||||
@@ -215,22 +258,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,6 +304,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');
|
||||
@@ -263,7 +330,7 @@ function panels_mini_load_all($reset = FALSE) {
|
||||
$dids[$mini->did] = $mini->name;
|
||||
}
|
||||
else {
|
||||
// Translate old style titles into new titles.
|
||||
// Translate old style titles into new titles.
|
||||
if (!empty($mini->title) && empty($mini->display->title)) {
|
||||
$mini->display->title = $mini->title;
|
||||
}
|
||||
@@ -285,7 +352,8 @@ function panels_mini_load_all($reset = FALSE) {
|
||||
}
|
||||
}
|
||||
|
||||
return $cache;
|
||||
// Strip out NULL entries that may have been added by panels_mini_load().
|
||||
return array_filter($cache);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -293,10 +361,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);
|
||||
|
||||
@@ -327,7 +399,7 @@ function panels_mini_delete($mini) {
|
||||
function panels_mini_export($mini, $indent = '') {
|
||||
ctools_include('export');
|
||||
$output = ctools_export_object('panels_mini', $mini, $indent);
|
||||
// Export the primary display
|
||||
// Export the primary display.
|
||||
$display = !empty($mini->display) ? $mini->display : panels_load_display($mini->did);
|
||||
$output .= panels_export_display($display, $indent);
|
||||
$output .= $indent . '$mini->display = $display' . ";\n";
|
||||
@@ -349,6 +421,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -371,7 +461,7 @@ function _panels_mini_panels_cache_get($key) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get display edit cache for the panels mini export UI
|
||||
* Get display edit cache for the panels mini export UI.
|
||||
*
|
||||
* The key is the second half of the key in this form:
|
||||
* panels_mini:TASK_NAME:HANDLER_NAME;
|
||||
@@ -387,6 +477,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;
|
||||
|
||||
@@ -430,6 +523,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().
|
||||
*
|
||||
@@ -479,3 +581,14 @@ function panels_mini_panels_dashboard_blocks(&$vars) {
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements template_preprocess_ctools_wizard_trail().
|
||||
*
|
||||
* Customize the divider used in the CTools wizard to build the edit pages for
|
||||
* Mini Panels as a stop-gap measure until the UX can be completely re-done.
|
||||
*/
|
||||
function panels_mini_preprocess_ctools_wizard_trail(&$variables) {
|
||||
$variables['divider'] = ' | ';
|
||||
drupal_add_css(drupal_get_path('module', 'panels_mini') . '/panels_mini.css');
|
||||
}
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
* @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 +67,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;
|
||||
@@ -100,7 +104,7 @@ function panels_mini_panels_mini_content_type_render($subtype, $conf, $panel_arg
|
||||
$mini->display->args = $panel_args;
|
||||
$mini->display->css_id = panels_mini_get_id($subtype);
|
||||
$mini->display->owner = $mini;
|
||||
// unique ID of this mini.
|
||||
// Unique ID of this mini.
|
||||
$mini->display->owner->id = $mini->name;
|
||||
|
||||
$block = new stdClass();
|
||||
@@ -109,6 +113,16 @@ function panels_mini_panels_mini_content_type_render($subtype, $conf, $panel_arg
|
||||
$block->content = panels_render_display($mini->display);
|
||||
$block->title = $mini->display->get_title();
|
||||
|
||||
if (user_access('administer mini panels')) {
|
||||
$block->admin_links = array(
|
||||
array(
|
||||
'title' => t('Configure mini panel'),
|
||||
'href' => "admin/structure/mini-panels/list/$subtype/edit/content",
|
||||
'query' => drupal_get_destination(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
unset($viewing[$mini->name]);
|
||||
return $block;
|
||||
}
|
||||
@@ -137,3 +151,30 @@ function panels_mini_panels_mini_content_type_admin_title($subtype, $conf) {
|
||||
return $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to provide administrative info. Provide links to edit the mini
|
||||
* panel.
|
||||
*/
|
||||
function panels_mini_panels_mini_content_type_admin_info($subtype, $conf) {
|
||||
$mini = panels_mini_load($subtype);
|
||||
if (!$mini) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$block = new stdClass();
|
||||
$block->title = $mini->admin_title;
|
||||
$admin_pages = array(
|
||||
t('Settings') => 'basic',
|
||||
t('Context') => 'context',
|
||||
t('Layout') => 'layout',
|
||||
t('Content') => 'content',
|
||||
);
|
||||
|
||||
$links = array();
|
||||
foreach ($admin_pages as $title => $tail) {
|
||||
$links[] = l($title, 'admin/structure/mini-panels/list/' . $subtype . '/edit/' . $tail, array('query' => drupal_get_destination()));
|
||||
}
|
||||
|
||||
$block->content = theme('item_list', array('items' => $links));
|
||||
return $block;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
'schema' => 'panels_mini',
|
||||
'access' => 'administer mini panels',
|
||||
@@ -38,4 +42,3 @@ $plugin = array(
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
class panels_mini_ui extends ctools_export_ui {
|
||||
function init($plugin) {
|
||||
parent::init($plugin);
|
||||
@@ -62,23 +65,28 @@ class panels_mini_ui extends ctools_export_ui {
|
||||
}
|
||||
|
||||
function list_build_row($item, &$form_state, $operations) {
|
||||
// Set up sorting
|
||||
// Set up sorting.
|
||||
switch ($form_state['values']['order']) {
|
||||
case 'disabled':
|
||||
$this->sorts[$item->name] = empty($item->disabled) . $item->admin_title;
|
||||
break;
|
||||
|
||||
case 'title':
|
||||
$this->sorts[$item->name] = $item->admin_title;
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
$this->sorts[$item->name] = $item->name;
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
$this->sorts[$item->name] = ($item->category ? $item->category : t('Mini panels')) . $item->admin_title;
|
||||
break;
|
||||
|
||||
case 'layout':
|
||||
$this->sorts[$item->name] = $item->display->layout . $item->admin_title;
|
||||
break;
|
||||
|
||||
case 'storage':
|
||||
$this->sorts[$item->name] = $item->type . $item->admin_title;
|
||||
break;
|
||||
@@ -115,9 +123,16 @@ class panels_mini_ui extends ctools_export_ui {
|
||||
}
|
||||
|
||||
function edit_form(&$form, &$form_state) {
|
||||
// Get the basic edit form
|
||||
// Get the basic edit form.
|
||||
parent::edit_form($form, $form_state);
|
||||
|
||||
// Set the admin title machine name length.
|
||||
// We need to do this because the system block name length is
|
||||
// limited to 32 chars.
|
||||
$form['info']['name']['#maxlength'] = 32;
|
||||
$form['info']['name']['#size'] = 34;
|
||||
$form['info']['name']['#description'] .= ' ' . t('The machine name length is limited to 32 characters, due to a limitation in the core block system.');
|
||||
|
||||
$form['category'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#size' => 24,
|
||||
@@ -288,4 +303,5 @@ class panels_mini_ui extends ctools_export_ui {
|
||||
panels_edit_display_form_submit($form, $form_state);
|
||||
$form_state['item']->display = $form_state['display'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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,14 +1,13 @@
|
||||
name = Panel nodes
|
||||
description = Create nodes that are divided into areas with selectable content.
|
||||
name = Panel nodes (deprecated)
|
||||
description = Create nodes that are divided into areas with selectable content. This module is deprecated, use <a href="http://drupal.org/project/panelizer">Panelizer</a> instead.
|
||||
package = "Panels"
|
||||
dependencies[] = panels
|
||||
configure = admin/structure/panels
|
||||
core = 7.x
|
||||
files[] = panels_node.module
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-08-18
|
||||
version = "7.x-3.3"
|
||||
; Information added by Drupal.org packaging script on 2020-07-05
|
||||
version = "7.x-3.10"
|
||||
core = "7.x"
|
||||
project = "panels"
|
||||
datestamp = "1345319572"
|
||||
|
||||
datestamp = "1593990788"
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implementation of hook_schema().
|
||||
*/
|
||||
@@ -57,7 +61,19 @@ function panels_node_uninstall() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_update to handle adding a pipeline
|
||||
* 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.
|
||||
*/
|
||||
function panels_node_update_6001() {
|
||||
$ret = array();
|
||||
@@ -69,3 +85,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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* @file panels_node.module
|
||||
*
|
||||
@@ -10,40 +8,28 @@
|
||||
*/
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// General Drupal hooks
|
||||
|
||||
// General Drupal hooks.
|
||||
/**
|
||||
* Implementation of hook_permission().
|
||||
*/
|
||||
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 +69,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,
|
||||
);
|
||||
@@ -92,7 +78,7 @@ function panels_node_menu() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Access callback to determine if a user has edit access
|
||||
* Access callback to determine if a user has edit access.
|
||||
*/
|
||||
function panels_node_edit_node($node) {
|
||||
if (!isset($node->panels_node)) {
|
||||
@@ -102,6 +88,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,12 +106,11 @@ 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()));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Node hooks
|
||||
|
||||
// Node hooks.
|
||||
/**
|
||||
* Implementation of hook_node_info().
|
||||
*/
|
||||
@@ -156,19 +148,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 +162,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',
|
||||
@@ -221,7 +198,7 @@ function panels_node_hook_form(&$node, &$form_state) {
|
||||
);
|
||||
|
||||
// Support for different rendering pipelines
|
||||
// Mostly borrowed from panel_context.inc
|
||||
// Mostly borrowed from panel_context.inc.
|
||||
$pipelines = panels_get_renderer_pipelines();
|
||||
|
||||
$options = array();
|
||||
@@ -233,7 +210,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,10 +248,12 @@ 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)) {
|
||||
// This works by overriding the $display set above
|
||||
// This works by overriding the $display set above.
|
||||
eval($node->export_display);
|
||||
unset($node->export_display);
|
||||
}
|
||||
@@ -339,6 +318,7 @@ function panels_node_hook_view($node, $view_mode) {
|
||||
$display->css_id = $node->panels_node['css_id'];
|
||||
// TODO: Find a way to make sure this can't node_view.
|
||||
$display->context = panels_node_get_context($node);
|
||||
$display->cache_key = 'panels_node:' . $node->nid;
|
||||
$renderer = panels_get_renderer($node->panels_node['pipeline'], $display);
|
||||
$node->content['body'] = array(
|
||||
'#markup' => panels_render_display($display, $renderer),
|
||||
@@ -352,8 +332,7 @@ function panels_node_hook_view($node, $view_mode) {
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Administrative pages
|
||||
|
||||
// Administrative pages.
|
||||
/**
|
||||
* Settings for panel nodes.
|
||||
*/
|
||||
@@ -363,8 +342,7 @@ function panels_node_settings() {
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Meat of the Panels API; almost completely passing through to panels.module
|
||||
|
||||
// Meat of the Panels API; almost completely passing through to panels.module.
|
||||
/**
|
||||
* Pass through to the panels layout editor.
|
||||
*/
|
||||
@@ -401,7 +379,7 @@ function panels_node_get_context(&$node) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_export_node_alter()
|
||||
* Implementation of hook_export_node_alter().
|
||||
*
|
||||
* Integrate with export.module for saving panel_nodes into code.
|
||||
*/
|
||||
@@ -429,3 +407,71 @@ function panels_node_panels_dashboard_blocks(&$vars) {
|
||||
'weight' => -1,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
/**
|
||||
* Get display edit cache for a panel node being edited.
|
||||
*
|
||||
* The key is the second half of the key in this form:
|
||||
* panels_node:NID;
|
||||
*/
|
||||
function panels_node_panels_cache_get($nid) {
|
||||
ctools_include('object-cache');
|
||||
$cache = ctools_object_cache_get('panels_node_display_cache', $nid);
|
||||
if (empty($cache)) {
|
||||
$cache = new stdClass();
|
||||
$node = node_load($nid);
|
||||
if (empty($node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ctools_include('common', 'panels');
|
||||
$cache->display = panels_load_display($node->panels_node['did']);
|
||||
$cache->display->css_id = $node->panels_node['css_id'];
|
||||
$cache->display->context = panels_node_get_context($node);
|
||||
$cache->display->cache_key = 'panels_node:' . $node->nid;
|
||||
$cache->content_types = panels_common_get_allowed_types('panels_node', $cache->display->context);
|
||||
$cache->allowed_layouts = panels_common_get_allowed_layouts('panels_node');
|
||||
}
|
||||
|
||||
return $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a display edit in progress in the panels cache.
|
||||
*/
|
||||
function panels_node_panels_cache_set($nid, $cache) {
|
||||
ctools_include('object-cache');
|
||||
ctools_object_cache_set('panels_node_display_cache', $nid, $cache);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all changes made to a display using the panels cache.
|
||||
*/
|
||||
function panels_node_panels_cache_clear($nid, $cache) {
|
||||
ctools_include('object-cache');
|
||||
ctools_object_cache_clear('panels_node_display_cache', $nid);
|
||||
}
|
||||
|
||||
/**
|
||||
* React to a cache save and save the display and clear cache.
|
||||
*/
|
||||
function panels_node_panels_cache_save($nid, $cache) {
|
||||
panels_save_display($cache->display);
|
||||
ctools_include('object-cache');
|
||||
ctools_object_cache_clear('panels_node_display_cache', $nid);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Provides a simple time-based caching option for panel panes.
|
||||
*/
|
||||
|
||||
// Plugin definition.
|
||||
$plugin = array(
|
||||
'title' => t("Simple cache"),
|
||||
'description' => t('Simple caching is a time-based cache. This is a hard limit, and once cached it will remain that way until the time limit expires.'),
|
||||
'cache get' => 'panels_simple_cache_get_cache',
|
||||
'cache set' => 'panels_simple_cache_set_cache',
|
||||
'cache clear' => 'panels_simple_cache_clear_cache',
|
||||
'settings form' => 'panels_simple_cache_settings_form',
|
||||
'settings form submit' => 'panels_simple_cache_settings_form_submit',
|
||||
'defaults' => array(
|
||||
'lifetime' => 15,
|
||||
'granularity' => 'none',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Get cached content.
|
||||
*/
|
||||
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_panels');
|
||||
if (!$cache) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((time() - $cache->created) > $conf['lifetime']) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return $cache->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cached content.
|
||||
*/
|
||||
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_panels');
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear cached content.
|
||||
*
|
||||
* Cache clears are always for an entire display, regardless of arguments.
|
||||
*/
|
||||
function panels_simple_cache_clear_cache($display) {
|
||||
$cid = 'panels_simple_cache';
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
cache_clear_all($cid, 'cache_panels', TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Figure out an id for our cache based upon input and settings.
|
||||
*/
|
||||
function panels_simple_cache_get_id($conf, $display, $args, $contexts, $pane) {
|
||||
$id = 'panels_simple_cache';
|
||||
|
||||
// If the panel is stored in the database it'll have a numeric did value.
|
||||
if (is_numeric($display->did)) {
|
||||
$id .= ':' . $display->did;
|
||||
}
|
||||
// Exported panels won't have a numeric did but may have a usable cache_key.
|
||||
elseif (!empty($display->cache_key)) {
|
||||
$id .= ':' . str_replace('panel_context:', '', $display->cache_key);
|
||||
}
|
||||
// Alternatively use the css_id.
|
||||
elseif (!empty($display->css_id)) {
|
||||
$id .= ':' . $display->css_id;
|
||||
}
|
||||
// Failover to just appending the did, which may be the completely unusable
|
||||
// string 'new'.
|
||||
else {
|
||||
$id .= ':' . $display->did;
|
||||
}
|
||||
|
||||
if ($pane) {
|
||||
$id .= ':' . $pane->pid;
|
||||
}
|
||||
|
||||
if (user_access('view pane admin links')) {
|
||||
$id .= ':admin';
|
||||
}
|
||||
|
||||
switch ($conf['granularity']) {
|
||||
case 'args':
|
||||
foreach ($args as $arg) {
|
||||
$id .= ':' . $arg;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'context':
|
||||
if (!is_array($contexts)) {
|
||||
$contexts = array($contexts);
|
||||
}
|
||||
foreach ($contexts as $context) {
|
||||
if (isset($context->argument)) {
|
||||
$id .= ':' . $context->argument;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (module_exists('locale')) {
|
||||
global $language;
|
||||
$id .= ':' . $language->language;
|
||||
}
|
||||
|
||||
if (!empty($pane->configuration['use_pager']) && !empty($_GET['page'])) {
|
||||
$id .= ':p' . check_plain($_GET['page']);
|
||||
}
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
function panels_simple_cache_settings_form($conf, $display, $pid) {
|
||||
$options = drupal_map_assoc(array(15, 30, 60, 120, 180, 240, 300, 600, 900, 1200, 1800, 3600, 7200, 14400, 28800, 43200, 86400, 172800, 259200, 345600, 604800), 'format_interval');
|
||||
$form['lifetime'] = array(
|
||||
'#title' => t('Lifetime'),
|
||||
'#type' => 'select',
|
||||
'#options' => $options,
|
||||
'#default_value' => $conf['lifetime'],
|
||||
);
|
||||
|
||||
$form['granularity'] = array(
|
||||
'#title' => t('Granularity'),
|
||||
'#type' => 'select',
|
||||
'#options' => array(
|
||||
'args' => t('Arguments'),
|
||||
'context' => t('Context'),
|
||||
'none' => t('None'),
|
||||
),
|
||||
'#description' => t('If "arguments" are selected, this content will be cached per individual argument to the entire display; if "contexts" are selected, this content will be cached per unique context in the pane or display; if "neither" there will be only one cache for this pane.'),
|
||||
'#default_value' => $conf['granularity'],
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
'renderer' => 'panels_renderer_editor',
|
||||
);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
* @file
|
||||
* Class file to control the main Panels editor.
|
||||
*/
|
||||
|
||||
class panels_renderer_editor extends panels_renderer_standard {
|
||||
|
||||
/**
|
||||
@@ -20,8 +19,10 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
* builder that do not actually have real content.
|
||||
*/
|
||||
var $no_edit_links = FALSE;
|
||||
// -------------------------------------------------------------------------
|
||||
// Display edit rendering.
|
||||
// -------------------------------------------------------------------------.
|
||||
/**
|
||||
* Display edit rendering.
|
||||
*/
|
||||
|
||||
function edit() {
|
||||
$form_state = array(
|
||||
@@ -61,6 +62,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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +120,6 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
$buttons = $this->get_pane_links($pane, $content_type);
|
||||
|
||||
// Render administrative buttons for the pane.
|
||||
|
||||
$block = new stdClass();
|
||||
if (empty($content_type)) {
|
||||
$block->title = '<em>' . t('Missing content type') . '</em>';
|
||||
@@ -135,7 +136,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
$settings['Panels']['RegionLock'][$pane->pid] = $pane->locks['regions'];
|
||||
drupal_add_js($settings, 'setting');
|
||||
}
|
||||
else if ($pane->locks['type'] == 'immovable') {
|
||||
elseif ($pane->locks['type'] == 'immovable') {
|
||||
$grabber_class = 'grab-title not-grabber';
|
||||
}
|
||||
}
|
||||
@@ -153,7 +154,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
|
||||
$output = '<div class="' . $class . '" id="panel-pane-' . $pane->pid . '">';
|
||||
|
||||
if (!$block->title) {
|
||||
if (empty($block->title)) {
|
||||
$block->title = t('No title');
|
||||
}
|
||||
|
||||
@@ -161,16 +162,16 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
if ($buttons) {
|
||||
$output .= '<span class="buttons">' . $buttons . '</span>';
|
||||
}
|
||||
$output .= '<span class="text">' . $title . '</span>';
|
||||
$output .= '</div>'; // grabber
|
||||
|
||||
$output .= '<span class="text" title="' . check_plain($title) . '">' . $title . '</span>';
|
||||
$output .= '</div>';
|
||||
// Grabber.
|
||||
$output .= '<div class="panel-pane-collapsible">';
|
||||
$output .= '<div class="pane-title">' . $block->title . '</div>';
|
||||
$output .= '<div class="pane-content">' . filter_xss_admin(render($block->content)) . '</div>';
|
||||
$output .= '</div>'; // panel-pane-collapsible
|
||||
|
||||
$output .= '</div>'; // panel-pane
|
||||
|
||||
$output .= '</div>';
|
||||
// panel-pane-collapsible.
|
||||
$output .= '</div>';
|
||||
// panel-pane.
|
||||
return $output;
|
||||
}
|
||||
|
||||
@@ -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')),
|
||||
@@ -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,
|
||||
@@ -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('✓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,28 +355,12 @@ 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
|
||||
// Make sure we have the logged in user context.
|
||||
if (!isset($contexts['logged-in-user'])) {
|
||||
$contexts['logged-in-user'] = ctools_access_get_loggedin_context();
|
||||
}
|
||||
@@ -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,107 +381,82 @@ 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':
|
||||
$lock_method = t('Immovable');
|
||||
break;
|
||||
|
||||
case 'regions':
|
||||
$lock_method = t('Regions');
|
||||
break;
|
||||
|
||||
case 'none':
|
||||
default:
|
||||
$lock_method = t('No lock');
|
||||
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,12 +465,42 @@ 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));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Display edit AJAX callbacks and helpers.
|
||||
|
||||
/**
|
||||
* Generate a URL path for the AJAX editor.
|
||||
*/
|
||||
@@ -525,6 +515,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 +596,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');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -581,12 +610,12 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
* @todo -- this should be in CTools.
|
||||
*/
|
||||
function get_category($content_type) {
|
||||
if (isset($content_type['top level'])) {
|
||||
if (!empty($content_type['top level'])) {
|
||||
$category = 'root';
|
||||
}
|
||||
else if (isset($content_type['category'])) {
|
||||
elseif (isset($content_type['category'])) {
|
||||
if (is_array($content_type['category'])) {
|
||||
list($category, $weight) = $content_type['category'];
|
||||
$category = reset($content_type['category']);
|
||||
}
|
||||
else {
|
||||
$category = $content_type['category'];
|
||||
@@ -640,7 +669,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
}
|
||||
}
|
||||
|
||||
// Now sort
|
||||
// Now sort.
|
||||
natcasesort($category_names);
|
||||
foreach ($category_names as $category => $name) {
|
||||
$output[$category] = $categories[$category];
|
||||
@@ -656,7 +685,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;
|
||||
}
|
||||
@@ -693,17 +734,17 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
$pane = $form_state['pane'];
|
||||
unset($this->cache->new_pane);
|
||||
|
||||
// Add the pane to the display
|
||||
// Add the pane to the display.
|
||||
$this->display->add_pane($pane, $region);
|
||||
panels_edit_cache_set($this->cache);
|
||||
|
||||
// Tell the client to draw the pane
|
||||
// Tell the client to draw the pane.
|
||||
$this->command_add_pane($pane);
|
||||
|
||||
// Dismiss the modal.
|
||||
$this->commands[] = ctools_modal_command_dismiss();
|
||||
}
|
||||
else if (!empty($form_state['cancel'])) {
|
||||
elseif (!empty($form_state['cancel'])) {
|
||||
// If cancelling, return to the activity.
|
||||
list($category_key, $category) = $this->get_category($subtype);
|
||||
$this->ajax_select_content($region, $category_key);
|
||||
@@ -746,17 +787,22 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
'cancel callback' => 'panels_ajax_edit_pane_cancel',
|
||||
);
|
||||
|
||||
$output = ctools_content_form('edit', $form_info, $form_state, $content_type, $pane->subtype, $subtype, $pane->configuration, $step);
|
||||
$output = ctools_content_form('edit', $form_info, $form_state, $content_type, $pane->subtype, $subtype, $pane->configuration, $step);
|
||||
|
||||
// If $rc is FALSE, there was no actual form.
|
||||
if ($output === FALSE || !empty($form_state['cancel'])) {
|
||||
// Dismiss the modal.
|
||||
$this->commands[] = ctools_modal_command_dismiss();
|
||||
}
|
||||
else if (!empty($form_state['complete'])) {
|
||||
elseif (!empty($form_state['complete'])) {
|
||||
// References get blown away with AJAX caching. This will fix that.
|
||||
$this->cache->display->content[$pid] = $form_state['pane'];
|
||||
|
||||
// Conditionally overwrite the context for this panel if present in the form state.
|
||||
if (!empty($form_state['display_cache']->display->context)) {
|
||||
$this->cache->display->context = $form_state['display_cache']->display->context;
|
||||
}
|
||||
|
||||
panels_edit_cache_set($this->cache);
|
||||
$this->command_update_pane($pid);
|
||||
$this->commands[] = ctools_modal_command_dismiss();
|
||||
@@ -807,7 +853,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
$conf = &$this->display->cache;
|
||||
$title = t('Cache method for this display');
|
||||
}
|
||||
else if (!empty($this->display->content[$pid])) {
|
||||
elseif (!empty($this->display->content[$pid])) {
|
||||
$pane = &$this->display->content[$pid];
|
||||
$subtype = ctools_content_get_subtype($pane->type, $pane->subtype);
|
||||
$conf = &$pane->cache;
|
||||
@@ -851,7 +897,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
else {
|
||||
$this->cache->method = $form_state['method'];
|
||||
panels_edit_cache_set($this->cache);
|
||||
// send them to next form.
|
||||
// Send them to next form.
|
||||
return $this->ajax_cache_settings($pid);
|
||||
}
|
||||
}
|
||||
@@ -872,7 +918,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
$conf = &$this->display->cache;
|
||||
$title = t('Cache settings for this display');
|
||||
}
|
||||
else if (!empty($this->display->content[$pid])) {
|
||||
elseif (!empty($this->display->content[$pid])) {
|
||||
$pane = &$this->display->content[$pid];
|
||||
$subtype = ctools_content_get_subtype($pane->type, $pane->subtype);
|
||||
|
||||
@@ -934,7 +980,8 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
break;
|
||||
|
||||
case 'region':
|
||||
$style = isset($this->display->panel_settings[$pid]['style']) ? $this->display->panel_settings[$pid]['style'] : '-1'; // -1 signifies to use the default setting.
|
||||
$style = isset($this->display->panel_settings[$pid]['style']) ? $this->display->panel_settings[$pid]['style'] : '-1';
|
||||
// -1 signifies to use the default setting.
|
||||
$title = t('Panel style for region "!region"', array('!region' => $this->plugins['layout']['regions'][$pid]));
|
||||
break;
|
||||
|
||||
@@ -942,8 +989,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:
|
||||
@@ -984,7 +1034,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
}
|
||||
|
||||
// If there's no settings form, just change the style and exit.
|
||||
switch($type) {
|
||||
switch ($type) {
|
||||
case 'display':
|
||||
$this->display->panel_settings['style'] = $form_state['style'];
|
||||
if (isset($this->display->panel_settings['style_settings']['default'])) {
|
||||
@@ -1002,9 +1052,8 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
case 'pane':
|
||||
$pane->style['style'] = $form_state['style'];
|
||||
if (isset($pane->style['settings'])) {
|
||||
unset($pane->style['settings']);
|
||||
$pane->style['settings'] = NULL;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
panels_edit_cache_set($this->cache);
|
||||
@@ -1014,7 +1063,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
if ($type == 'pane') {
|
||||
$this->command_update_pane($pane);
|
||||
}
|
||||
else if ($type == 'region') {
|
||||
elseif ($type == 'region') {
|
||||
$this->command_update_region_links($pid);
|
||||
}
|
||||
else {
|
||||
@@ -1027,7 +1076,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
panels_edit_cache_set($this->cache);
|
||||
}
|
||||
|
||||
// send them to next form.
|
||||
// Send them to next form.
|
||||
return $this->ajax_style_settings($type, $pid);
|
||||
}
|
||||
}
|
||||
@@ -1099,7 +1148,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
|
||||
// Backward compatibility: Translate old-style stylizer to new style
|
||||
// stylizer.
|
||||
if ($style['name'] == 'stylizer' && !empty($conf['style']) && $conf['style'] != '$') {
|
||||
if (isset($style['name']) && $style['name'] == 'stylizer' && !empty($conf['style']) && $conf['style'] != '$') {
|
||||
$style = panels_get_style('stylizer:' . $conf['style']);
|
||||
}
|
||||
|
||||
@@ -1158,7 +1207,23 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
unset($this->cache->style);
|
||||
}
|
||||
|
||||
// $conf was a reference so it should just modify.
|
||||
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'])) {
|
||||
if ($type == 'pane') {
|
||||
$this->cache->display->content[$pid]->style['settings'] = $form_state['values']['settings'];
|
||||
}
|
||||
elseif ($type == 'region') {
|
||||
$this->cache->display->panel_settings['style_settings'][$pid] = $form_state['values']['settings'];
|
||||
}
|
||||
}
|
||||
|
||||
panels_edit_cache_set($this->cache);
|
||||
|
||||
$this->commands[] = ctools_modal_command_dismiss();
|
||||
@@ -1166,7 +1231,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
if ($type == 'pane') {
|
||||
$this->command_update_pane($pane);
|
||||
}
|
||||
else if ($type == 'region') {
|
||||
elseif ($type == 'region') {
|
||||
$this->command_update_region_links($pid);
|
||||
}
|
||||
else {
|
||||
@@ -1290,12 +1355,12 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
|
||||
$output = ctools_modal_form_wrapper('panels_edit_add_access_test_form', $form_state);
|
||||
if (!empty($form_state['executed'])) {
|
||||
// Set up the plugin in cache
|
||||
// Set up the plugin in cache.
|
||||
$plugin = ctools_get_access_plugin($form_state['values']['type']);
|
||||
$this->cache->new_plugin = ctools_access_new_test($plugin);
|
||||
panels_edit_cache_set($this->cache);
|
||||
|
||||
// go to the next step.
|
||||
// Go to the next step.
|
||||
return $this->ajax_access_configure_test($pid, 'add');
|
||||
}
|
||||
|
||||
@@ -1323,7 +1388,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
$pane->access['plugins'][] = $this->cache->new_plugin;
|
||||
$id = max(array_keys($pane->access['plugins']));
|
||||
}
|
||||
else if (empty($pane->access['plugins'][$id])) {
|
||||
elseif (empty($pane->access['plugins'][$id])) {
|
||||
ctools_modal_render(t('Error'), t('Invalid test id.'));
|
||||
}
|
||||
|
||||
@@ -1338,12 +1403,14 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
);
|
||||
|
||||
$output = ctools_modal_form_wrapper('panels_edit_configure_access_test_form', $form_state);
|
||||
$pane->access['plugins'][$id] = $form_state['test'];
|
||||
|
||||
if (empty($form_state['executed'])) {
|
||||
$this->commands = $output;
|
||||
return;
|
||||
}
|
||||
|
||||
// Unset the new plugin
|
||||
// Unset the new plugin.
|
||||
if (isset($this->cache->new_plugin)) {
|
||||
unset($this->cache->new_plugin);
|
||||
}
|
||||
@@ -1419,7 +1486,6 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
//
|
||||
// These are used to make sure that child implementations can control their
|
||||
// own AJAX commands as needed.
|
||||
|
||||
/**
|
||||
* Create a command array to redraw a pane.
|
||||
*/
|
||||
@@ -1463,6 +1529,7 @@ class panels_renderer_editor extends panels_renderer_standard {
|
||||
function command_update_region_links($id) {
|
||||
$this->commands[] = ajax_command_replace('.panels-region-links-' . $id, $this->get_region_links($id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1476,7 +1543,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.
|
||||
@@ -1495,12 +1562,13 @@ function panels_ajax_edit_pane_cancel(&$form_state) {
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Forms for the editor object
|
||||
|
||||
// Forms for the editor object.
|
||||
/**
|
||||
* Choose cache method form
|
||||
* 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'];
|
||||
|
||||
@@ -1546,9 +1614,11 @@ function panels_edit_cache_method_form_submit($form, &$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache settings form
|
||||
* 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'];
|
||||
@@ -1606,9 +1676,11 @@ function panels_edit_cache_settings_form_submit($form, &$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Choose style form
|
||||
* 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'];
|
||||
@@ -1656,9 +1728,11 @@ function panels_edit_style_type_form_submit($form, &$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Style settings form
|
||||
* 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'];
|
||||
@@ -1683,9 +1757,27 @@ 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.
|
||||
*/
|
||||
@@ -1713,6 +1805,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'];
|
||||
|
||||
@@ -1720,13 +1814,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(
|
||||
@@ -1755,6 +1849,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'];
|
||||
|
||||
@@ -1830,6 +1926,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'];
|
||||
|
||||
@@ -1867,6 +1965,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'];
|
||||
|
||||
@@ -1896,6 +1996,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'];
|
||||
@@ -1937,7 +2039,7 @@ function panels_edit_configure_access_test_form($form, &$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate handler for visibility rule settings
|
||||
* Validate handler for visibility rule settings.
|
||||
*/
|
||||
function panels_edit_configure_access_test_form_validate(&$form, &$form_state) {
|
||||
if (!empty($form_state['clicked_button']['#remove'])) {
|
||||
@@ -1950,7 +2052,7 @@ function panels_edit_configure_access_test_form_validate(&$form, &$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit handler for visibility rule settings
|
||||
* Submit handler for visibility rule settings.
|
||||
*/
|
||||
function panels_edit_configure_access_test_form_submit(&$form, &$form_state) {
|
||||
if (!empty($form_state['clicked_button']['#remove'])) {
|
||||
@@ -1962,10 +2064,12 @@ function panels_edit_configure_access_test_form_submit(&$form, &$form_state) {
|
||||
$function($form, $form_state);
|
||||
}
|
||||
|
||||
if (!isset($form_state['values']['settings'])) {
|
||||
$form_state['values']['settings'] = array();
|
||||
}
|
||||
$form_state['test']['settings'] = $form_state['values']['settings'];
|
||||
if (isset($form_state['values']['context'])) {
|
||||
$form_state['test']['context'] = $form_state['values']['context'];
|
||||
}
|
||||
$form_state['test']['not'] = !empty($form_state['values']['not']);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,10 +23,11 @@ class panels_renderer_simple extends panels_renderer_standard {
|
||||
}
|
||||
|
||||
function render_panes() {
|
||||
// NOP
|
||||
// NOP.
|
||||
}
|
||||
|
||||
function prepare($external_settings = NULL) {
|
||||
$this->prep_run = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
/**
|
||||
* The standard render pipeline for a Panels display object.
|
||||
*
|
||||
@@ -48,6 +52,9 @@
|
||||
* with some exceptions (@see panels_renderer_legacy for details). The approach
|
||||
* here differs primarily in its friendliness to tweaking in subclasses.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class panels_renderer_standard {
|
||||
/**
|
||||
* The fully-loaded Panels display object that is to be rendered. "Fully
|
||||
@@ -151,6 +158,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 +192,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.
|
||||
*
|
||||
@@ -187,9 +216,9 @@ class panels_renderer_standard {
|
||||
* method via parent::prepare(), or manually set $this->prep_run = TRUE.
|
||||
*
|
||||
* @param mixed $external_settings
|
||||
* An optional parameter allowing external code to pass in additional
|
||||
* settings for use in the preparation process. Not used in the default
|
||||
* renderer, but included for interface consistency.
|
||||
* An optional parameter allowing external code to pass in additional
|
||||
* settings for use in the preparation process. Not used in the default
|
||||
* renderer, but included for interface consistency.
|
||||
*/
|
||||
function prepare($external_settings = NULL) {
|
||||
$this->prepare_panes($this->display->content);
|
||||
@@ -210,22 +239,24 @@ class panels_renderer_standard {
|
||||
* regularly make additions to the set of panes that will be rendered.
|
||||
*
|
||||
* @param array $panes
|
||||
* An associative array of pane data (stdClass objects), keyed on pane id.
|
||||
* An associative array of pane data (stdClass objects), keyed on pane id.
|
||||
*
|
||||
* @return array
|
||||
* An associative array of panes to be rendered, keyed on pane id and sorted
|
||||
* into proper rendering order.
|
||||
*/
|
||||
function prepare_panes($panes) {
|
||||
ctools_include('content');
|
||||
// Use local variables as writing to them is very slightly faster
|
||||
// Use local variables as writing to them is very slightly faster.
|
||||
$first = $normal = $last = array();
|
||||
|
||||
// Prepare the list of panes to be rendered
|
||||
// Prepare the list of panes to be rendered.
|
||||
foreach ($panes as $pid => $pane) {
|
||||
if (empty($this->admin)) {
|
||||
// TODO remove in 7.x and ensure the upgrade path weeds out any stragglers; it's been long enough
|
||||
$pane->shown = !empty($pane->shown); // guarantee this field exists.
|
||||
// If this pane is not visible to the user, skip out and do the next one
|
||||
// TODO remove in 7.x and ensure the upgrade path weeds out any stragglers; it's been long enough.
|
||||
$pane->shown = !empty($pane->shown);
|
||||
// Guarantee this field exists.
|
||||
// If this pane is not visible to the user, skip out and do the next one.
|
||||
if (!$pane->shown || !panels_pane_access($pane, $this->display)) {
|
||||
continue;
|
||||
}
|
||||
@@ -250,7 +281,7 @@ class panels_renderer_standard {
|
||||
// If it wants to render first, add it to the $first array. This is used
|
||||
// by panes that need to do some processing before other panes are
|
||||
// rendered.
|
||||
else if (!empty($content_type['render first'])) {
|
||||
elseif (!empty($content_type['render first'])) {
|
||||
$first[$pid] = $pane;
|
||||
}
|
||||
// Otherwise, render it in the normal order.
|
||||
@@ -259,6 +290,10 @@ class panels_renderer_standard {
|
||||
}
|
||||
}
|
||||
$this->prepared['panes'] = $first + $normal + $last;
|
||||
|
||||
// Allow other modules the alter the prepared panes array.
|
||||
drupal_alter('panels_panes_prepared', $this->prepared['panes'], $this);
|
||||
|
||||
return $this->prepared['panes'];
|
||||
}
|
||||
|
||||
@@ -292,6 +327,7 @@ class panels_renderer_standard {
|
||||
* @param array $settings
|
||||
* All known region style settings, including both the top-level display's
|
||||
* settings (if any) and all region-specific settings (if any).
|
||||
*
|
||||
* @return array
|
||||
* An array of regions prepared for rendering.
|
||||
*/
|
||||
@@ -392,6 +428,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;
|
||||
}
|
||||
@@ -403,17 +455,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,9 +507,10 @@ class panels_renderer_standard {
|
||||
case 'standard':
|
||||
drupal_add_css($filename);
|
||||
break;
|
||||
|
||||
case 'inline':
|
||||
$url = base_path() . $filename;
|
||||
$this->prefix .= '<link type="text/css" rel="stylesheet" href="' . $url . '" />'."\n";
|
||||
$this->prefix .= '<link type="text/css" rel="stylesheet" href="' . file_create_url($url) . '" />' . "\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -449,6 +523,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.
|
||||
@@ -469,10 +544,12 @@ class panels_renderer_standard {
|
||||
* an individual pane can be bubbled up to take over the title for the entire
|
||||
* display.
|
||||
*
|
||||
* @param stdClass $pane
|
||||
* A Panels pane object, as loaded from the database.
|
||||
* @param object $pane
|
||||
* 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) {
|
||||
|
||||
@@ -501,7 +578,7 @@ class panels_renderer_standard {
|
||||
}
|
||||
}
|
||||
|
||||
// fallback
|
||||
// Fallback.
|
||||
return theme('panels_pane', array('content' => $content, 'pane' => $pane, 'display' => $this->display));
|
||||
}
|
||||
}
|
||||
@@ -512,8 +589,9 @@ class panels_renderer_standard {
|
||||
* This method retrieves pane content and produces a ready-to-render content
|
||||
* object. It also manages pane-specific caching.
|
||||
*
|
||||
* @param stdClass $pane
|
||||
* @param object $pane
|
||||
* A Panels pane object, as loaded from the database.
|
||||
*
|
||||
* @return stdClass $content
|
||||
* A renderable object, containing a subject, content, etc. Based on the
|
||||
* renderable objects used by the block system.
|
||||
@@ -526,7 +604,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;
|
||||
@@ -540,10 +617,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);
|
||||
@@ -555,14 +628,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;
|
||||
@@ -576,6 +654,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
|
||||
@@ -626,4 +705,5 @@ class panels_renderer_standard {
|
||||
$output = theme($style['render region'], array('display' => $this->display, 'owner_id' => $owner_id, 'panes' => $panes, 'settings' => $style_settings, 'region_id' => $region_id, 'style' => $style));
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Create a simple renderer plugin that renders a layout but the content is
|
||||
* already rendered, not in panes.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
'renderer' => 'panels_renderer_standard',
|
||||
);
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
'schema' => 'panels_layout',
|
||||
'access' => 'administer panels layouts',
|
||||
@@ -20,4 +24,3 @@ $plugin = array(
|
||||
'class' => 'panels_layouts_ui',
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
* @file
|
||||
* Contains the administrative UI for reusable layouts.
|
||||
*/
|
||||
|
||||
class panels_layouts_ui extends ctools_export_ui {
|
||||
var $lipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam egestas congue nibh, vel dictum ante posuere vitae. Cras gravida massa tempor metus eleifend sed elementum tortor scelerisque. Vivamus egestas, tortor quis luctus tristique, sem velit adipiscing risus, et tempus enim felis in massa. Morbi viverra, nisl quis rhoncus imperdiet, turpis massa vestibulum turpis, egestas faucibus nibh metus vel nunc. In hac habitasse platea dictumst. Nunc sit amet nisi quis ipsum tincidunt semper. Donec ac urna enim, et placerat arcu. Morbi eu laoreet justo. Nullam nec velit eu neque mattis pulvinar sed non libero. Sed sed vulputate erat. Fusce sit amet dui nibh.";
|
||||
|
||||
@@ -18,7 +17,7 @@ class panels_layouts_ui extends ctools_export_ui {
|
||||
// Change the item to a tab on the Panels page.
|
||||
$this->plugin['menu']['items']['list callback']['type'] = MENU_LOCAL_TASK;
|
||||
|
||||
// Establish a base for adding plugins
|
||||
// Establish a base for adding plugins.
|
||||
$base = $this->plugin['menu']['items']['add'];
|
||||
// Remove the default 'add' menu item.
|
||||
unset($this->plugin['menu']['items']['add']);
|
||||
@@ -27,7 +26,7 @@ class panels_layouts_ui extends ctools_export_ui {
|
||||
$this->builders = panels_get_layout_builders();
|
||||
asort($this->builders);
|
||||
foreach ($this->builders as $name => $builder) {
|
||||
// Create a new menu item for the builder
|
||||
// Create a new menu item for the builder.
|
||||
$item = $base;
|
||||
$item['title'] = !empty($builder['builder tab title']) ? $builder['builder tab title'] : 'Add ' . $builder['title'];
|
||||
$item['page arguments'][] = $name;
|
||||
@@ -78,6 +77,8 @@ class panels_layouts_ui extends ctools_export_ui {
|
||||
$display->layout_settings = $form_state['item']->settings;
|
||||
$display->cache_key = $cache_key;
|
||||
$display->editing_layout = TRUE;
|
||||
$display->storage_type = 'panels_layouts_ui';
|
||||
$display->storage_id = 'panels_layouts_ui';
|
||||
|
||||
$cache->display = $display;
|
||||
$cache->content_types = $content_types;
|
||||
@@ -125,9 +126,19 @@ class panels_layouts_ui extends ctools_export_ui {
|
||||
|
||||
function edit_form_submit(&$form, &$form_state) {
|
||||
parent::edit_form_submit($form, $form_state);
|
||||
|
||||
// While we short circuited the main submit hook, we need to keep this one.
|
||||
panels_edit_display_settings_form_submit($form, $form_state);
|
||||
$form_state['item']->settings = $form_state['display']->layout_settings;
|
||||
}
|
||||
|
||||
function edit_form_validate(&$form, &$form_state) {
|
||||
parent::edit_form_validate($form, $form_state);
|
||||
|
||||
// While we short circuited the main validate hook, we need to keep this one.
|
||||
panels_edit_display_settings_form_validate($form, $form_state);
|
||||
}
|
||||
|
||||
function list_form(&$form, &$form_state) {
|
||||
ctools_include('plugins', 'panels');
|
||||
$this->builders = panels_get_layout_builders();
|
||||
@@ -183,23 +194,28 @@ class panels_layouts_ui extends ctools_export_ui {
|
||||
}
|
||||
|
||||
function list_build_row($item, &$form_state, $operations) {
|
||||
// Set up sorting
|
||||
// Set up sorting.
|
||||
switch ($form_state['values']['order']) {
|
||||
case 'disabled':
|
||||
$this->sorts[$item->name] = empty($item->disabled) . $item->admin_title;
|
||||
break;
|
||||
|
||||
case 'title':
|
||||
$this->sorts[$item->name] = $item->admin_title;
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
$this->sorts[$item->name] = $item->name;
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
$this->sorts[$item->name] = ($item->category ? $item->category : t('Miscellaneous')) . $item->admin_title;
|
||||
break;
|
||||
|
||||
case 'plugin':
|
||||
$this->sorts[$item->name] = $item->plugin;
|
||||
break;
|
||||
|
||||
case 'storage':
|
||||
$this->sorts[$item->name] = $item->type . $item->admin_title;
|
||||
break;
|
||||
@@ -232,4 +248,5 @@ class panels_layouts_ui extends ctools_export_ui {
|
||||
array('data' => t('Operations'), 'class' => array('ctools-export-ui-operations')),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
#panels-dnd-main .panel-flexible-edit-layout div.panels-display .pane-add-link,
|
||||
.panel-flexible-edit-layout .panel-pane {
|
||||
display: none;
|
||||
@@ -54,8 +53,8 @@
|
||||
float: left;
|
||||
margin-left: -7px;
|
||||
margin-right: -6px;
|
||||
cursor: e-resize; /* in case col-resize isn't supported */
|
||||
cursor: col-resize;
|
||||
cursor: e-resize; /* in case col-resize isn't supported */
|
||||
cursor: col-resize;
|
||||
height: 30px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
@@ -84,4 +83,3 @@
|
||||
#panels-edit-display .helperclass {
|
||||
margin: .5em;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
.panel-flexible .panel-separator {
|
||||
margin: 0 0 1em 0;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Implementation of hook_panels_layouts()
|
||||
* @file
|
||||
* Flexible layout plugin.
|
||||
*/
|
||||
// Plugin definition
|
||||
|
||||
/**
|
||||
* Implementation of hook_panels_layouts().
|
||||
*/
|
||||
// Plugin definition.
|
||||
$plugin = array(
|
||||
'title' => t('Flexible'),
|
||||
'category' => t('Builders'),
|
||||
@@ -18,14 +23,13 @@ $plugin = array(
|
||||
'regions function' => 'panels_flexible_panels',
|
||||
'hook menu' => 'panels_flexible_menu',
|
||||
|
||||
// Reuisable layout Builder specific directives
|
||||
// Reusable layout Builder specific directives.
|
||||
'builder' => TRUE,
|
||||
'builder tab title' => 'Add flexible layout', // menu so translated elsewhere
|
||||
|
||||
'builder tab title' => 'Add flexible layout',
|
||||
'get child' => 'panels_flexible_get_sublayout',
|
||||
'get children' => 'panels_flexible_get_sublayouts',
|
||||
|
||||
// Define ajax callbacks
|
||||
// Define ajax callbacks.
|
||||
'ajax' => array(
|
||||
'settings' => 'panels_ajax_flexible_edit_settings',
|
||||
'add' => 'panels_ajax_flexible_edit_add',
|
||||
@@ -79,9 +83,16 @@ function panels_flexible_get_sublayouts($plugin, $layout_name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Flexible panel settings converter.
|
||||
*
|
||||
* Convert settings from old style to new, or provide defaults for
|
||||
* empty settings.
|
||||
* @param <type> $settings
|
||||
*
|
||||
* @param array $settings
|
||||
* Drupal settings for the layout.
|
||||
*
|
||||
* @return null
|
||||
* Nothing to return.
|
||||
*/
|
||||
function panels_flexible_convert_settings(&$settings, &$layout) {
|
||||
// This indicates that this is a layout that they used the checkbox
|
||||
@@ -99,7 +110,7 @@ function panels_flexible_convert_settings(&$settings, &$layout) {
|
||||
}
|
||||
|
||||
if (empty($settings)) {
|
||||
// set up a default
|
||||
// Set up a default.
|
||||
$settings = array(
|
||||
'items' => array(
|
||||
// The 'canvas' is a special row that does not get rendered
|
||||
@@ -133,7 +144,7 @@ function panels_flexible_convert_settings(&$settings, &$layout) {
|
||||
),
|
||||
);
|
||||
}
|
||||
else if (!isset($settings['items'])) {
|
||||
elseif (!isset($settings['items'])) {
|
||||
// Convert an old style flexible to a new style flexible.
|
||||
$old = $settings;
|
||||
$settings = array();
|
||||
@@ -143,7 +154,7 @@ function panels_flexible_convert_settings(&$settings, &$layout) {
|
||||
'children' => array(),
|
||||
'parent' => NULL,
|
||||
);
|
||||
// add the left sidebar column, row and region if it exists.
|
||||
// Add the left sidebar column, row and region if it exists.
|
||||
if (!empty($old['sidebars']['left'])) {
|
||||
$settings['items']['canvas']['children'][] = 'sidebar-left';
|
||||
$settings['items']['sidebar-left'] = array(
|
||||
@@ -205,28 +216,28 @@ function panels_flexible_convert_settings(&$settings, &$layout) {
|
||||
|
||||
// Add rows and regions.
|
||||
for ($row = 1; $row <= intval($old['rows']); $row++) {
|
||||
// Create entry for the row
|
||||
// Create entry for the row:
|
||||
$settings['items']["row_$row"] = array(
|
||||
'type' => 'row',
|
||||
'contains' => 'region',
|
||||
'children' => array(),
|
||||
'parent' => 'main',
|
||||
);
|
||||
// Add the row to the parent's children
|
||||
// Add the row to the parent's children:
|
||||
$settings['items']['main']['children'][] = "row_$row";
|
||||
|
||||
for ($col = 1; $col <= intval($old["row_$row"]['columns']); $col++) {
|
||||
// Create entry for the region
|
||||
// Create entry for the region:
|
||||
$settings['items']["row_${row}_$col"] = array(
|
||||
'type' => 'region',
|
||||
'width' => $old["row_$row"]["width_$col"],
|
||||
'width_type' => '%',
|
||||
'parent' => "row_$row",
|
||||
);
|
||||
// Add entry for the region to the row's children
|
||||
// Add entry for the region to the row's children:
|
||||
$settings['items']["row_$row"]['children'][] = "row_${row}_$col";
|
||||
|
||||
// Apply the proper title to the region
|
||||
// Apply the proper title to the region:
|
||||
if (!empty($old["row_$row"]['names'][$col - 1])) {
|
||||
$settings['items']["row_${row}_$col"]['title'] = $old["row_$row"]['names'][$col - 1];
|
||||
}
|
||||
@@ -236,7 +247,7 @@ function panels_flexible_convert_settings(&$settings, &$layout) {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isset($settings['canvas'])) {
|
||||
elseif (isset($settings['canvas'])) {
|
||||
// Convert the old 'canvas' to the new canvas row.
|
||||
$settings['items']['canvas'] = array(
|
||||
'type' => 'row',
|
||||
@@ -259,7 +270,7 @@ function panels_flexible_panels($display, $settings, $layout) {
|
||||
if (!isset($item['type'])) {
|
||||
unset($items[$id]);
|
||||
}
|
||||
else if ($item['type'] == 'region') {
|
||||
elseif ($item['type'] == 'region') {
|
||||
$items[$id] = $item['title'];
|
||||
}
|
||||
}
|
||||
@@ -276,13 +287,13 @@ function panels_flexible_panels($display, $settings, $layout) {
|
||||
* @todo Convert the functions to methods and make this properly OO.
|
||||
*/
|
||||
function panels_flexible_create_renderer($admin, $css_id, $content, $settings, &$display, $layout, $handler) {
|
||||
$renderer = new stdClass;
|
||||
$renderer = new stdClass();
|
||||
$renderer->settings = $settings;
|
||||
$renderer->content = $content;
|
||||
$renderer->css_id = $css_id;
|
||||
$renderer->did = &$display->did;
|
||||
if ($admin) {
|
||||
// always scale in admin mode.
|
||||
// Always scale in admin mode.
|
||||
$renderer->scale_base = 99.0;
|
||||
}
|
||||
else {
|
||||
@@ -325,7 +336,6 @@ function panels_flexible_create_renderer($admin, $css_id, $content, $settings, &
|
||||
$renderer->row_separation = !empty($settings['items']['canvas']['row_separation']) ? $settings['items']['canvas']['row_separation'] : '0.5em';
|
||||
|
||||
// Make some appended classes so it's easier to reference them.
|
||||
|
||||
$renderer->base['column'] = $renderer->item_class['column'] . '-' . $renderer->base_class;
|
||||
$renderer->base['row'] = $renderer->item_class['row'] . '-' . $renderer->base_class;
|
||||
$renderer->base['region'] = $renderer->item_class['region'] . '-' . $renderer->base_class;
|
||||
@@ -386,7 +396,7 @@ function theme_panels_flexible($vars) {
|
||||
}
|
||||
|
||||
// Also store the CSS on the display in case the live preview or something
|
||||
// needs it
|
||||
// needs it.
|
||||
$display->add_css = $css;
|
||||
|
||||
$output = "<div class=\"panel-flexible " . $renderer->base['canvas'] . " clearfix\" $renderer->id_str>\n";
|
||||
@@ -394,7 +404,7 @@ function theme_panels_flexible($vars) {
|
||||
|
||||
$output .= panels_flexible_render_items($renderer, $settings['items']['canvas']['children'], $renderer->base['canvas']);
|
||||
|
||||
// Wrap the whole thing up nice and snug
|
||||
// Wrap the whole thing up nice and snug.
|
||||
$output .= "</div>\n</div>\n";
|
||||
|
||||
return $output;
|
||||
@@ -443,7 +453,7 @@ function theme_panels_flexible_admin($vars) {
|
||||
$content = panels_flexible_render_items($renderer, $settings['items']['canvas']['children'], $renderer->base['row'] . '-canvas');
|
||||
$output .= panels_flexible_render_item($renderer, $settings['items']['canvas'], $content, 'canvas', 0, 0, TRUE);
|
||||
|
||||
// Wrap the whole thing up nice and snug
|
||||
// Wrap the whole thing up nice and snug.
|
||||
$output .= "</div>\n</div>\n";
|
||||
|
||||
drupal_add_js($layout['path'] . '/flexible-admin.js');
|
||||
@@ -464,22 +474,35 @@ function panels_flexible_render_items($renderer, $list, $owner_id) {
|
||||
$item = $renderer->settings['items'][$id];
|
||||
$location = isset($renderer->positions[$id]) ? $renderer->positions[$id] : 'middle';
|
||||
|
||||
if ($renderer->admin && $item['type'] != 'row' && $prev ) {
|
||||
if ($renderer->admin && $item['type'] != 'row' && $prev) {
|
||||
$groups[$location] .= panels_flexible_render_splitter($renderer, $prev, $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] : " ";
|
||||
$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] : " ";
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -600,7 +623,7 @@ function panels_flexible_render_splitter($renderer, $left_id, $right_id) {
|
||||
$output = '<div tabindex="0"
|
||||
class="panels-flexible-splitter flexible-splitter-for-' . $left_class . '">';
|
||||
|
||||
// Name the left object
|
||||
// Name the left object:
|
||||
$output .= '<span class="panels-flexible-splitter-left">';
|
||||
$output .= '.' . $left_class;
|
||||
$output .= '</span>';
|
||||
@@ -621,7 +644,7 @@ function panels_flexible_render_splitter($renderer, $left_id, $right_id) {
|
||||
$output .= $left['width_type'];
|
||||
$output .= '</span>';
|
||||
|
||||
// Name the right object
|
||||
// Name the right object:
|
||||
$output .= '<span class="panels-flexible-splitter-right">';
|
||||
$output .= '.' . $right_class;
|
||||
$output .= '</span>';
|
||||
@@ -666,7 +689,7 @@ function panels_flexible_render_item_links($renderer, $id, $item) {
|
||||
$add2 = t('Add row to bottom');
|
||||
}
|
||||
}
|
||||
else if ($item['type'] == 'row') {
|
||||
elseif ($item['type'] == 'row') {
|
||||
if ($id == 'canvas') {
|
||||
$title = t('Canvas');
|
||||
$settings = t('Canvas settings');
|
||||
@@ -686,7 +709,7 @@ function panels_flexible_render_item_links($renderer, $id, $item) {
|
||||
$add2 = $item['contains'] == 'region' ? t('Add region to right') : t('Add column to right');
|
||||
}
|
||||
}
|
||||
else if ($item['type'] == 'region') {
|
||||
elseif ($item['type'] == 'region') {
|
||||
$title = t('Region');
|
||||
$settings = t('Region settings');
|
||||
$remove = t('Remove region');
|
||||
@@ -746,48 +769,48 @@ function panels_flexible_render_css($renderer) {
|
||||
function panels_flexible_render_css_group($renderer, $list, $owner_id, $type, $id) {
|
||||
$css = array();
|
||||
|
||||
// Start off with some generic CSS to properly pad regions
|
||||
$css['.' . $renderer->item_class['region']] = array(
|
||||
// Start off with some generic CSS to properly pad regions.
|
||||
$css[$owner_id . ' .' . $renderer->item_class['region']] = array(
|
||||
'padding' => '0',
|
||||
);
|
||||
|
||||
$css['.' . $renderer->item_class['region'] . '-inside'] = array(
|
||||
$css[$owner_id . ' .' . $renderer->item_class['region'] . '-inside'] = array(
|
||||
'padding-right' => $renderer->region_separation,
|
||||
'padding-left' => $renderer->region_separation,
|
||||
);
|
||||
|
||||
$css['.' . $renderer->item_class['region'] . '-inside-first'] = array(
|
||||
$css[$owner_id . ' .' . $renderer->item_class['region'] . '-inside-first'] = array(
|
||||
'padding-left' => '0',
|
||||
);
|
||||
|
||||
$css['.' . $renderer->item_class['region'] . '-inside-last'] = array(
|
||||
$css[$owner_id . ' .' . $renderer->item_class['region'] . '-inside-last'] = array(
|
||||
'padding-right' => '0',
|
||||
);
|
||||
|
||||
$css['.' . $renderer->item_class['column']] = array(
|
||||
$css[$owner_id . ' .' . $renderer->item_class['column']] = array(
|
||||
'padding' => '0',
|
||||
);
|
||||
|
||||
$css['.' . $renderer->item_class['column'] . '-inside'] = array(
|
||||
$css[$owner_id . ' .' . $renderer->item_class['column'] . '-inside'] = array(
|
||||
'padding-right' => $renderer->column_separation,
|
||||
'padding-left' => $renderer->column_separation,
|
||||
);
|
||||
|
||||
$css['.' . $renderer->item_class['column'] . '-inside-first'] = array(
|
||||
$css[$owner_id . ' .' . $renderer->item_class['column'] . '-inside-first'] = array(
|
||||
'padding-left' => '0',
|
||||
);
|
||||
|
||||
$css['.' . $renderer->item_class['column'] . '-inside-last'] = array(
|
||||
$css[$owner_id . ' .' . $renderer->item_class['column'] . '-inside-last'] = array(
|
||||
'padding-right' => '0',
|
||||
);
|
||||
|
||||
// And properly pad rows too
|
||||
$css['.' . $renderer->item_class['row']] = array(
|
||||
// And properly pad rows too:
|
||||
$css[$owner_id . ' .' . $renderer->item_class['row']] = array(
|
||||
'padding' => '0 0 ' . $renderer->row_separation . ' 0',
|
||||
'margin' => '0',
|
||||
);
|
||||
|
||||
$css['.' . $renderer->item_class['row'] . '-last'] = array(
|
||||
$css[$owner_id . ' .' . $renderer->item_class['row'] . '-last'] = array(
|
||||
'padding-bottom' => '0',
|
||||
);
|
||||
|
||||
@@ -807,7 +830,6 @@ function panels_flexible_get_css_group(&$css, $renderer, $list, $owner_id, $type
|
||||
if ($type != 'row') {
|
||||
// Go through our items and break up into right/center/right groups so we
|
||||
// can figure out our offsets.
|
||||
|
||||
// right == any items on the right that are 'fixed'.
|
||||
// middle == all fluid items.
|
||||
// right == any items on the right that are 'fixed'.
|
||||
@@ -816,7 +838,7 @@ function panels_flexible_get_css_group(&$css, $renderer, $list, $owner_id, $type
|
||||
$current = 'left';
|
||||
foreach ($list as $id) {
|
||||
if ($renderer->settings['items'][$id]['width_type'] == 'px') {
|
||||
// fixed
|
||||
// Fixed:
|
||||
if ($current == 'left') {
|
||||
$left[] = $id;
|
||||
$renderer->positions[$id] = 'left';
|
||||
@@ -830,14 +852,14 @@ function panels_flexible_get_css_group(&$css, $renderer, $list, $owner_id, $type
|
||||
}
|
||||
}
|
||||
else {
|
||||
// fluid
|
||||
// Fluid:
|
||||
if ($current != 'right') {
|
||||
$current = 'middle';
|
||||
$middle[] = $id;
|
||||
$renderer->positions[$id] = 'middle';
|
||||
$middle_total += $renderer->settings['items'][$id]['width'];
|
||||
}
|
||||
// fall through: if current is 'right' and we ran into a 'fluid' then
|
||||
// Fall through: if current is 'right' and we ran into a 'fluid' then
|
||||
// it gets *dropped* because that is invalid.
|
||||
}
|
||||
}
|
||||
@@ -892,7 +914,7 @@ function panels_flexible_get_css_group(&$css, $renderer, $list, $owner_id, $type
|
||||
$css["$owner_id-inside"]['padding-left'] = '0px';
|
||||
if ($renderer->admin || count($middle)) {
|
||||
$css["$owner_id-middle"]['margin-left'] = $left_total . 'px';
|
||||
// IE hack
|
||||
// IE hack!
|
||||
$css["* html $owner_id-left"]['left'] = $left_total . "px";
|
||||
// Make this one very specific to the admin CSS so that preview
|
||||
// does not stomp it.
|
||||
@@ -901,7 +923,7 @@ function panels_flexible_get_css_group(&$css, $renderer, $list, $owner_id, $type
|
||||
else {
|
||||
$css["$owner_id-inside"]['margin-left'] = '-' . $left_total . 'px';
|
||||
$css["$owner_id-inside"]['padding-left'] = $left_total . 'px';
|
||||
// IE hack
|
||||
// IE hack!
|
||||
$css["* html $owner_id-inside"]['left'] = $left_total . "px";
|
||||
}
|
||||
}
|
||||
@@ -947,8 +969,10 @@ function panels_flexible_get_css_group(&$css, $renderer, $list, $owner_id, $type
|
||||
/**
|
||||
* AJAX responder to edit flexible settings for an item.
|
||||
*
|
||||
* $handler object
|
||||
* @param object $handler
|
||||
* The display renderer handler object.
|
||||
* @param mixed $id
|
||||
* Id for the panel.
|
||||
*/
|
||||
function panels_ajax_flexible_edit_settings($handler, $id) {
|
||||
$settings = &$handler->display->layout_settings;
|
||||
@@ -965,11 +989,11 @@ function panels_ajax_flexible_edit_settings($handler, $id) {
|
||||
$siblings = $settings['items'][$item['parent']]['children'];
|
||||
}
|
||||
|
||||
|
||||
switch ($item['type']) {
|
||||
case 'column':
|
||||
$title = t('Configure column');
|
||||
break;
|
||||
|
||||
case 'row':
|
||||
if ($id == 'canvas') {
|
||||
$title = t('Configure canvas');
|
||||
@@ -978,6 +1002,7 @@ function panels_ajax_flexible_edit_settings($handler, $id) {
|
||||
$title = t('Configure row');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'region':
|
||||
$title = t('Configure region');
|
||||
break;
|
||||
@@ -1015,9 +1040,9 @@ function panels_ajax_flexible_edit_settings($handler, $id) {
|
||||
$output[] = ajax_command_replace('.flexible-links-' . $id,
|
||||
panels_flexible_render_item_links($renderer, $id, $item));
|
||||
|
||||
// If editing the canvas, reset the CSS width
|
||||
// If editing the canvas, reset the CSS width.
|
||||
if ($id == 'canvas') {
|
||||
// update canvas CSS.
|
||||
// Update canvas CSS.
|
||||
$css = array(
|
||||
'.' . $renderer->item_class['column'] . '-inside' => array(
|
||||
'padding-left' => $renderer->column_separation,
|
||||
@@ -1050,9 +1075,6 @@ function panels_ajax_flexible_edit_settings($handler, $id) {
|
||||
|
||||
/**
|
||||
* Configure a row, column or region on the flexible page.
|
||||
*
|
||||
* @param <type> $form_state
|
||||
* @return <type>
|
||||
*/
|
||||
function panels_flexible_config_item_form($form, &$form_state) {
|
||||
$display = &$form_state['display'];
|
||||
@@ -1151,8 +1173,9 @@ function panels_flexible_config_item_form($form, &$form_state) {
|
||||
if ($sibling == $id) {
|
||||
$current = 'right';
|
||||
}
|
||||
else if ($settings['items'][$sibling]['width_type'] == '%') {
|
||||
$$current = TRUE; // Indirection.
|
||||
elseif ($settings['items'][$sibling]['width_type'] == '%') {
|
||||
// Indirection.
|
||||
$$current = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1186,6 +1209,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'),
|
||||
@@ -1217,12 +1246,13 @@ function panels_flexible_config_item_form_submit(&$form, &$form_state) {
|
||||
$item['region_separation'] = $form_state['values']['region_separation'];
|
||||
$item['row_separation'] = $form_state['values']['row_separation'];
|
||||
}
|
||||
else if ($item['type'] != 'row') {
|
||||
elseif ($item['type'] != 'row') {
|
||||
$item['width_type'] = $form_state['values']['width_type'];
|
||||
}
|
||||
else {
|
||||
$item['contains'] = $form_state['values']['contains'];
|
||||
}
|
||||
$item['hide_empty'] = $form_state['values']['hide_empty'];
|
||||
|
||||
}
|
||||
|
||||
@@ -1252,6 +1282,7 @@ function panels_ajax_flexible_edit_add($handler, $id, $location = 'left') {
|
||||
'parent' => $id,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'row':
|
||||
switch ($parent['contains']) {
|
||||
case 'region':
|
||||
@@ -1264,6 +1295,7 @@ function panels_ajax_flexible_edit_add($handler, $id, $location = 'left') {
|
||||
'parent' => $id,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'column':
|
||||
$title = $location == 'left' ? t('Add column to left') : t('Add column to right');
|
||||
$item = array(
|
||||
@@ -1277,6 +1309,7 @@ function panels_ajax_flexible_edit_add($handler, $id, $location = 'left') {
|
||||
}
|
||||
// Create the new item with defaults.
|
||||
break;
|
||||
|
||||
case 'region':
|
||||
// Cannot add items to regions.
|
||||
break;
|
||||
@@ -1326,8 +1359,8 @@ function panels_ajax_flexible_edit_add($handler, $id, $location = 'left') {
|
||||
|
||||
}
|
||||
|
||||
// render the item
|
||||
$parent_class = $renderer->base[$parent['type']] . '-' . $id;
|
||||
// Render the item.
|
||||
$parent_class = $renderer->base[$parent['type']] . '-' . $id;
|
||||
$item_output = panels_flexible_render_item($renderer, $item, $content, $form_state['key'], 0, 0, $item['type'] == 'row');
|
||||
|
||||
// Get all the CSS necessary for the entire row (as width adjustments may
|
||||
@@ -1346,22 +1379,24 @@ function panels_ajax_flexible_edit_add($handler, $id, $location = 'left') {
|
||||
$item_output .= panels_flexible_render_splitter($renderer, $form_state['key'], $form_state['sibling']);
|
||||
$output[] = ajax_command_prepend('#panels-dnd-main .' . $parent_class . '-left', $item_output);
|
||||
}
|
||||
else if ($location == 'right') {
|
||||
elseif ($location == 'right') {
|
||||
// If we are adding to the right side of the left box, there is
|
||||
// a splitter that we have to remove; then we add our box normally,
|
||||
// and then add a new splitter for just our guy.
|
||||
$output[] = ajax_command_remove('panels-flexible-splitter-for-' . $renderer->base[$item['type']] . '-' . $form_state['key']);
|
||||
$item_output = panels_flexible_render_splitter($renderer, $form_state['sibling'], $form_state['key']) . $item_output;
|
||||
$item_output = panels_flexible_render_splitter($renderer, $form_state['sibling'], $form_state['key']) . $item_output;
|
||||
$item_output .= panels_flexible_render_splitter($renderer, $form_state['key'], NULL);
|
||||
$output[] = ajax_command_append('#panels-dnd-main .' . $parent_class . '-left', $item_output);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'right':
|
||||
if (!empty($form_state['sibling'])) {
|
||||
$item_output = panels_flexible_render_splitter($renderer, $form_state['sibling'], $form_state['key']) . $item_output;
|
||||
$item_output = panels_flexible_render_splitter($renderer, $form_state['sibling'], $form_state['key']) . $item_output;
|
||||
}
|
||||
$output[] = ajax_command_append('#panels-dnd-main .' . $parent_class . '-right', $item_output);
|
||||
break;
|
||||
|
||||
case 'middle':
|
||||
if ($location == 'left') {
|
||||
if (!empty($form_state['sibling'])) {
|
||||
@@ -1371,7 +1406,7 @@ function panels_ajax_flexible_edit_add($handler, $id, $location = 'left') {
|
||||
}
|
||||
else {
|
||||
if (!empty($form_state['sibling'])) {
|
||||
$item_output = panels_flexible_render_splitter($renderer, $form_state['sibling'], $form_state['key']) . $item_output;
|
||||
$item_output = panels_flexible_render_splitter($renderer, $form_state['sibling'], $form_state['key']) . $item_output;
|
||||
}
|
||||
$output[] = ajax_command_append('#panels-dnd-main .' . $parent_class . '-middle', $item_output);
|
||||
}
|
||||
@@ -1411,8 +1446,6 @@ function panels_ajax_flexible_edit_add($handler, $id, $location = 'left') {
|
||||
}
|
||||
/**
|
||||
* Form to add a row, column or region to a flexible layout.
|
||||
* @param <type> $form_state
|
||||
* @return <type>
|
||||
*/
|
||||
function panels_flexible_add_item_form($form, &$form_state) {
|
||||
$display = &$form_state['display'];
|
||||
@@ -1486,6 +1519,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,8 +1555,10 @@ 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
|
||||
// Derive the region key from the title.
|
||||
$key = preg_replace("/[^a-z0-9]/", '_', drupal_strtolower($item['title']));
|
||||
while (isset($settings['items'][$key])) {
|
||||
$key .= '_';
|
||||
@@ -1543,7 +1584,7 @@ function panels_flexible_add_item_form_submit(&$form, &$form_state) {
|
||||
// If there is no sibling, or the sibling is of a different type,
|
||||
// the default 100 will work for either fixed or fluid.
|
||||
if ($form_state['sibling'] && $settings['items'][$form_state['sibling']]['width_type'] == $item['width_type']) {
|
||||
// steal half of the sibling's space.
|
||||
// Steal half of the sibling's space.
|
||||
$width = $settings['items'][$form_state['sibling']]['width'] / 2;
|
||||
$settings['items'][$form_state['sibling']]['width'] = $width;
|
||||
$item['width'] = $width;
|
||||
@@ -1561,8 +1602,9 @@ function panels_flexible_add_item_form_submit(&$form, &$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX responder to remove an existing row, column or region from a flexible
|
||||
* layout.
|
||||
* Panels remove AJAX responder.
|
||||
*
|
||||
* Removes an existing row, column or region from a flexible layout.
|
||||
*/
|
||||
function panels_ajax_flexible_edit_remove($handler, $id) {
|
||||
$settings = &$handler->display->layout_settings;
|
||||
@@ -1576,10 +1618,8 @@ function panels_ajax_flexible_edit_remove($handler, $id) {
|
||||
$css_id = isset($handler->display->css_id) ? $handler->display->css_id : '';
|
||||
// Create a renderer object so we can render our new stuff.
|
||||
$renderer = panels_flexible_create_renderer(TRUE, $css_id, array(), $settings, $handler->display, $handler->plugins['layout'], $handler);
|
||||
|
||||
|
||||
$siblings = &$settings['items'][$item['parent']]['children'];
|
||||
$parent_class = '.' . $renderer->base[$settings['items'][$item['parent']]['type']] . '-' . $item['parent'];
|
||||
$parent_class = '.' . $renderer->base[$settings['items'][$item['parent']]['type']] . '-' . $item['parent'];
|
||||
|
||||
// Find the offset of our array. This will also be the key because
|
||||
// this is a simple array.
|
||||
@@ -1601,7 +1641,7 @@ function panels_ajax_flexible_edit_remove($handler, $id) {
|
||||
$settings['items'][$next]['width'] += $item['width'];
|
||||
}
|
||||
// If that failed, try the previous one.
|
||||
else if (isset($prev) && $settings['items'][$prev]['width_type'] == '%') {
|
||||
elseif (isset($prev) && $settings['items'][$prev]['width_type'] == '%') {
|
||||
$settings['items'][$prev]['width'] += $item['width'];
|
||||
}
|
||||
}
|
||||
@@ -1661,8 +1701,7 @@ function panels_ajax_flexible_edit_remove($handler, $id) {
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX responder to store resize information when the user adjusts the
|
||||
* splitter.
|
||||
* AJAX responder to store resize information when the user adjusts splitter.
|
||||
*/
|
||||
function panels_ajax_flexible_edit_resize($handler) {
|
||||
ctools_include('ajax');
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
.panel-1col {
|
||||
/* overflow: hidden; */
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* implementation of hook_panels_layouts()
|
||||
* @file
|
||||
* Implementation of hook_panels_layouts().
|
||||
*/
|
||||
// Plugin definition
|
||||
// Plugin definition.
|
||||
$plugin = array(
|
||||
'title' => t('Single column'),
|
||||
'category' => t('Columns: 1'),
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* $content['middle']: The only panel in the layout.
|
||||
*/
|
||||
?>
|
||||
<div class="panel-display panel-1col clearfix" <?php if (!empty($css_id)) { print "id=\"$css_id\""; } ?>>
|
||||
<div class="panel-display panel-1col clearfix" <?php if (!empty($css_id)) {print "id=\"$css_id\"";} ?>>
|
||||
<div class="panel-panel panel-col">
|
||||
<div><?php print $content['middle']; ?></div>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* - $content['right']: Content in the right column.
|
||||
*/
|
||||
?>
|
||||
<div class="panel-display panel-3col clearfix" <?php if (!empty($css_id)) { print "id=\"$css_id\""; } ?>>
|
||||
<div class="panel-display panel-3col clearfix" <?php if (!empty($css_id)) {print "id=\"$css_id\"";} ?>>
|
||||
<div class="panel-panel panel-col-first">
|
||||
<div class="inside"><?php print $content['left']; ?></div>
|
||||
</div>
|
||||
|
||||
@@ -1,32 +1,31 @@
|
||||
|
||||
.panel-3col {
|
||||
.panel-3col {
|
||||
/* overflow: hidden; */
|
||||
}
|
||||
|
||||
.panel-3col .panel-col-first {
|
||||
float: left;
|
||||
width: 25%;
|
||||
.panel-3col .panel-col-first {
|
||||
float: left;
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.panel-3col .panel-col-first .inside {
|
||||
.panel-3col .panel-col-first .inside {
|
||||
margin: 0 .5em 1em 0;
|
||||
}
|
||||
|
||||
.panel-3col .panel-col {
|
||||
float: left;
|
||||
width: 50%;
|
||||
.panel-3col .panel-col {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.panel-3col .panel-col .inside {
|
||||
.panel-3col .panel-col .inside {
|
||||
margin: 0 .5em 1em .5em;
|
||||
}
|
||||
|
||||
.panel-3col .panel-col-last {
|
||||
float: left;
|
||||
width: 25%;
|
||||
.panel-3col .panel-col-last {
|
||||
float: left;
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.panel-3col .panel-col-last .inside {
|
||||
.panel-3col .panel-col-last .inside {
|
||||
margin: 0 0 1em .5em;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* implementation of hook_panels_layouts
|
||||
* @file
|
||||
* Implementation of hook_panels_layouts.
|
||||
*/
|
||||
// Plugin definition
|
||||
// Plugin definition.
|
||||
$plugin = array(
|
||||
'title' => t('Three column 25/50/25'),
|
||||
'category' => t('Columns: 3'),
|
||||
@@ -14,7 +15,6 @@ $plugin = array(
|
||||
'regions' => array(
|
||||
'left' => t('Left side'),
|
||||
'middle' => t('Middle column'),
|
||||
'right' => t('Right side')
|
||||
'right' => t('Right side'),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* - $content['bottom']: Content in the bottom row.
|
||||
*/
|
||||
?>
|
||||
<div class="panel-display panel-3col-stacked clearfix" <?php if (!empty($css_id)) { print "id=\"$css_id\""; } ?>>
|
||||
<div class="panel-display panel-3col-stacked clearfix" <?php if (!empty($css_id)) {print "id=\"$css_id\"";} ?>>
|
||||
<?php if ($content['top']): ?>
|
||||
<div class="panel-panel panel-col-top">
|
||||
<div class="inside"><?php print $content['top']; ?></div>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
|
||||
.panel-3col-stacked {
|
||||
.panel-3col-stacked {
|
||||
/* overflow: hidden; */
|
||||
}
|
||||
|
||||
.panel-3col-stacked .panel-col-top,
|
||||
.panel-3col-stacked .panel-col-bottom {
|
||||
width: 100%;
|
||||
.panel-3col-stacked .panel-col-bottom {
|
||||
width: 100%;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
@@ -13,30 +12,30 @@
|
||||
margin-bottom: .5em;
|
||||
}
|
||||
|
||||
.panel-3col-stacked .panel-col-first {
|
||||
float: left;
|
||||
width: 25%;
|
||||
.panel-3col-stacked .panel-col-first {
|
||||
float: left;
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.panel-3col-stacked .panel-col .inside {
|
||||
.panel-3col-stacked .panel-col-first .inside {
|
||||
margin: 0 .5em 1em .5em;
|
||||
}
|
||||
|
||||
.panel-3col-stacked .panel-col {
|
||||
float: left;
|
||||
width: 50%;
|
||||
.panel-3col-stacked .panel-col {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.panel-3col-stacked .panel-col .inside {
|
||||
.panel-3col-stacked .panel-col .inside {
|
||||
margin: 0 .5em 1em .5em;
|
||||
}
|
||||
|
||||
.panel-3col-stacked .panel-col-last {
|
||||
float: left;
|
||||
width: 25%;
|
||||
.panel-3col-stacked .panel-col-last {
|
||||
float: left;
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.panel-3col-stacked .panel-col-last .inside {
|
||||
.panel-3col-stacked .panel-col-last .inside {
|
||||
margin: 0 0 1em .5em;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
// Plugin definition
|
||||
/**
|
||||
* @file
|
||||
* Plugin definition.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t('Three column 25/50/25 stacked'),
|
||||
'category' => t('Columns: 3'),
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
?>
|
||||
|
||||
<div class="panel-display panel-3col-33 clearfix" <?php if (!empty($css_id)) { print "id=\"$css_id\""; } ?>>
|
||||
<div class="panel-display panel-3col-33 clearfix" <?php if (!empty($css_id)) {print "id=\"$css_id\"";} ?>>
|
||||
<div class="panel-panel panel-col-first">
|
||||
<div class="inside"><?php print $content['left']; ?></div>
|
||||
</div>
|
||||
|
||||
@@ -1,32 +1,31 @@
|
||||
|
||||
.panel-3col-33 {
|
||||
.panel-3col-33 {
|
||||
/* overflow: hidden; */
|
||||
}
|
||||
|
||||
.panel-3col-33 .panel-col-first {
|
||||
float: left;
|
||||
width: 33%;
|
||||
.panel-3col-33 .panel-col-first {
|
||||
float: left;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
.panel-3col-33 .panel-col-first .inside {
|
||||
.panel-3col-33 .panel-col-first .inside {
|
||||
margin: 0 .5em 1em 0;
|
||||
}
|
||||
|
||||
.panel-3col-33 .panel-col {
|
||||
float: left;
|
||||
width: 33%;
|
||||
.panel-3col-33 .panel-col {
|
||||
float: left;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
.panel-3col-33 .panel-col .inside {
|
||||
.panel-3col-33 .panel-col .inside {
|
||||
margin: 0 .5em 1em .5em;
|
||||
}
|
||||
|
||||
.panel-3col-33 .panel-col-last {
|
||||
float: left;
|
||||
width: 33%;
|
||||
.panel-3col-33 .panel-col-last {
|
||||
float: left;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
.panel-3col-33 .panel-col-last .inside {
|
||||
.panel-3col-33 .panel-col-last .inside {
|
||||
margin: 0 0 1em .5em;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
// Plugin definition
|
||||
/**
|
||||
* @file
|
||||
* Plugin definition.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t('Three column 33/34/33'),
|
||||
'category' => t('Columns: 3'),
|
||||
@@ -10,6 +13,6 @@ $plugin = array(
|
||||
'regions' => array(
|
||||
'left' => t('Left side'),
|
||||
'middle' => t('Middle column'),
|
||||
'right' => t('Right side')
|
||||
),
|
||||
'right' => t('Right side'),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* - $content['bottom']: Content in the bottom row.
|
||||
*/
|
||||
?>
|
||||
<div class="panel-display panel-3col-33-stacked clearfix" <?php if (!empty($css_id)) { print "id=\"$css_id\""; } ?>>
|
||||
<div class="panel-display panel-3col-33-stacked clearfix" <?php if (!empty($css_id)) {print "id=\"$css_id\"";} ?>>
|
||||
<?php if ($content['top']): ?>
|
||||
<div class="panel-panel panel-col-top">
|
||||
<div class="inside"><?php print $content['top']; ?></div>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
|
||||
.panel-3col-33-stacked {
|
||||
.panel-3col-33-stacked {
|
||||
/* overflow: hidden; */
|
||||
}
|
||||
|
||||
.panel-3col-33-stacked .panel-col-top,
|
||||
.panel-3col-33-stacked .panel-col-bottom {
|
||||
width: 100%;
|
||||
.panel-3col-33-stacked .panel-col-bottom {
|
||||
width: 100%;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
@@ -13,30 +12,30 @@
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.panel-3col-33-stacked .panel-col-first {
|
||||
float: left;
|
||||
width: 33%;
|
||||
.panel-3col-33-stacked .panel-col-first {
|
||||
float: left;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
.panel-3col-33-stacked .panel-col-first .inside {
|
||||
.panel-3col-33-stacked .panel-col-first .inside {
|
||||
margin: 0 .5em 1em 0;
|
||||
}
|
||||
|
||||
.panel-3col-33-stacked .panel-col {
|
||||
float: left;
|
||||
width: 33%;
|
||||
.panel-3col-33-stacked .panel-col {
|
||||
float: left;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
.panel-3col-33-stacked .panel-col .inside {
|
||||
.panel-3col-33-stacked .panel-col .inside {
|
||||
margin: 0 .5em 1em .5em;
|
||||
}
|
||||
|
||||
.panel-3col-33-stacked .panel-col-last {
|
||||
float: left;
|
||||
width: 33%;
|
||||
.panel-3col-33-stacked .panel-col-last {
|
||||
float: left;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
.panel-3col-33-stacked .panel-col-last .inside {
|
||||
.panel-3col-33-stacked .panel-col-last .inside {
|
||||
margin: 0 0 1em .5em;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
// Plugin definition
|
||||
/**
|
||||
* @file
|
||||
* Plugin definition.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t('Three column 33/34/33 stacked'),
|
||||
'category' => t('Columns: 3'),
|
||||
@@ -12,6 +15,6 @@ $plugin = array(
|
||||
'left' => t('Left side'),
|
||||
'middle' => t('Middle column'),
|
||||
'right' => t('Right side'),
|
||||
'bottom' => t('Bottom')
|
||||
'bottom' => t('Bottom'),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* - $content['right']: Content in the right column.
|
||||
*/
|
||||
?>
|
||||
<div class="panel-display panel-2col clearfix" <?php if (!empty($css_id)) { print "id=\"$css_id\""; } ?>>
|
||||
<div class="panel-display panel-2col clearfix" <?php if (!empty($css_id)) {print "id=\"$css_id\"";} ?>>
|
||||
<div class="panel-panel panel-col-first">
|
||||
<div class="inside"><?php print $content['left']; ?></div>
|
||||
</div>
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
|
||||
.panel-2col {
|
||||
.panel-2col {
|
||||
/* overflow: hidden; */
|
||||
}
|
||||
|
||||
.panel-2col .panel-col-first {
|
||||
float: left;
|
||||
width: 50%;
|
||||
.panel-2col .panel-col-first {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
* html .panel-2col .panel-col-first {
|
||||
width: 49.9%;
|
||||
}
|
||||
|
||||
.panel-2col .panel-col-first .inside {
|
||||
.panel-2col .panel-col-first .inside {
|
||||
margin: 0 .5em 1em 0;
|
||||
}
|
||||
|
||||
.panel-2col .panel-col-last {
|
||||
float: left;
|
||||
width: 50%;
|
||||
.panel-2col .panel-col-last {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
* html .panel-2col .panel-col-last {
|
||||
width: 49.9%;
|
||||
}
|
||||
|
||||
.panel-2col .panel-col-last .inside {
|
||||
.panel-2col .panel-col-last .inside {
|
||||
margin: 0 0 1em .5em;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
// Plugin definition
|
||||
/**
|
||||
* @file
|
||||
* Plugin definition.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t('Two column'),
|
||||
'category' => t('Columns: 2'),
|
||||
@@ -9,6 +12,6 @@ $plugin = array(
|
||||
'css' => 'twocol.css',
|
||||
'regions' => array(
|
||||
'left' => t('Left side'),
|
||||
'right' => t('Right side')
|
||||
'right' => t('Right side'),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* - $content['bottom']: Content in the bottom row.
|
||||
*/
|
||||
?>
|
||||
<div class="panel-display panel-2col-bricks clearfix" <?php if (!empty($css_id)) { print "id=\"$css_id\""; } ?>>
|
||||
<div class="panel-display panel-2col-bricks clearfix" <?php if (!empty($css_id)) {print "id=\"$css_id\"";} ?>>
|
||||
<div class="panel-panel panel-col-top">
|
||||
<div class="inside"><?php print $content['top']; ?></div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
.panel-2col-bricks {
|
||||
.panel-2col-bricks {
|
||||
/* overflow: hidden; */
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
@@ -7,8 +6,8 @@
|
||||
|
||||
.panel-2col-bricks .panel-col-top,
|
||||
.panel-2col-bricks .panel-col-middle,
|
||||
.panel-2col-bricks .panel-col-bottom {
|
||||
width: 99.9%;
|
||||
.panel-2col-bricks .panel-col-bottom {
|
||||
width: 99.9%;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
@@ -17,27 +16,27 @@
|
||||
margin-bottom: .5em;
|
||||
}
|
||||
|
||||
.panel-2col-bricks .panel-col-first {
|
||||
float: left;
|
||||
width: 50%;
|
||||
.panel-2col-bricks .panel-col-first {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
* html .panel-2col-bricks .panel-col-first {
|
||||
width: 49.9%;
|
||||
}
|
||||
|
||||
.panel-2col-bricks .panel-col-first .inside {
|
||||
.panel-2col-bricks .panel-col-first .inside {
|
||||
margin: 0 .5em .5em 0;
|
||||
}
|
||||
|
||||
.panel-2col-bricks .panel-col-last {
|
||||
float: left;
|
||||
width: 50%;
|
||||
.panel-2col-bricks .panel-col-last {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
* html .panel-2col-bricks .panel-col-last {
|
||||
width: 49.9%;
|
||||
}
|
||||
|
||||
.panel-2col-bricks .panel-col-last .inside {
|
||||
.panel-2col-bricks .panel-col-last .inside {
|
||||
margin: 0 0 .5em .5em;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Implementation for the two column bricked layout
|
||||
* Implementation for the two column bricked layout.
|
||||
*/
|
||||
|
||||
// Plugin definition
|
||||
// Plugin definition.
|
||||
$plugin = array(
|
||||
'title' => t('Two column bricks'),
|
||||
'category' => t('Columns: 2'),
|
||||
@@ -22,4 +22,3 @@ $plugin = array(
|
||||
'bottom' => t('Bottom'),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* - $content['bottom']: Content in the bottom row.
|
||||
*/
|
||||
?>
|
||||
<div class="panel-2col-stacked clearfix panel-display" <?php if (!empty($css_id)) { print "id=\"$css_id\""; } ?>>
|
||||
<div class="panel-2col-stacked clearfix panel-display" <?php if (!empty($css_id)) {print "id=\"$css_id\"";} ?>>
|
||||
<?php if ($content['top']): ?>
|
||||
<div class="panel-col-top panel-panel">
|
||||
<div class="inside"><?php print $content['top']; ?></div>
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
|
||||
.panel-2col-stacked {
|
||||
.panel-2col-stacked {
|
||||
/* overflow: hidden; */
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.panel-2col-stacked .panel-col-top,
|
||||
.panel-2col-stacked .panel-col-bottom {
|
||||
width: 99.9%;
|
||||
.panel-2col-stacked .panel-col-bottom {
|
||||
width: 99.9%;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
@@ -15,24 +14,24 @@
|
||||
margin-bottom: .5em;
|
||||
}
|
||||
|
||||
.panel-2col-stacked .panel-col-first {
|
||||
float: left;
|
||||
width: 50%;
|
||||
.panel-2col-stacked .panel-col-first {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
* html .panel-2col-stacked .panel-col-first {
|
||||
width: 49.9%;
|
||||
}
|
||||
|
||||
.panel-2col-stacked .panel-col-first .inside {
|
||||
.panel-2col-stacked .panel-col-first .inside {
|
||||
margin: 0 .5em 1em 0;
|
||||
}
|
||||
|
||||
.panel-2col-stacked .panel-col-last {
|
||||
float: left;
|
||||
width: 49.9%;
|
||||
.panel-2col-stacked .panel-col-last {
|
||||
float: left;
|
||||
width: 49.9%;
|
||||
}
|
||||
|
||||
.panel-2col-stacked .panel-col-last .inside {
|
||||
.panel-2col-stacked .panel-col-last .inside {
|
||||
margin: 0 0 1em .5em;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
// Plugin definition
|
||||
/**
|
||||
* @file
|
||||
* Plugin definition.
|
||||
*/
|
||||
$plugin = array(
|
||||
'title' => t('Two column stacked'),
|
||||
'category' => t('Columns: 2'),
|
||||
@@ -11,6 +14,6 @@ $plugin = array(
|
||||
'top' => t('Top'),
|
||||
'left' => t('Left side'),
|
||||
'right' => t('Right side'),
|
||||
'bottom' => t('Bottom')
|
||||
'bottom' => t('Bottom'),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,7 +103,7 @@ function panels_landing_page_basic($form, &$form_state) {
|
||||
'#default_value' => $cache->admin_description,
|
||||
);
|
||||
|
||||
// path
|
||||
// Path.
|
||||
$form['path'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Path'),
|
||||
@@ -134,7 +136,7 @@ function panels_landing_page_basic($form, &$form_state) {
|
||||
'#options' => menu_get_menus(),
|
||||
'#default_value' => $cache->menu['name'],
|
||||
'#process' => array('ctools_dependent_process'),
|
||||
'#dependency' => array('edit-menu-entry' => array(1)),
|
||||
'#dependency' => array('edit-menu-entry' => array(1)),
|
||||
);
|
||||
}
|
||||
else {
|
||||
@@ -183,7 +185,7 @@ function panels_landing_page_basic_validate(&$form, &$form_state) {
|
||||
form_error($form['path'], t('%, !, ?, #, or & cannot appear in the path.'));
|
||||
}
|
||||
|
||||
// Check to see if something is already using the path
|
||||
// Check to see if something is already using the path.
|
||||
$result = db_query("SELECT * FROM {menu_router} WHERE path = :path", array(':path' => $form_state['values']['path']))->fetch();
|
||||
if ($result) {
|
||||
form_error($form['path'], t('That path is already in use. This system cannot override existing paths.'));
|
||||
@@ -254,9 +256,12 @@ function panels_landing_page_finish(&$form_state) {
|
||||
$subtask->path = $cache->path;
|
||||
$subtask->menu = $cache->menu;
|
||||
|
||||
// Create the the panel context variant configured with our display
|
||||
// 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');
|
||||
@@ -269,9 +274,9 @@ function panels_landing_page_finish(&$form_state) {
|
||||
page_manager_page_new_page_cache($subtask, $page);
|
||||
page_manager_handler_add_to_page($page, $handler);
|
||||
|
||||
// Save it
|
||||
// Save it.
|
||||
page_manager_save_page_cache($page);
|
||||
|
||||
// Send us to the new page immediately.
|
||||
$form_state['redirect'] = url($cache->path);
|
||||
$form_state['redirect'] = $cache->path;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Provides a panels_storage plugin for the reusable flexible layouts UI.
|
||||
*/
|
||||
|
||||
// Plugin definition.
|
||||
$plugin = array(
|
||||
'access callback' => 'panels_layouts_ui_panels_storage_access',
|
||||
);
|
||||
|
||||
/**
|
||||
* Access callback for panels storage.
|
||||
*/
|
||||
function panels_layouts_ui_panels_storage_access($storage_type, $storage_id, $op, $account) {
|
||||
return user_access('administer panels layouts', $account);
|
||||
}
|
||||
@@ -8,4 +8,3 @@
|
||||
color: %header-text;
|
||||
background-color: %header-background;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
/* Show only to IE7 */
|
||||
*:first-child+html .rounded-shadow-background,
|
||||
/* Show only to IE6 */
|
||||
* html .rounded-shadow-background {
|
||||
* html .rounded-shadow-background {
|
||||
margin: 0 -10px 0 0 !important;
|
||||
padding: 10px 0 5px 0 !important;
|
||||
}
|
||||
|
||||
.rounded-shadow-top-edge, .rounded-shadow-bottom-edge, .rounded-shadow-left-edge, .rounded-shadow-right-edge, .rounded-shadow-wrap-corner {
|
||||
.rounded-shadow-top-edge,
|
||||
.rounded-shadow-bottom-edge,
|
||||
.rounded-shadow-left-edge,
|
||||
.rounded-shadow-right-edge,
|
||||
.rounded-shadow-wrap-corner {
|
||||
position: relative;
|
||||
/* hasLayout -1 ? For IE only */
|
||||
zoom: 1;
|
||||
@@ -88,7 +92,8 @@
|
||||
}
|
||||
|
||||
%style .panel-pane {
|
||||
position: relative; top: -6px;
|
||||
position: relative;
|
||||
top: -6px;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -96,4 +96,3 @@ function panels_pane_rounded_shadow_style_base_build($plugin, $settings, &$css,
|
||||
ctools_stylizer_font_apply_style($css, '%style .pane-content', $settings['text_font']);
|
||||
ctools_stylizer_padding_apply_style($css, '%style', $settings['padding']);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
/* Show only to IE7 */
|
||||
*:first-child+html .rounded-shadow-background,
|
||||
/* Show only to IE6 */
|
||||
* html .rounded-shadow-background {
|
||||
* html .rounded-shadow-background {
|
||||
margin: 0 -10px 0 0 !important;
|
||||
padding: 10px 0 5px 0 !important;
|
||||
}
|
||||
|
||||
.rounded-shadow-top-edge, .rounded-shadow-bottom-edge, .rounded-shadow-left-edge, .rounded-shadow-right-edge, .rounded-shadow-wrap-corner {
|
||||
.rounded-shadow-top-edge,
|
||||
.rounded-shadow-bottom-edge,
|
||||
.rounded-shadow-left-edge,
|
||||
.rounded-shadow-right-edge,
|
||||
.rounded-shadow-wrap-corner {
|
||||
position: relative;
|
||||
/* hasLayout -1 ? For IE only */
|
||||
zoom: 1;
|
||||
|
||||
@@ -68,4 +68,3 @@ function panels_region_rounded_shadow_style_base_build($plugin, $settings, &$css
|
||||
ctools_stylizer_font_apply_style($css, '%style', $settings['font']);
|
||||
ctools_stylizer_padding_apply_style($css, '%style', $settings['padding']);
|
||||
}
|
||||
|
||||
|
||||