diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 6e2d6afcdac53800e062db65bb065eb94f6d2cda..35227d3a42c43e9abbb6c3144ec351b8dafd1130 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,221 +1,2 @@
-Panels 6.x-dev
+Panels 7.x-dev
==============
-hook_panels_pre_render() and hook_panels_post_render() getting empty displays.
-#865704: Editing mini panels styles failed badly due to missing piece of cache.
-Custom style could crash if trying to enable style reuse without first enabling stylizer.module.
-In Flexible, the "class" would not stick when adding a new region/row/column but would when editing.
-#861426: Editing a mini panel while that same mini panel is displayed on the page resulted in a crash.
-#871730: Panel nodes with IPE enabled let anyone use IPE.
-#877810: Multiple "Add flexible layout" tabs appearing based on number of flexible layouts stored.
-#873224 by thsutton: hook_requirements() could cause notice error.
-#867340 by cedarm: Restore removed but deprecated panels_render_layout() function.
-#871942 by dwatson: Invalid CSS made dragger image not appear during IPE.
-#867864: Fix a admin title and edit link problems with custom content types.
-#570194: Add support for the "checkall" module in the content permissions page.
-#696846: Mini panels conflated displayed title with admin title.
-#889824: Custom class could would cause stylizer class to become malformed.
-Add a simple "Panels" row style to Views that lets you put fields in a panel layout.
-Add two new Page Wizards to more easily create some of the most commonly used Panel pages.
-#869766 by rupl: flexible layout builder could fail with multiple columns in only one row. (Needs clear cache to see changes in generated CSS.)
-#897214: Mini panel uninstall tried to order mini panels by a non-existing field.
-#893456 by omerida: Change FAPI definition of panel node "body" field to be more consistent with other node body fields.
-#812658 by naxoc: Caching should take language into account.
-#890086: Possible crash in flexible layout by not having CTools export.inc loaded.
-#899456 by yareckon: IPE customize button needs to be reset to "static" instead of "normal".
-#806874 by ximo: Allow panes to specify "render first" as well as "render last".
-
-Panels 6.x-3.7 (2010-Jul-26)
-==============
-Experimentally introduced the In-Place Editor (IPE).
-Updated Panels Stylizer to use CTools' new Export UI.
-Deprecated panels_get_panels() function. This will be eventually disappear. Use panels_get_regions() instead.
-#834084: Reusable flexible layout introduced. Admin UI at admin/build/panels/layouts.
-Clean up flexible. Attempt to reduce the use of unnecessary divs.
-Add more ability to control flexible classes.
-Add ability to fix flexible canvas to a set width.
-Allow disabling of scaling for IE6 in flexible.
-Fixes to IPE:
- Add pane would add the new pane outside region styling
- Add pane would not appear in empty regions
- Panes could not be dragged to empty regions
- Save would lose content if they were inside stylizer styled regions
-#822234 by Amitaibu: Missing url() caused IPE to not work on sites not using top level URLs.
-#844062: Turned the normal drag and drop editor into a renderer plugin, made the IPE part of it. Also some fairly serious code reorganization.
-Improve the renderer selection framework. This framework has no UI, but it utilizes exportables and new choices can be hand crafted.
-Improve the IPE to use the proper cache if it is set, and to respect locking.
-#847784: IPE displayed "Edit" link when no such link should have existed.
-#843758: Legacy renderer caused "missing argument" warning when rendering.
-Made it possible to override jQuery UI sortable options via settings in the renderer plugin.
-Moved Panels stylizer to CTools. You must update CTools at the same time as Panels.
-#737602: Generic NOT checkbox for all access tests.
-#369628: Sort results by export key when bulk exporting.
-#690902: Improvement to export.module integration of panel nodes.
-#690814 by neclimdul: Panels mini edit form could overwrite page title.
-#675220 by dereine: Provide a watchdog message if a layout can't be loaded when rendering a panel.
-#713526 by psynaptic: Omit top and bottom region divs in stacked layouts if regions are empty.
-#823216 by jonathan1055: Put quotes around url() in rounded corners CSS.
-#603150 by hefox: Protect against the panels node add form being used in unusual places.
-#841824 by levacjeep: Extend panels_edit and panels_edit_layout to allow more options with the $destination.
-#842976 by drewish: Make sure the theme knows path and file information for plugin supplied themes.
-#743850 by foripepe: Add delete panel node permissions.
-#532900: Flexible sometimes did not update links when region settings changed.
-#723036: Node pane previews did not include node content as they should.
-#831216: It should not be possible to remove the Canvas.
-#216076: Make sure that empty panes are not rendered. Note: Legacy mode region styles can still render empty panes anyway.
-#609626: Static caching loading mini panels.
-#848712 by josh_k: Use panel nodes with IPE.
-#860306 by jcmarco: "Substitutions" fieldset would not open due to missing js.
-#856964: "Custom style" selection was not working.
-#863302: Allow IPE to cope with empty panes.
-#865344: by jrockowitz: Panel node access hook should use $account.
-
-Panels 6.x-3.5 (2010-May-28)
-==============
-Replaced panels_load_include() with ctools_include().
-Restored (and deprecated) panels_print_layout(), as other modules were relying on it.
-
-Panels 6.x-3.4 (2010-May-19)
-==============
-Introduced Panels Stylizer.
-Removed superfluous function, panels_sanitize_display().
-#655268: Fix a problem retrieving cached content created by #634746.
-Removed the old and crufty panels_print_layout().
-#745808 by Robbert: use number_format() in flexible width calculations to ensure locale settings cannot bork generated CSS.
-Stopped wasting cycles trying to render a mini panel in a block when we know the mini panel doesn't exist.
-#765978 by joshk: Added watchdoggery and a hook to panels_display_save().
-#746568 by mgriego: Disable block caching for mini panels.
-#798954 by dixon: Pass $form_state to style plugins' validate and submit callbacks.
-#779012 by c960657: implement the callback for a single content_type subtype in panels_mini to improve performance with large numbers of mini panels.
-#763584 by neclimdul: Add a link to the block configuration page for mini-panels that takes the user to edit that mini- panel.
-Security updates: protect the importer with the 'use PHP for block visibility' permission.
-
-Panels 6.x-3.3 (2010-Feb-01)
-==============
-
-#612850: Fix crash bug with panes referencing deleted/missing views.
-#614178: Transition to panels-pane.tpl.php caused empty panes to display again.
-#634746 by joshk: Allow pane caching to modify the content during cache storage.
-#612116 by johnskulski: panels-pane preprocess was incorrectly rendering $links
-#612704 by c960657: panels_get_pane_content() inappropriately created a blank context when no contexts were available.
-#618624 by johnskulski: Better classes for panel panes.
-#651306 by joachim: Add "edit any panel node" permission. Not sure why this was never there.
-#497042: Add update.php to remove unused panels_page_router_store table, if it exists.
-#683162: Convert all plugins to use new $plugin = array() format. This is less brittle than the specially named hook.
-#543898: Fix notice error when a layout has no regions.
-#647706: Mini panel names can only be 32 characters, but the form failed to restrict the limit.
-Introduce the Panels stylizer module which builds on the CTools stylizer base to create user definable, recolorable styles.
-
-Panels 6.x-3.2 (2009-Oct-21)
-==============
-
-#606980 by Deciphered and sethfreach: Typo caused panel-pane class to disappear if another class was assigned.
-#607242: Using the wrong variable in hook_block can cause title to not be overridable.
-#608062: Visibility rules did not appear in the list when added to a pane (though they still applied).
-
-Panels 6.x-3.1 (2009-Oct-15)
-==============
-
-#552846 by eMPee584: Fix notice with tablesorts on mini panels page if no mini panels exist.
-#568218: Links to clone, export, delete/revert, enable/disable variants from the main summary page were incorrect and led to an operation trail not found message.
-#533724: Prevent Panels from upgrading while uninstalled, as that upgrades into broken pages.
-#529816: Allow flexible layout to add custom classes to each region.
-Rearrange the pane dropdown menus to be better organized and look a little nicer.
-Add a new field to allow setting a panel title from one of its panes.
-#562560 by Damien McKenna: Integration with export.module
-#583172 by jacine: Turn panel pane into a template, as it always should have been.
-#604404: Make sure caching does not trigger for form POSTs.
-
-Panels 6.x-3.0 (2009-Aug-19)
-==============
-
-#529258 by stella: Attempting to modify CSS properties on mini panel causes ajax failure.
-#537430 by dereine: Fix untranslatable strings in panels dashboard template.
-#530104 by stella: Fix import problem with mini panels.
-#535606: Mini panel deletion deleted all block config of all mini panels.
-#539418 by esmerel: Remove reference to panel page from module description.
-#535722: Fix incorrect "title" tag on categories in add content modal.
-Fix a bug with drag and drop UI that caused panes to break after other panes were added.
-#538900: Fix bug with flexible when having multiple regions of the same name if they have a space.
-#552014: Hide Substitutions fieldset if there are no contexts.
-#552006: Add Content modal now opens to explanatory text instead of the first category.
-#553392 by lee20: Fix node allowed layouts not properly respected on edit layout screen.
-
-Panels 6.x-3.0-rc1
-==================
-
-#515316: Add permission to view Panels admin dashboard.
-#298174: Recursion defense for mini panels.
-#502670: Extra HTML designed only for flexible layout admin accidentally rendered.
-#507516: "Default" panel style on regions not being properly utilized.
-#476440: Seriously, cloning variants really realy fixed.
-#518360 by joshk: Panels node form doesn't have format properly associated.
-#525340 by markus_petrux: Dashboard improperly initializing a variable.
-#460902 by dmmckenna: Fix problem installing panels from an install profile.
-#488278: Preview on panel nodes prior to creation caused errors.
-#475920: Create "use panels dashboard" permission to more easily control who can and cannot use it.
-#384552: Fix incompatibilities with theme developer. Drag & drop screen does not need to be themable.
-
-Panels 6.x-3.0-beta4
-====================
-Note: beta3 skipped to stay even with CTools beta numbers.
-Removal of non-functioning bulk export module in favor of the new one in CTools.
-Update to require CTools API 1.1.0
-Updates to work with the new Page Manager UI in CTools.
-
-Panels 6.x-3.0-beta2
-====================
-Update to require CTools based upon its advertised API version number.
-Update code to ensure that the dead 'panels simple cache' module is really dead.
-Attempt to go back further in history for a Panels 1 upgrade path.
-Fix for making sure Panels completely disables itself if using incompatible version of CTools.
-Update CSS caching on panel page and panel context to use ctools_css_store instead of remembering the filename.
-Infinite loop protection in panel nodes.
-#459078: Provide the "read more" flag for teasers of panel nodes.
-Fix broken styling when dragging a panel pane.
-Integrate with CTools tab system so we can add edit tabs to all our panel pages.
-#454208: pgsql does not support concat(), so use || instead for postgres.
-#445828: Remove "Settings" link if a content type has no settings form.
-#460200: Allow regions and columns that have only 'fixed' width items. Disallow changing a 'fixed' item to 'fluid.'
-
-Panels 6.x-3.0-beta1
-====================
-
-#422712: Panel page import button went to wrong place.
-#423288: Profile template plugin had wrong path.
-#424176: Panel nodes: Remove unused layout screen, fix some notice errors, give context a description.
-New simpler panel page task that doesn't bother with handlers at all.
-#317121: Respect 'hide title' option in display settings.
-#422404: Update to exportables left mini panels kind of broken.
-#422180 by joshk: Fix panel node_access to accept incoming $account.
-Moved content types to CTools.
-Better add content dialog.
-#437742 by jcmarco: Missing include.
-#440142 by jcmarco: Did not change panels_get_content_types to ctools_get_content_types.
-Add a live preview widget to the panel content edit page.
-Fix panel page type to actually respect the contexts.
-Upgrades from as far back as Drupal 5 can now be supported.
-Rearranged the menus, created the Panel dashboard.
-Returned the allowed content settings form to panel page
-Added allowed layouts to settings form for panel pages, nodes, minis.
-#362754 by dereine: Fix invalid XHTML in 3col 33/34/33 template.
-#375686: Create panels_get_current_page_display() to replace the old panels_get_current_page() function.
-#424798: Respond to a cloned handler by properly cloning the display as well.
-#424290: Ensure content.inc is loaded during panels display save so that everything can be found.
-#422090: Ensure the first item added to a row is fluid. Fixed can then be added after that.
-
-Panels 6.x-3.0-alpha3
-=====================
-Note: This changelog is incomplete, as it was started sometime after alpha2.ls
-
-#349979 by Dave Reid: Proper use of link alter.
-#374628: Add a check for broken display to the admin summary to prevent crashes.
-Retool flexible layout into a nice javascripty visual layout builder.
-Retool mini panels to use ctools export class and provide a .inc file for its content type as a better example.
-Store a panel task handler's display in the database.
-Add a mechanism to fetch information about just one content subtype (i.e, single view, single block) instead of fetching them all.
-Overhaul node_content_type creating a .inc file.
-Add 'content type' property to content types.
-Add 'defaults' property to content types.
-Panels views cleanup, including making exposed form blocks available.
-#391788 by guix: Simple cache should not unserialize data that is now already unserialized.
-#367635 by lee20: View title built too early and so lost arguments.
diff --git a/D6UPDATE.txt b/D6UPDATE.txt
deleted file mode 100644
index d340127dcf892be9953e5728ac1ef52760172a2f..0000000000000000000000000000000000000000
--- a/D6UPDATE.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-CHANGES DURING D6 UPDATE TO PANELS 3
-
-ALL PLUGINS
-===========
-
-Function to advertise directory for plugins:
- hook_ctools_plugin_directory($module, $plugin)
-
-LAYOUTS
-=======
-
-All layouts should use templates
-'icon' now uses the defined path and should no longer have path built in.
-'css' now uses defined path and should no longer have path built in.
-DOCUMENTATION NOTE: You can just copy any layout css file directly to your theme. It should no longer be in theme/layouts directory.
-administrative view of a layout can now have its own theme function.
-
-CONTENT TYPES
-=============
-
-panels_node_legacy module renamed to panels_node_content.module
--- NEED UPDATE TO RENAME IN SYSTEM TABLE.
-
-'title callback' now has $subtype as the first argument.
-'render' now has $subtype as the first argument.
-'content_types' now 'content types'.
-New 'content type' to fetch information a single content type so we don't have
-to load all of them all the time.
-New 'defaults' array in either the type or subtype declaration to provide
-defaults for the add form.
-
-CONTEXTS
-========
-
-Function signature on submit and validate handlers now: ($form, &$form_values, &$form_state)
-Moved to CTOOLS
-
-RELATIONSHIPS
-========
-
-Function signature on submit and validate handlers now: ($form, &$form_values, &$form_state)
-Moved to CTOOLS
-
-ARGUMENTS
-========
-
-Function signature on submit and validate handlers now: ($form, &$form_values, &$form_state)
-Moved to CTOOLS
-
-When argument plugins fail to load a context at runtime, they must now return
-error codes instead of FALSE or NULL (previously the practice). The error codes,
-and their respective documentation, can be found at the top of panels.module.
diff --git a/INSTALL.txt b/INSTALL.txt
deleted file mode 100644
index b9a130bb5de87438de18610c966432bd703fd1bf..0000000000000000000000000000000000000000
--- a/INSTALL.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-# $Id$
-
-Place the module files in the appropriate directory. If you're not sure,
-try 'sites/all/modules'.
-
-Then navigate to administer >> site building >> modules and activate
-the panels module, along with any of the accompanying side modules you'd like to use.
-The Panels module itself only provides an API - you MUST install these other modules
-if you want to do much of anything.
diff --git a/UPGRADE.txt b/UPGRADE.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d1a42f2afb77b004b95e7c972135d83e0bebb0e6
--- /dev/null
+++ b/UPGRADE.txt
@@ -0,0 +1,22 @@
+Upgrading from Panels-6.x-3.x to Panels-7.x-3.x
+
+ - Style and layout plugins may no longer be registered by a central hook.
+ Only the plugin directories method may be used.
+
+ - Layout 'panels function' is now 'regions function'.
+
+ - Layout 'panels' key is now 'regions'.
+
+ - panels_get_pane_title() deprecated.
+
+ - panels_plugin_get_function() deprecated.
+
+ - panels_required_context removed. These were deprecated long ago and
+ existed only to prevent crashes.
+
+ - panels_optional_context removed.
+
+ - $renderer->plugins['layout']['panels'] changed to $renderer->plugin['layout']['regions']
+
+ - display_renderer class is now in 'renderer', not 'handler'.
+
diff --git a/css/panels_dnd.css b/css/panels_dnd.css
index ba14a5feb894339a4d66f8fba587871808fa19f0..7a1cfa7f981e3558f3d675a0280bd2a9376a12b7 100644
--- a/css/panels_dnd.css
+++ b/css/panels_dnd.css
@@ -30,7 +30,7 @@
}
#panels-dnd-main div.panels-display .pane-add-link {
- position: absolute;
+ position: relative;
display: block;
width: 16px;
height: 16px;
diff --git a/help/plugin-layout.html b/help/plugin-layout.html
index 001702c2f190945b036ffabef618ebfe5383850d..e5c0f5ceb9a44d58488f9b4afd8c830d6a839d1e 100644
--- a/help/plugin-layout.html
+++ b/help/plugin-layout.html
@@ -63,7 +63,7 @@ There are many additional properties that can be added to the include file. For
The tpl.php File:
The tpl.php file is very similar to any other template file within drupal. The difference here is that we're being passed an array of regions through $content, and we also have a css id available to us for the entire panel in the form of $css_id. The template is very straight forward and will look similar to the following:
-
<div class="panel-display panel-stacked-twothirds-onethird clearfix" <?php if (!empty($css_id)) { print "id=\"$css_id\""; } ?>>
<div class="panel-panel panel-col-first panel-region-main">
<div class="inside"><?php print $content['main']; ?></div>
</div>
diff --git a/help/plugins-layout.html b/help/plugins-layout.html
index 45051b2d305f32a64336e33d3f71e747c518eebb..85a33c4b3a26b00aad327f1ff2e3bf9498ed4add 100644
--- a/help/plugins-layout.html
+++ b/help/plugins-layout.html
@@ -61,7 +61,7 @@ There are many additional properties that can be added to the include file. For
The tpl.php File:
The tpl.php file is very similar to any other template file within drupal. The difference here is that we're being passed an array of regions through $content, and we also have a css id available to us for the entire panel in the form of $css_id. The template is very straight forward and will look similar to the following:
-
<div class="panel-display panel-stacked-twothirds-onethird clearfix" <?php if (!empty($css_id)) { print "id=\"$css_id\""; } ?>>
<div class="panel-panel panel-col-first panel-region-main">
<div class="inside"><?php print $content['main']; ?></div>
</div>
diff --git a/includes/callbacks.inc b/includes/callbacks.inc
index 318eadcd70c2e23488463a2e2869a3134bb9fc51..a9238d3e3d6082d04a11df1afa55c65e6fdce6a4 100644
--- a/includes/callbacks.inc
+++ b/includes/callbacks.inc
@@ -9,6 +9,7 @@
* A central administrative page for Panels.
*/
function panels_admin_page() {
+ // @todo I think this should return a renderable array somehow?
return theme('panels_dashboard');
}
@@ -42,7 +43,7 @@ function panels_dashboard_final_blocks(&$vars) {
*/
function panels_panels_dashboard_blocks(&$vars) {
$vars['links']['panels_layout'] = array(
- 'title' => l(t('Custom layout'), 'admin/build/panels/layouts/add'),
+ 'title' => l(t('Custom layout'), 'admin/structure/panels/layouts/add'),
'description' => t('Custom layouts can add more, site-specific layouts that you can use in your panels.'),
);
@@ -56,7 +57,7 @@ function panels_panels_dashboard_blocks(&$vars) {
$rows[] = array(
check_plain($item->admin_title),
array(
- 'data' => l(t('Edit'), "admin/build/panels/layouts/list/$item->name/edit"),
+ 'data' => l(t('Edit'), "admin/structure/panels/layouts/list/$item->name/edit"),
'class' => 'links',
),
);
@@ -68,7 +69,7 @@ function panels_panels_dashboard_blocks(&$vars) {
}
if ($rows) {
- $content = theme('table', array(), $rows, array('class' => 'panels-manage'));
+ $content = theme('table', array('rows' => $rows, 'attributes' => array('class' => 'panels-manage')));
}
else {
$content = '
' . t('There are no custom layouts.') . '
';
@@ -76,7 +77,7 @@ function panels_panels_dashboard_blocks(&$vars) {
$vars['blocks']['panels_layout'] = array(
'title' => t('Manage custom layouts'),
- 'link' => l(t('Go to list'), 'admin/build/panels/layouts'),
+ 'link' => l(t('Go to list'), 'admin/structure/panels/layouts'),
'content' => $content,
'class' => 'dashboard-layouts',
'section' => 'right',
@@ -118,11 +119,11 @@ function template_preprocess_panels_dashboard(&$vars) {
foreach ($plugins as $id => $plugin) {
if (isset($plugin['type']) && $plugin['type'] == 'panels') {
$link = array(
- 'title' => l($plugin['title'], 'admin/build/pages/wizard/' . $id),
+ 'title' => l($plugin['title'], 'admin/structure/pages/wizard/' . $id),
'description' => $plugin['description'],
);
- $vars['blocks']['wizards']['content'] .= theme('panels_dashboard_link', $link);
+ $vars['blocks']['wizards']['content'] .= theme('panels_dashboard_link', array('link' => $link));
}
}
@@ -140,7 +141,7 @@ function template_preprocess_panels_dashboard(&$vars) {
// Turn the links into a block
foreach ($vars['links'] as $link) {
- $vars['blocks']['links']['content'] .= theme('panels_dashboard_link', $link);
+ $vars['blocks']['links']['content'] .= theme('panels_dashboard_link', array('link' => $link));
}
uasort($vars['blocks'], 'ctools_plugin_sort');
@@ -151,7 +152,7 @@ function template_preprocess_panels_dashboard(&$vars) {
// Render all the blocks
foreach ($vars['blocks'] as $block) {
$section = !empty($block['section']) ? $block['section'] : 'left';
- $vars[$section] .= theme('panels_dashboard_block', $block);
+ $vars[$section] .= theme('panels_dashboard_block', array('block' => $block));
}
}
diff --git a/includes/common.inc b/includes/common.inc
index 867a884595e1c6fed85b06d7eb86c2d350e41c64..a7d4abd2512cbe4c6e340fa7f3f34428b0bb9309 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -224,7 +224,7 @@ class panels_allowed_layouts {
* A common settings page for Panels modules, because this code is relevant to
* any modules that don't already have special requirements.
*/
-function panels_common_settings(&$form_state, $module_name = 'panels_common') {
+function panels_common_settings($form, &$form_state, $module_name = 'panels_common') {
ctools_include('plugins', 'panels');
ctools_include('content');
$content_types = ctools_get_content_types();
@@ -281,7 +281,7 @@ function panels_common_settings(&$form_state, $module_name = 'panels_common') {
$form['content_types'] = array(
'#tree' => TRUE,
- '#prefix' => '
',
+ '#prefix' => '
',
'#suffix' => '
',
);
// cheat a bit
@@ -398,7 +398,7 @@ function panels_common_allowed_layouts_form(&$form, &$form_state, $module_name)
'#options' => $options,
'#description' => t('Check the boxes for all layouts you want to allow users choose from when picking a layout. You must allow at least one layout.'),
'#default_value' => array_keys(array_filter($allowed_layouts->allowed_layout_settings)),
- '#prefix' => '
',
+ '#prefix' => '
',
'#suffix' => '
',
'#checkall' => TRUE,
);
@@ -480,7 +480,9 @@ function panels_common_get_allowed_layouts($module_name) {
* Create a visible list of content in a display.
* Note that the contexts must be pre-loaded.
*/
-function theme_panels_common_content_list($display) {
+function theme_panels_common_content_list($vars) {
+ $display = $vars['display'];
+
$layout = panels_get_layout($display->layout);
$content = '
';
// We're doing these dependencies completely manualy, which is unusual, but
// the process code only supports doing them in a form.
@@ -555,7 +557,7 @@ function panels_common_print_layout_links($layouts, $base_path, $link_options =
);
$output .= '
';
- $output .= '
';
+ $output .= '
';
$output .= '
' . $categories[$category] . '
';
foreach ($links as $key => $link) {
diff --git a/includes/display-edit.inc b/includes/display-edit.inc
index bf9bf69599fdac2358b550b88816ec0229a06cc1..5e58503182515a69a811d364a5a32a1130d343e7 100644
--- a/includes/display-edit.inc
+++ b/includes/display-edit.inc
@@ -8,36 +8,6 @@
* as well as the ajax modal forms associated with them.
*/
-
-/**
- * Method to allow modules to provide their own caching mechanism for the
- * display editor.
- */
-function panels_edit_cache_get($cache_key) {
- if (strpos($cache_key, ':') !== FALSE) {
- list($module, $argument) = explode(':', $cache_key, 2);
- return module_invoke($module, 'panels_cache_get', $argument);
- }
-
- // Fall back to our normal method:
- return panels_cache_get('display', $cache_key);
-}
-
-/**
- * Method to allow modules to provide their own caching mechanism for the
- * display editor.
- */
-function panels_edit_cache_set($cache) {
- $cache_key = $cache->display->cache_key;
- if (strpos($cache_key, ':') !== FALSE) {
- list($module, $argument) = explode(':', $cache_key, 2);
- return module_invoke($module, 'panels_cache_set', $argument, $cache);
- }
-
- // Fall back to our normal method:
- return panels_cache_set('display', $cache_key, $cache);
-}
-
/**
* Handle calling and processing of the form for editing display content.
*
@@ -81,7 +51,7 @@ function _panels_edit($display, $destination, $content_types, $title = FALSE) {
* @ingroup forms
* @see panels_edit_display_submit()
*/
-function panels_edit_display_form(&$form_state) {
+function panels_edit_display_form($form, &$form_state) {
$display = &$form_state['display'];
$renderer = &$form_state['renderer'];
@@ -105,16 +75,16 @@ function panels_edit_display_form(&$form_state) {
'#value' => $links,
);
- $form += panels_edit_display_settings_form($form_state);
+ $form += panels_edit_display_settings_form($form, $form_state);
$form['panel'] = array('#tree' => TRUE);
$form['panel']['pane'] = array('#tree' => TRUE);
$form['display'] = array(
- '#value' => $renderer->render(),
+ '#markup' => $renderer->render(),
);
- foreach ($renderer->plugins['layout']['panels'] as $region_id => $title) {
+ foreach ($renderer->plugins['layout']['regions'] as $region_id => $title) {
// Make sure we at least have an empty array for all possible locations.
if (!isset($display->panels[$region_id])) {
$display->panels[$region_id] = array();
@@ -153,7 +123,7 @@ function panels_edit_display_form(&$form_state) {
$form['preview']['button'] = array(
'#type' => 'submit',
'#value' => t('Preview'),
- '#attributes' => array('class' => 'ctools-use-ajax'),
+ '#attributes' => array('class' => array('use-ajax-submit')),
'#id' => 'panels-live-preview-button',
'#submit' => array('panels_edit_display_form_submit', 'panels_edit_display_form_preview'),
);
@@ -218,15 +188,16 @@ function panels_edit_display_form_preview(&$form, &$form_state) {
'output' => $output,
);
- ctools_ajax_render($commands);
+ print ajax_render($commands);
+ ajax_footer();
+ exit;
}
/**
* Form for display settings.
*/
-function panels_edit_display_settings_form(&$form_state) {
- $form = array();
+function panels_edit_display_settings_form($form, &$form_state) {
$display = &$form_state['display'];
$layout = panels_get_layout($display->layout);
@@ -265,14 +236,15 @@ function panels_edit_display_settings_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/collapse.js');
- $form['display_title']['contexts_prefix'] = array(
- '#type' => 'hidden',
- '#id' => 'edit-display-substitutions',
- '#prefix' => '',
+// );
}
}
diff --git a/includes/display-layout.inc b/includes/display-layout.inc
index 5ce7fbe831f61294b57813200c5acab5d5c866e7..a3e81dff1b2788d24f3265a955261fd6cfd1dc35 100644
--- a/includes/display-layout.inc
+++ b/includes/display-layout.inc
@@ -16,7 +16,6 @@
*/
function _panels_edit_layout($display, $finish, $destination, $allowed_layouts) {
ctools_include('common', 'panels');
- ctools_include('form');
$form_state = array(
'display' => &$display,
@@ -33,8 +32,8 @@ function _panels_edit_layout($display, $finish, $destination, $allowed_layouts)
// Examine $_POST to see which form they're currently using.
if (empty($_POST) || empty($_POST['form_id']) || $_POST['form_id'] != 'panels_change_layout') {
- $output = ctools_build_form('panels_choose_layout', $form_state);
- if (empty($output)) {
+ $output = drupal_build_form('panels_choose_layout', $form_state);
+ if (!empty($form_state['executed'])) {
// upon submission go to next form.
$change_form_state['layout'] = $_SESSION['layout'][$display->did] = $form_state['layout'];
$change_form = TRUE;
@@ -46,8 +45,8 @@ function _panels_edit_layout($display, $finish, $destination, $allowed_layouts)
}
if ($change_form) {
- $output = ctools_build_form('panels_change_layout', $change_form_state);
- if (empty($output)) {
+ $output = drupal_build_form('panels_change_layout', $change_form_state);
+ if (!empty($change_form_state['executed'])) {
if (isset($change_form_state['back'])) {
unset($_POST);
return _panels_edit_layout($display, $finish, $destination, $allowed_layouts);
@@ -72,7 +71,7 @@ function _panels_edit_layout($display, $finish, $destination, $allowed_layouts)
*
* @ingroup forms
*/
-function panels_choose_layout(&$form_state) {
+function panels_choose_layout($form, &$form_state) {
$display = &$form_state['display'];
ctools_include('common', 'panels');
ctools_include('cleanstring');
@@ -106,7 +105,7 @@ function panels_choose_layout(&$form_state) {
);
$form['layout'] = array(
- '#prefix' => '
',
- '#value' => t('There is no content in the panel display. If there were content, you would be given an opportunity to select where in the new layout the old content would be placed. Select "Save" or "Continue" to proceed. This change will not be processed if you do not continue.'),
+ '#markup' => t('There is no content in the panel display. If there were content, you would be given an opportunity to select where in the new layout the old content would be placed. Select "Save" or "Continue" to proceed. This change will not be processed if you do not continue.'),
'#suffix' => '
',
);
}
@@ -292,4 +280,4 @@ function panels_change_layout_submit($form, &$form_state) {
*/
function panels_choose_layout_back($form, &$form_state) {
$form_state['back'] = TRUE;
-}
\ No newline at end of file
+}
diff --git a/includes/display-render.inc b/includes/display-render.inc
deleted file mode 100644
index 7b24461c5ee8a20917c41e1aada958364f754167..0000000000000000000000000000000000000000
--- a/includes/display-render.inc
+++ /dev/null
@@ -1,105 +0,0 @@
-css_id) ? $display->css_id : '', $content, $display->layout_settings, $display, $layout);
-}
-
-/**
- * Render a pane using the appropriate style.
- *
- * Legacy function; this behavior has been moved onto the display renderer
- * object. The function name here is included for backwards compatibility. New
- * style plugins should NEVER call it.
- *
- * $content
- * The already rendered content via panels_render_pane_content()
- * $pane
- * The $pane information from the display
- * $display
- * The display.
- */
-function panels_render_pane($content, $pane, &$display) {
- if ($display->hide_title == PANELS_TITLE_PANE && !empty($display->title_pane) && $display->title_pane == $pane->pid) {
-
- // If the user selected to override the title with nothing, and selected
- // this as the title pane, assume the user actually wanted the original
- // title to bubble up to the top but not actually be used on the pane.
- if (empty($content->title) && !empty($content->original_title)) {
- $display->stored_pane_title = $content->original_title;
- }
- else {
- $display->stored_pane_title = !empty($content->title) ? $content->title : '';
- }
- }
-
- if (!empty($content->content)) {
- if (!empty($pane->style['style'])) {
- $style = panels_get_style($pane->style['style']);
-
- if (isset($style) && isset($style['render pane'])) {
- $output = theme($style['render pane'], $content, $pane, $display, $style);
-
- // This could be null if no theme function existed.
- if (isset($output)) {
- return $output;
- }
- }
- }
-
- // fallback
- return theme('panels_pane', $content, $pane, $display);
- }
-}
-
-/**
- * Given a display and the id of a panel, get the style in which to render
- * that panel.
- */
-function panels_get_panel_style_and_settings($panel_settings, $panel) {
- if (empty($panel_settings)) {
- return array(panels_get_style('default'), array());
- }
-
- if (empty($panel_settings[$panel]['style']) || $panel_settings[$panel]['style'] == -1) {
- if (empty($panel_settings['style'])) {
- return array(panels_get_style('default'), array());
- }
-
- $style = panels_get_style($panel_settings['style']);
- $style_settings = isset($panel_settings['style_settings']['default']) ? $panel_settings['style_settings']['default'] : array();
- }
- else {
- $style = panels_get_style($panel_settings[$panel]['style']);
- $style_settings = isset($panel_settings['style_settings'][$panel]) ? $panel_settings['style_settings'][$panel] : array();
- }
-
- return array($style, $style_settings);
-}
diff --git a/includes/legacy.inc b/includes/legacy.inc
index 5ba90b5926d9020837e312d8be4854ebcf2dae0d..9085dda89f13e1423c73a9696f9287e031318b2d 100644
--- a/includes/legacy.inc
+++ b/includes/legacy.inc
@@ -38,34 +38,5 @@ class PanelsLegacyState {
$this->legacy = array_filter($this->legacy);
}
- /**
- * Compatibility checker that ensures modules that implement Panels styles
- * list their api as being at least 2.0; this corresponds to the change with
- * the initial IPE commit that made region styles take a fully rendered pane
- * HTML string instead of a pane object that still needed rendering.
- */
- function checkStylesIPE1() {
- $legacy_info = array(
- 'explanation' => $this->t('Panels 3.6 made changes to the rendering order in a way that affects certain style plugins. The above modules implement style plugins, but have not indicated their compatibility with this new system. See !link for information on how to update style plugins to the new system.', array('!link' => url('http://drupal.org/node/###FIXME', array('external' => TRUE)))),
- 'modules' => array(),
- );
-
-
- $naughties = &$legacy_info['modules'];
- $legacy = FALSE;
-
- ctools_include('plugins', 'panels');
- // TODO given that the plugin cache is also clearing at this time, should
- // check this to ensure this isn't causing some kind of weird race condition
- $styles = panels_get_styles();
-
- foreach ($styles as $style) {
- if (version_compare($style['version'], 2.0, '<') && empty($naughties[$style['module']])) {
- $legacy = TRUE;
- $naughties[$style['module']] = $this->t('Style plugins');
- }
- }
- variable_set('panels_legacy_rendering_mode', $legacy);
- return $legacy ? $legacy_info : array();
- }
+ // At this time there are no legacy checks.
}
diff --git a/includes/page-wizard.inc b/includes/page-wizard.inc
index e6f7012167cd12a8f8e2b50b94a8b5d83c454805..e1cb9244df44ef02100fe474e2e9d6f1dc11c3bc 100644
--- a/includes/page-wizard.inc
+++ b/includes/page-wizard.inc
@@ -5,9 +5,16 @@
* @file
* Contains helper functions for the Panels page wizards.
*/
+
+/**
+ * Add layout form helper for panels page wizards.
+ *
+ * This is not a proper form, it is meant to be called by a form to add
+ * elements to it.
+ */
function panels_page_wizard_add_layout(&$form, &$form_state) {
$form_state['allowed_layouts'] = 'panels_page';
- $form_state['display'] = $form_state['cache']->display;
+ $form_state['display'] = $form_state['wizard cache']->display;
// Tell the Panels form not to display buttons.
$form_state['no buttons'] = TRUE;
@@ -23,13 +30,21 @@ function panels_page_wizard_add_layout(&$form, &$form_state) {
ctools_include('display-layout', 'panels');
ctools_include('plugins', 'panels');
- $form = array_merge($form, panels_choose_layout($form_state));
+ $form = panels_choose_layout($form, $form_state);
$form['layout_suffix'] = array(
'#value' => '',
);
+
+// $form_state['cache'] = FALSE;
}
+/**
+ * Add content editor form helper for panels page wizards.
+ *
+ * This is not a proper form, it is meant to be called by a form to add
+ * elements to it.
+ */
function panels_page_wizard_add_content(&$form, &$form_state) {
ctools_include('ajax');
ctools_include('plugins', 'panels');
@@ -39,7 +54,7 @@ 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:node_override');
+ $cache = panels_edit_cache_get('panels_page_wizard:' . $form_state['plugin']['name']);
$form_state['renderer'] = panels_get_renderer_handler('editor', $cache->display);
$form_state['renderer']->cache = &$cache;
@@ -50,16 +65,22 @@ function panels_page_wizard_add_content(&$form, &$form_state) {
$form_state['no buttons'] = TRUE;
$form_state['display_title'] = !empty($cache->display_title);
- $form = array_merge($form, panels_edit_display_form($form_state));
+ $form = panels_edit_display_form($form, $form_state);
// Make sure the theme will work since our form id is different.
$form['#theme'] = 'panels_edit_display_form';
}
+/**
+ * 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
panels_edit_display_form_submit($form, $form_state);
- $cache = &$form_state['cache'];
+ $cache = &$form_state['wizard cache'];
// Copy the "being edited" cached display to the "actual" cached display.
$cache->display = &$form_state['display'];
diff --git a/includes/plugins.inc b/includes/plugins.inc
index 85fa282937a35e304efd28466953e78373a12de3..4db0d570bd0dffc0759e254edd5b8d85c71f4ed8 100644
--- a/includes/plugins.inc
+++ b/includes/plugins.inc
@@ -24,12 +24,14 @@ function panels_pane_access($pane, $display) {
* Get a list of panels available in the layout.
*/
function panels_get_regions($layout, $display) {
- if (!empty($layout['panels function']) && function_exists($layout['panels function'])) {
- return $layout['panels function']($display, $display->layout_settings, $layout);
+ if ($function = ctools_plugin_get_function($layout, 'regions function')) {
+ return $function($display, $display->layout_settings, $layout);
}
- if (!empty($layout['panels'])) {
- return $layout['panels'];
+
+ if (!empty($layout['regions'])) {
+ return $layout['regions'];
}
+
return array();
}
@@ -245,6 +247,8 @@ class panels_cache_object {
/**
* Get the title of a pane.
*
+ * @deprecated @todo this function should be removed.
+ *
* @param $pane
* The $pane object.
*/
@@ -388,7 +392,7 @@ function panels_get_renderer_handler($plugin, &$display) {
$plugin = panels_get_display_renderer($plugin);
}
- $class = ctools_plugin_get_class($plugin, 'handler');
+ $class = ctools_plugin_get_class($plugin, 'renderer');
if ($class) {
$renderer = new $class();
$renderer->init($plugin, $display);
@@ -402,11 +406,6 @@ 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) {
- // If operating in legacy mode, only the legacy renderer is available:
- if (variable_get('panels_legacy_rendering_mode', TRUE)) {
- return panels_get_renderer_handler('legacy', $display);
- }
-
// Load the pipeline
ctools_include('export');
$pipeline = ctools_export_crud_load('panels_renderer_pipeline', $pipeline_name);
@@ -464,11 +463,6 @@ function _panels_renderer_pipeline_sort($a, $b) {
* sorting. Descriptions are left in.
*/
function panels_get_renderer_pipelines($sort = TRUE) {
- // If operating in legacy mode, only the legacy renderer is available:
- if (variable_get('panels_legacy_rendering_mode', TRUE)) {
- return array();
- }
-
ctools_include('export');
$pipelines = ctools_export_crud_load_all('panels_renderer_pipeline');
if ($sort) {
@@ -492,6 +486,8 @@ function panels_get_renderer_pipelines($sort = TRUE) {
* @return
* The actual name of the function to call, or NULL if the function
* does not exist.
+ *
+ * @deprecated All calls to this function should be removed.
*/
function panels_plugin_get_function($plugin, $which, $function_name) {
ctools_include('plugins');
@@ -501,10 +497,4 @@ function panels_plugin_get_function($plugin, $which, $function_name) {
else {
return ctools_plugin_load_function('panels', $plugin, $which, $function_name);
}
-
}
-
-// @todo these are DEPRECATED and can probably be removed.
-// These are placeholders to prevent crashes from the former plugins
-class panels_required_context { function filter() { } };
-class panels_optional_context extends panels_required_context {};
diff --git a/js/display_editor.js b/js/display_editor.js
index 025aeb69b76385b70ac1292e685216627b82148e..376cffb10200555c14e8015545f45bd11feba0e2 100644
--- a/js/display_editor.js
+++ b/js/display_editor.js
@@ -6,450 +6,453 @@
*/
(function ($) {
- /** Delete pane button **/
- Drupal.Panels.bindClickDelete = function(context) {
- $('a.pane-delete:not(.pane-delete-processed)', context)
- .addClass('pane-delete-processed')
- .click(function() {
- if (confirm('Remove this pane?')) {
- var id = '#' + $(this).attr('id').replace('pane-delete-', '');
- $(id).remove();
- Drupal.Panels.Draggable.savePositions();
- }
- return false;
- });
- };
- Drupal.Panels.bindPortlet = function() {
- var handle = $(this).find('.panel-pane-collapsible > div.pane-title');
- var content = $(this).find('.panel-pane-collapsible > div.pane-content');
- if (content.length) {
- var toggle = $('');
- handle.before(toggle);
- toggle.click(function() {
- content.slideToggle(20);
- toggle.toggleClass('toggle-collapsed');
- });
- handle.click(function() {
- content.slideToggle(20);
- toggle.toggleClass('toggle-collapsed');
- });
- content.hide();
+/** Delete pane button **/
+Drupal.Panels.bindClickDelete = function(context) {
+ $('a.pane-delete:not(.pane-delete-processed)', context)
+ .addClass('pane-delete-processed')
+ .click(function() {
+ if (confirm('Remove this pane?')) {
+ var id = '#' + $(this).attr('id').replace('pane-delete-', '');
+ $(id).remove();
+ Drupal.Panels.Draggable.savePositions();
}
- };
+ return false;
+ });
+};
+
+Drupal.Panels.bindPortlet = function() {
+ var handle = $(this).find('.panel-pane-collapsible > div.pane-title');
+ var content = $(this).find('.panel-pane-collapsible > div.pane-content');
+ if (content.length) {
+ var toggle = $('');
+ handle.before(toggle);
+ toggle.click(function() {
+ content.slideToggle(20);
+ toggle.toggleClass('toggle-collapsed');
+ });
+ handle.click(function() {
+ content.slideToggle(20);
+ toggle.toggleClass('toggle-collapsed');
+ });
+ content.hide();
+ }
+};
+
+Drupal.Panels.Draggable = {
+ // The draggable object
+ object: null,
+
+ // Where objects can be dropped
+ dropzones: [],
+ current_dropzone: null,
+
+ // positions within dropzones where an object can be plazed
+ landing_pads: [],
+ current_pad: null,
+
+ // Where the object is
+ mouseOffset: { x: 0, y: 0 },
+ windowOffset: { x: 0, y: 0 },
+ offsetDivHeight: 0,
+
+ // original settings to be restored
+ original: {},
+ // a placeholder so that if the object is let go but not over a drop zone,
+ // it can be put back where it belongs
+ placeholder: {},
+
+ hoverclass: 'hoverclass',
+ helperclass: 'helperclass',
+ accept: 'div.panels-display',
+ handle: 'div.grabber',
+ draggable: 'div.panel-portlet',
+ main: 'div#panels-dnd-main',
+
+ // part of the id to remove to get just the number
+ draggableId: 'panel-pane-',
+ // What to add to the front of a the id to get the form id for a panel
+ formId: 'input#edit-',
+
+ maxWidth: 250,
+
+ unsetDropZone: function() {
+ $(this.current_dropzone.obj).removeClass(this.hoverclass);
+ this.current_dropzone = null;
+ for (var i in this.landing_pads) {
+ $(this.landing_pads[i].obj).remove();
+ }
+ this.landing_pads = [];
+ this.current_pad = null;
+ },
+
+ createLandingPad: function(where, append) {
+ var obj = $('
');
+ if (append) {
+ $(where).append(obj);
+ }
+ else {
+ $(where).before(obj);
+ }
+ var offset = $(obj).offset();
- Drupal.Panels.Draggable = {
- // The draggable object
- object: null,
-
- // Where objects can be dropped
- dropzones: [],
- current_dropzone: null,
-
- // positions within dropzones where an object can be plazed
- landing_pads: [],
- current_pad: null,
-
- // Where the object is
- mouseOffset: { x: 0, y: 0 },
- windowOffset: { x: 0, y: 0 },
- offsetDivHeight: 0,
-
- // original settings to be restored
- original: {},
- // a placeholder so that if the object is let go but not over a drop zone,
- // it can be put back where it belongs
- placeholder: {},
-
- hoverclass: 'hoverclass',
- helperclass: 'helperclass',
- accept: 'div.panels-display',
- handle: 'div.grabber',
- draggable: 'div.panel-portlet',
- main: 'div#panels-dnd-main',
-
- // part of the id to remove to get just the number
- draggableId: 'panel-pane-',
- // What to add to the front of a the id to get the form id for a panel
- formId: 'input#edit-',
-
- maxWidth: 250,
-
- unsetDropZone: function() {
- $(this.current_dropzone.obj).removeClass(this.hoverclass);
- this.current_dropzone = null;
- for (var i in this.landing_pads) {
- $(this.landing_pads[i].obj).remove();
- }
- this.landing_pads = [];
- this.current_pad = null;
- },
-
- createLandingPad: function(where, append) {
- var obj = $('
');
- if (append) {
- $(where).append(obj);
- }
- else {
- $(where).before(obj);
- }
- var offset = $(obj).offset();
+ $(obj).css({
+ display: 'none'
+ });
+ this.landing_pads.push({
+ centerX: offset.left + ($(obj).innerWidth() / 2),
+ centerY: offset.top + ($(obj).innerHeight() / 2),
+ obj: obj
+ });
+ return obj;
+ },
+
+ calculateDropZones: function(event, dropzone) {
+ var dropzones = [];
+ $(this.accept).each(function() {
+ var offset = $(this).offset();
+ offset.obj = this;
+ offset.width = $(this).outerWidth();
+ offset.height = $(this).outerHeight();
+ dropzones.push(offset);
+ });
+ this.dropzones = dropzones;
+ },
+
+ reCalculateDropZones: function() {
+ for (var i in this.dropzones) {
+ offset = $(this.dropzones[i].obj).offset({padding:true});
+ offset.width = $(this.dropzones[i].obj).outerWidth();
+ offset.height = $(this.dropzones[i].obj).outerHeight();
+ $.extend(this.dropzones[i], offset);
+ }
+ },
- $(obj).css({
- display: 'none'
- });
- this.landing_pads.push({
- centerX: offset.left + ($(obj).innerWidth() / 2),
- centerY: offset.top + ($(obj).innerHeight() / 2),
- obj: obj
- });
- return obj;
- },
-
- calculateDropZones: function(event, dropzone) {
- var dropzones = [];
- $(this.accept).each(function() {
- var offset = $(this).offset({padding:true});
- offset.obj = this;
- offset.width = $(this).outerWidth();
- offset.height = $(this).outerHeight();
- dropzones.push(offset);
- });
- this.dropzones = dropzones;
- },
-
- reCalculateDropZones: function() {
- for (var i in this.dropzones) {
- offset = $(this.dropzones[i].obj).offset({padding:true});
- offset.width = $(this.dropzones[i].obj).outerWidth();
- offset.height = $(this.dropzones[i].obj).outerHeight();
- $.extend(this.dropzones[i], offset);
- }
- },
+ changeDropZone: function(new_dropzone) {
+ // Unset our old dropzone.
+ if (this.current_dropzone) {
+ this.unsetDropZone();
+ }
- changeDropZone: function(new_dropzone) {
- // Unset our old dropzone.
- if (this.current_dropzone) {
- this.unsetDropZone();
+ // Set up our new dropzone.
+ this.current_dropzone = new_dropzone;
+ $(this.current_dropzone.obj).addClass(this.hoverclass);
+ // add a landing pad
+ this.createLandingPad(this.current_dropzone.obj, true);
+
+ var that = this;
+ // Create a landing pad before each existing portlet.
+ $(this.current_dropzone.obj).find(this.draggable).each(function() {
+ if (that.object.id != this.id) {
+ that.createLandingPad(this, false);
}
-
- // Set up our new dropzone.
- this.current_dropzone = new_dropzone;
- $(this.current_dropzone.obj).addClass(this.hoverclass);
- // add a landing pad
- this.createLandingPad(this.current_dropzone.obj, true);
-
- var that = this;
- // Create a landing pad before each existing portlet.
- $(this.current_dropzone.obj).find(this.draggable).each(function() {
- if (that.object.id != this.id) {
- that.createLandingPad(this, false);
- }
- });
- },
-
- findLandingPad: function(x, y) {
- var shortest_distance = null;
- var nearest_pad = null;
- // find the nearest pad.
- for (var i in this.landing_pads) {
- // This isn't the real distance, this is the square of the
- // distance -- no point in spending processing time on
- // sqrt.
- var dstx = Math.abs(x - this.landing_pads[i].centerX);
- var dsty = Math.abs(y - this.landing_pads[i].centerY);
- var distance = (dstx * dstx) + (dsty * dsty);
- if (shortest_distance == null || distance < shortest_distance) {
- shortest_distance = distance;
- nearest_pad = this.landing_pads[i];
- }
+ });
+ },
+
+ findLandingPad: function(x, y) {
+ var shortest_distance = null;
+ var nearest_pad = null;
+ // find the nearest pad.
+ for (var i in this.landing_pads) {
+ // This isn't the real distance, this is the square of the
+ // distance -- no point in spending processing time on
+ // sqrt.
+ var dstx = Math.abs(x - this.landing_pads[i].centerX);
+ var dsty = Math.abs(y - this.landing_pads[i].centerY);
+ var distance = (dstx * dstx) + (dsty * dsty);
+ if (shortest_distance == null || distance < shortest_distance) {
+ shortest_distance = distance;
+ nearest_pad = this.landing_pads[i];
}
- if (nearest_pad != this.current_pad) {
- if (this.current_pad) {
- $(this.current_pad.obj).hide();
- }
- this.current_pad = nearest_pad;
- $(nearest_pad.obj).show();
+ }
+ if (nearest_pad != this.current_pad) {
+ if (this.current_pad) {
+ $(this.current_pad.obj).hide();
}
- },
-
- findDropZone: function(x, y) {
- // Go through our dropzones and see if we're over one.
- var new_dropzone = null;
- for (var i in this.dropzones) {
- // console.log('x:' + x + ' left:' + this.dropzones[i].left + ' right: ' + this.dropzones[i].left + this.dropzones[i].width);
- if (this.dropzones[i].left < x &&
- x < this.dropzones[i].left + this.dropzones[i].width &&
- this.dropzones[i].top < y &&
- y < this.dropzones[i].top + this.dropzones[i].height) {
- new_dropzone = this.dropzones[i];
- break;
- }
+ this.current_pad = nearest_pad;
+ $(nearest_pad.obj).show();
+ }
+ },
+
+ findDropZone: function(x, y) {
+ // Go through our dropzones and see if we're over one.
+ var new_dropzone = null;
+ for (var i in this.dropzones) {
+// console.log('x:' + x + ' left:' + this.dropzones[i].left + ' right: ' + this.dropzones[i].left + this.dropzones[i].width);
+ if (this.dropzones[i].left < x &&
+ x < this.dropzones[i].left + this.dropzones[i].width &&
+ this.dropzones[i].top < y &&
+ y < this.dropzones[i].top + this.dropzones[i].height) {
+ new_dropzone = this.dropzones[i];
+ break;
}
- // If we're over one, see if it's different.
- if (new_dropzone) {
- var changed = false;
- if (!this.current_dropzone || new_dropzone.obj.id != this.current_dropzone.obj.id) {
- this.changeDropZone(new_dropzone);
- changed = true;
- }
- this.findLandingPad(x, y);
- if (changed) {
- // recalculate the size of our drop zones due to the fact that we're drawing landing pads.
- this.reCalculateDropZones();
- }
+ }
+ // If we're over one, see if it's different.
+ if (new_dropzone) {
+ var changed = false;
+ if (!this.current_dropzone || new_dropzone.obj.id != this.current_dropzone.obj.id) {
+ this.changeDropZone(new_dropzone);
+ changed = true;
}
- // If we're not over one, be sure to unhilite one if we were just
- // over it.
- else if (this.current_dropzone) {
- this.unsetDropZone();
+ this.findLandingPad(x, y);
+ if (changed) {
+ // recalculate the size of our drop zones due to the fact that we're drawing landing pads.
+ this.reCalculateDropZones();
}
- },
-
- /** save button clicked, or pane deleted **/
- savePositions: function() {
- var draggable = Drupal.Panels.Draggable;
- $(draggable.accept).each(function() {
- var val = '';
- $(this).find(draggable.draggable).each(function() {
- if (val) {
- val += ',';
- }
-
- val += this.id.replace(draggable.draggableId, '');
- });
- // Note: _ is replaced with - because Drupal automatically does this
- // with form ids.
- $(draggable.formId + this.id.replace(/_/g, '-')).val(val);
- });
- return false;
}
- };
+ // If we're not over one, be sure to unhilite one if we were just
+ // over it.
+ else if (this.current_dropzone) {
+ this.unsetDropZone();
+ }
+ },
- Drupal.Panels.DraggableHandler = function() {
- $(this).addClass('panel-draggable');
+ /** save button clicked, or pane deleted **/
+ savePositions: function() {
var draggable = Drupal.Panels.Draggable;
- var scrollBuffer = 10;
- var scrollDistance = 10;
- var scrollTimer = 30;
+ $(draggable.accept).each(function() {
+ var val = '';
+ $(this).find(draggable.draggable).each(function() {
+ if (val) {
+ val += ',';
+ }
- getMouseOffset = function(docPos, mousePos, windowPos) {
- return { x: mousePos.x - docPos.x + windowPos.x, y: mousePos.y - docPos.y + windowPos.y};
- };
+ val += this.id.replace(draggable.draggableId, '');
+ });
+ // Note: _ is replaced with - because Drupal automatically does this
+ // with form ids.
+ var region = this.id.replace(/_/g, '-').replace('panel-pane-', '');
+ $('input[name="panel[pane][' + region + ']"]').val(val);
+ });
+ return false;
+ }
+};
- getMousePos = function(ev) {
- ev = ev || window.event;
+Drupal.Panels.DraggableHandler = function() {
+ $(this).addClass('panel-draggable');
+ var draggable = Drupal.Panels.Draggable;
+ var scrollBuffer = 10;
+ var scrollDistance = 10;
+ var scrollTimer = 30;
- if (ev.pageX || ev.pageY) {
- return { x:ev.pageX, y:ev.pageY };
- }
- return {
- x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
- y:ev.clientY + document.body.scrollTop - document.body.clientTop
- };
+ getMouseOffset = function(docPos, mousePos, windowPos) {
+ return { x: mousePos.x - docPos.x + windowPos.x, y: mousePos.y - docPos.y + windowPos.y};
+ };
+
+ getMousePos = function(ev) {
+ ev = ev || window.event;
+
+ if (ev.pageX || ev.pageY) {
+ return { x:ev.pageX, y:ev.pageY };
+ }
+ return {
+ x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
+ y:ev.clientY + document.body.scrollTop - document.body.clientTop
};
+ };
- getPosition = function(e) {
- /*
- if (document.defaultView && document.defaultView.getComputedStyle) {
- var css = document.defaultView.getComputedStyle(e, null);
- return {
- x: parseInt(css.getPropertyValue('left')),
- y: parseInt(css.getPropertyValue('top'))
- };
- }
- */
- var left = 0;
- var top = 0;
-
- while (e.offsetParent) {
- left += e.offsetLeft;
- top += e.offsetTop;
- e = e.offsetParent;
- }
+ getPosition = function(e) {
+ /*
+ if (document.defaultView && document.defaultView.getComputedStyle) {
+ var css = document.defaultView.getComputedStyle(e, null);
+ return {
+ x: parseInt(css.getPropertyValue('left')),
+ y: parseInt(css.getPropertyValue('top'))
+ };
+ }
+ */
+ var left = 0;
+ var top = 0;
+ while (e.offsetParent) {
left += e.offsetLeft;
top += e.offsetTop;
+ e = e.offsetParent;
+ }
- return { x:left, y:top };
- };
+ left += e.offsetLeft;
+ top += e.offsetTop;
- mouseUp = function(e) {
- clearTimeout(draggable.timeoutId);
- draggable.dropzones = [];
+ return { x:left, y:top };
+ };
- if (draggable.current_pad) {
- // Drop the object where we're hovering
- $(draggable.object).insertAfter($(draggable.current_pad.obj));
- Drupal.Panels.changed($(draggable.object));
- }
- else {
- // or put it back where it came from
- $(draggable.object).insertAfter(draggable.placeholder);
- }
- // remove the placeholder
- draggable.placeholder.remove();
+ mouseUp = function(e) {
+ clearTimeout(draggable.timeoutId);
+ draggable.dropzones = [];
- // restore original settings.
- $(draggable.object).css(draggable.original);
- if (draggable.current_dropzone) {
- draggable.unsetDropZone();
- }
+ if (draggable.current_pad) {
+ // Drop the object where we're hovering
+ $(draggable.object).insertAfter($(draggable.current_pad.obj));
+ Drupal.Panels.changed($(draggable.object));
+ }
+ else {
+ // or put it back where it came from
+ $(draggable.object).insertAfter(draggable.placeholder);
+ }
+ // remove the placeholder
+ draggable.placeholder.remove();
- $(document).unbind('mouseup').unbind('mousemove');
- draggable.savePositions();
- };
+ // restore original settings.
+ $(draggable.object).css(draggable.original);
+ if (draggable.current_dropzone) {
+ draggable.unsetDropZone();
+ }
- mouseMove = function(e) {
- draggable.mousePos = getMousePos(e);
+ $(document).unbind('mouseup').unbind('mousemove');
+ draggable.savePositions();
+ };
- draggable.findDropZone(draggable.mousePos.x, draggable.mousePos.y);
+ mouseMove = function(e) {
+ draggable.mousePos = getMousePos(e);
- var windowMoved = parseInt(draggable.offsetDivHeight - $(draggable.main).innerHeight());
+ draggable.findDropZone(draggable.mousePos.x, draggable.mousePos.y);
- draggable.object.style.top = draggable.mousePos.y - draggable.mouseOffset.y + windowMoved + 'px';
- draggable.object.style.left = draggable.mousePos.x - draggable.mouseOffset.x + 'px';
- $(draggable.object).toggleClass('moving');
- };
+ var windowMoved = parseInt(draggable.offsetDivHeight - $(draggable.main).innerHeight());
- mouseDown = function(e) {
- // If we mouse-downed over something clickable, don't drag!
- if (e.target.nodeName == 'A' || e.target.nodeName == 'INPUT' || e.target.parentNode.nodeName == 'A' || e.target.nodeName.nodeName == 'INPUT') {
- return;
- }
+ draggable.object.style.top = draggable.mousePos.y - draggable.mouseOffset.y + windowMoved + 'px';
+ draggable.object.style.left = draggable.mousePos.x - draggable.mouseOffset.x + 'px';
+ $(draggable.object).toggleClass('moving');
+ };
- draggable.object = $(this).parent(draggable.draggable).get(0);
-
- // create a placeholder so we can put this object back if dropped in an invalid location.
- draggable.placeholder = $('"');
- $(draggable.object).after(draggable.placeholder);
-
- // Store original CSS so we can put it back.
- draggable.original = {
- position: $(draggable.object).css('position'),
- width: 'auto',
- left: $(draggable.object).css('left'),
- top: $(draggable.object).css('top'),
- 'z-index': $(draggable.object).css('z-index'),
- 'margin-bottom': $(draggable.object).css('margin-bottom'),
- 'margin-top': $(draggable.object).css('margin-top'),
- 'margin-left': $(draggable.object).css('margin-left'),
- 'margin-right': $(draggable.object).css('margin-right'),
- 'padding-bottom': $(draggable.object).css('padding-bottom'),
- 'padding-top': $(draggable.object).css('padding-top'),
- 'padding-left': $(draggable.object).css('padding-left'),
- 'padding-right': $(draggable.object).css('padding-right')
- };
+ mouseDown = function(e) {
+ // If we mouse-downed over something clickable, don't drag!
+ if (e.target.nodeName == 'A' || e.target.nodeName == 'INPUT' || e.target.parentNode.nodeName == 'A' || e.target.nodeName.nodeName == 'INPUT') {
+ return;
+ }
- draggable.mousePos = getMousePos(e);
- var originalPos = $(draggable.object).offset();
- var width = Math.min($(draggable.object).innerWidth(), draggable.maxWidth);
+ draggable.object = $(this).parent(draggable.draggable).get(0);
+
+ // create a placeholder so we can put this object back if dropped in an invalid location.
+ draggable.placeholder = $('"');
+ $(draggable.object).after(draggable.placeholder);
+
+ // Store original CSS so we can put it back.
+ draggable.original = {
+ position: $(draggable.object).css('position'),
+ width: 'auto',
+ left: $(draggable.object).css('left'),
+ top: $(draggable.object).css('top'),
+ 'z-index': $(draggable.object).css('z-index'),
+ 'margin-bottom': $(draggable.object).css('margin-bottom'),
+ 'margin-top': $(draggable.object).css('margin-top'),
+ 'margin-left': $(draggable.object).css('margin-left'),
+ 'margin-right': $(draggable.object).css('margin-right'),
+ 'padding-bottom': $(draggable.object).css('padding-bottom'),
+ 'padding-top': $(draggable.object).css('padding-top'),
+ 'padding-left': $(draggable.object).css('padding-left'),
+ 'padding-right': $(draggable.object).css('padding-right')
+ };
- draggable.offsetDivHeight = $(draggable.main).innerHeight();
- draggable.findDropZone(draggable.mousePos.x, draggable.mousePos.y);
+ draggable.mousePos = getMousePos(e);
+ var originalPos = $(draggable.object).offset();
+ var width = Math.min($(draggable.object).innerWidth(), draggable.maxWidth);
- // Make copies of these because in FF3, they actually change when we
- // move the item, whereas they did not in FF2.
+ draggable.offsetDivHeight = $(draggable.main).innerHeight();
+ draggable.findDropZone(draggable.mousePos.x, draggable.mousePos.y);
- if (e.layerX || e.layerY) {
- var layerX = e.layerX;
- var layerY = e.layerY;
- }
- else if (e.originalEvent && e.originalEvent.layerX) {
- var layerX = e.originalEvent.layerX;
- var layerY = e.originalEvent.layerY;
- }
+ // Make copies of these because in FF3, they actually change when we
+ // move the item, whereas they did not in FF2.
- // Make the draggable relative, get it out of the way and make it
- // invisible.
- $(draggable.object).css({
- position: 'relative',
- 'z-index': 100,
- width: width + 'px',
- 'margin-bottom': (-1 * parseInt($(draggable.object).outerHeight())) + 'px',
- 'margin-top': 0,
- 'margin-left': 0,
- 'margin-right': (-1 * parseInt($(draggable.object).outerWidth())) + 'px',
- 'padding-bottom': 0,
- 'padding-top': 0,
- 'padding-left': 0,
- 'padding-right': 0,
- 'left': 0,
- 'top': 0
- })
- .insertAfter($(draggable.main));
- var newPos = $(draggable.object).offset();
-
- var windowOffset = { left: originalPos.left - newPos.left, top: originalPos.top - newPos.top }
-
- // if they grabbed outside the area where we make the draggable smaller, move it
- // closer to the cursor.
- if (layerX != 'undefined' && layerX > width) {
- windowOffset.left += layerX - 10;
- }
- else if (layerX != 'undefined' && e.offsetX > width) {
- windowOffset.left += e.offsetX - 10;
- }
+ if (e.layerX || e.layerY) {
+ var layerX = e.layerX;
+ var layerY = e.layerY;
+ }
+ else if (e.originalEvent && e.originalEvent.layerX) {
+ var layerX = e.originalEvent.layerX;
+ var layerY = e.originalEvent.layerY;
+ }
- // This is stored so we can move with it.
- draggable.mouseOffset = { x: draggable.mousePos.x - windowOffset.left, y: draggable.mousePos.y - windowOffset.top};
- draggable.offsetDivHeight = $(draggable.main).innerHeight();
+ // Make the draggable relative, get it out of the way and make it
+ // invisible.
+ $(draggable.object).css({
+ position: 'relative',
+ 'z-index': 100,
+ width: width + 'px',
+ 'margin-bottom': (-1 * parseInt($(draggable.object).outerHeight())) + 'px',
+ 'margin-top': 0,
+ 'margin-left': 0,
+ 'margin-right': (-1 * parseInt($(draggable.object).outerWidth())) + 'px',
+ 'padding-bottom': 0,
+ 'padding-top': 0,
+ 'padding-left': 0,
+ 'padding-right': 0,
+ 'left': 0,
+ 'top': 0
+ })
+ .insertAfter($(draggable.main));
+ var newPos = $(draggable.object).offset();
+
+ var windowOffset = { left: originalPos.left - newPos.left, top: originalPos.top - newPos.top }
+
+ // if they grabbed outside the area where we make the draggable smaller, move it
+ // closer to the cursor.
+ if (layerX != 'undefined' && layerX > width) {
+ windowOffset.left += layerX - 10;
+ }
+ else if (layerX != 'undefined' && e.offsetX > width) {
+ windowOffset.left += e.offsetX - 10;
+ }
- draggable.object.style.top = windowOffset.top + 'px';
- draggable.object.style.left = windowOffset.left + 'px';
- $(document).unbind('mouseup').unbind('mousemove').mouseup(mouseUp).mousemove(mouseMove);
+ // This is stored so we can move with it.
+ draggable.mouseOffset = { x: draggable.mousePos.x - windowOffset.left, y: draggable.mousePos.y - windowOffset.top};
+ draggable.offsetDivHeight = $(draggable.main).innerHeight();
- draggable.calculateDropZones(draggable.mousePos, e);
- draggable.timeoutId = setTimeout('timer()', scrollTimer);
- return false;
- };
+ draggable.object.style.top = windowOffset.top + 'px';
+ draggable.object.style.left = windowOffset.left + 'px';
+ $(document).unbind('mouseup').unbind('mousemove').mouseup(mouseUp).mousemove(mouseMove);
- timer = function() {
- if (!draggable.timeCount) {
- draggable.timeCount = 0;
- }
- draggable.timeCount = draggable.timeCount + 1;
- var left = $(window).scrollLeft();
- var right = left + $(window).width();
- var top = $(window).scrollTop();
- var bottom = top + $(window).height();
-
- if (draggable.mousePos.x < left + scrollBuffer && left > 0) {
- window.scrollTo(left - scrollDistance, top);
- draggable.mousePos.x -= scrollDistance;
- draggable.object.style.top = draggable.mousePos.y - draggable.mouseOffset.y + 'px';
- }
- else if (draggable.mousePos.x > right - scrollBuffer) {
- window.scrollTo(left + scrollDistance, top);
- draggable.mousePos.x += scrollDistance;
- draggable.object.style.top = draggable.mousePos.y - draggable.mouseOffset.y + 'px';
- }
- else if (draggable.mousePos.y < top + scrollBuffer && top > 0) {
- window.scrollTo(left, top - scrollDistance);
- draggable.mousePos.y -= scrollDistance;
- draggable.object.style.top = draggable.mousePos.y - draggable.mouseOffset.y + 'px';
- }
- else if (draggable.mousePos.y > bottom - scrollBuffer) {
- window.scrollTo(left, top + scrollDistance);
- draggable.mousePos.y += scrollDistance;
- draggable.object.style.top = draggable.mousePos.y - draggable.mouseOffset.y + 'px';
- }
+ draggable.calculateDropZones(draggable.mousePos, e);
+ draggable.timeoutId = setTimeout('timer()', scrollTimer);
+ return false;
+ };
- draggable.timeoutId = setTimeout('timer()', scrollTimer);
+ timer = function() {
+ if (!draggable.timeCount) {
+ draggable.timeCount = 0;
+ }
+ draggable.timeCount = draggable.timeCount + 1;
+ var left = $(window).scrollLeft();
+ var right = left + $(window).width();
+ var top = $(window).scrollTop();
+ var bottom = top + $(window).height();
+
+ if (draggable.mousePos.x < left + scrollBuffer && left > 0) {
+ window.scrollTo(left - scrollDistance, top);
+ draggable.mousePos.x -= scrollDistance;
+ draggable.object.style.top = draggable.mousePos.y - draggable.mouseOffset.y + 'px';
+ }
+ else if (draggable.mousePos.x > right - scrollBuffer) {
+ window.scrollTo(left + scrollDistance, top);
+ draggable.mousePos.x += scrollDistance;
+ draggable.object.style.top = draggable.mousePos.y - draggable.mouseOffset.y + 'px';
+ }
+ else if (draggable.mousePos.y < top + scrollBuffer && top > 0) {
+ window.scrollTo(left, top - scrollDistance);
+ draggable.mousePos.y -= scrollDistance;
+ draggable.object.style.top = draggable.mousePos.y - draggable.mouseOffset.y + 'px';
+ }
+ else if (draggable.mousePos.y > bottom - scrollBuffer) {
+ window.scrollTo(left, top + scrollDistance);
+ draggable.mousePos.y += scrollDistance;
+ draggable.object.style.top = draggable.mousePos.y - draggable.mouseOffset.y + 'px';
}
- $(this).mousedown(mouseDown);
- };
+ draggable.timeoutId = setTimeout('timer()', scrollTimer);
+ }
- $.fn.extend({
- panelsDraggable: Drupal.Panels.DraggableHandler
- });
+ $(this).mousedown(mouseDown);
+};
- /**
- * Implement Drupal behavior for autoattach
- */
- Drupal.behaviors.PanelsDisplayEditor = function(context) {
+$.fn.extend({
+ panelsDraggable: Drupal.Panels.DraggableHandler
+});
+
+/**
+ * Implement Drupal behavior for autoattach
+ */
+Drupal.behaviors.PanelsDisplayEditor = {
+ attach: function(context) {
// Show javascript only items.
$('span#panels-js-only').css('display', 'inline');
@@ -478,10 +481,16 @@
.addClass('panels-preview-processed')
.click(function () {
if (!$('#panels-preview').size()) {
- $('#panels-dnd-main').parents('form').after('');
+ $('#panels-dnd-main').parents('form').after('');
}
-
- $('#panels-preview').html(Drupal.theme('CToolsModalThrobber'));
+ var html = '';
+ html += '
';
+ html += '
';
+ html += Drupal.settings.CToolsModal.throbber;
+ html += '
';
+ html += '
';
+
+ $('#panels-preview').html(html);
});
var setTitleClass = function () {
@@ -502,13 +511,16 @@
.change(setTitleClass);
setTitleClass();
- };
+ }
+}
+$(function() {
/**
* AJAX responder command to render the preview.
*/
- Drupal.CTools.AJAX.commands.panel_preview = function(command) {
+ Drupal.ajax.prototype.commands.panel_preview = function(ajax, command, status) {
$('#panels-preview').html(command.output);
}
+});
})(jQuery);
diff --git a/panels.info b/panels.info
index 8612a4b430c6e794c348f279ed0050fe40af46f8..afaa7efbfb24aa725c98f54c72c01dec5fa34faf 100644
--- a/panels.info
+++ b/panels.info
@@ -1,6 +1,12 @@
; $Id$
name = Panels
description = Core Panels display functions; provides no external UI, at least one other Panels module should be enabled.
-core = 6.x
+core = 7.x
package = "Panels"
+configure = admin/structure/panels
dependencies[] = ctools
+files[] = panels.module
+files[] = includes/common.inc
+files[] = includes/legacy.inc
+files[] = includes/plugins.inc
+files[] = plugins/views/panels_views_plugin_row_fields.inc
diff --git a/panels.install b/panels.install
index 7d350c95db0ed54c38416716fcf8a4c94c48c76e..60697cc8c6447d93e0f13e6a959481ee92d53fb0 100644
--- a/panels.install
+++ b/panels.install
@@ -69,10 +69,10 @@ function panels_requirements_runtime() {
$modules[] = array('data' => check_plain($module) . ' - ' . $type);
}
- $list[] = array('data' => $values['explanation'] ."\n" . theme('item_list', $modules));
+ $list[] = array('data' => $values['explanation'] ."\n" . theme('item_list', array('items' => $modules)));
}
- $description .= theme('item_list', $list);
+ $description .= theme('item_list', array('items' => $list));
$requirements['panels_legacy'] = array(
'title' => $t('Panels operating in Legacy mode'),
@@ -383,20 +383,6 @@ function panels_schema_1() {
return $schema;
}
-/**
- * Implementation of hook_install().
- */
-function panels_install() {
- drupal_install_schema('panels');
-}
-
-/**
- * Implementation of hook_uninstall().
- */
-function panels_uninstall() {
- drupal_uninstall_schema('panels');
-}
-
function panels_update_1000() {
// Panels D6 2 had *no* update functions in it, so the schema version is
// completely wrong. If we run this update with no schema version, we
diff --git a/panels.module b/panels.module
index bd74c68b2ae222a2127ab4e083823088cbbb5899..978d59223378a2ece904bbdbb2e1e36276894904 100644
--- a/panels.module
+++ b/panels.module
@@ -7,7 +7,7 @@
* Core functionality for the Panels engine.
*/
-define('PANELS_REQUIRED_CTOOLS_API', '1.8');
+define('PANELS_REQUIRED_CTOOLS_API', '2.0-alpha');
define('PANELS_TITLE_FIXED', 0); // Hide title use to be true/false. So false remains old behavior.
define('PANELS_TITLE_NONE', 1); // And true meant no title.
@@ -16,6 +16,8 @@ define('PANELS_TITLE_PANE', 2); // And this is the new behavior, where the title
/**
* Returns the API version of Panels. This didn't exist in 1.
*
+ * @todo -- this should work more like the CTools API version.
+ *
* @return An array with the major and minor versions
*/
function panels_api_version() {
@@ -36,40 +38,40 @@ function panels_theme() {
$theme = array();
$theme['panels_layout_link'] = array(
- 'arguments' => array('title', 'id', 'image', 'link'),
+ 'variables' => array('title' => NULL, 'id' => NULL, 'image' => NULL, 'link' => NULL),
);
$theme['panels_layout_icon'] = array(
- 'arguments' => array('id', 'image', 'title' => NULL),
+ 'variables' => array('id' => NULL, 'image' => NULL, 'title' => NULL),
);
$theme['panels_pane'] = array(
- 'arguments' => array('output' => array(), 'pane' => array(), 'display' => array()),
+ 'variables' => array('output' => array(), 'pane' => array(), 'display' => array()),
'path' => drupal_get_path('module', 'panels') . '/templates',
'template' => 'panels-pane',
);
$theme['panels_common_content_list'] = array(
- 'arguments' => array('display'),
+ 'variables' => array('display' => NULL),
'file' => 'includes/common.inc',
);
$theme['panels_render_display_form'] = array(
- 'arguments' => array('form' => NULL),
+ 'variables' => array('form' => NULL),
);
$theme['panels_dashboard'] = array(
- 'arguments' => array(),
+ 'variables' => array(),
'path' => drupal_get_path('module', 'panels') . '/templates',
'file' => '../includes/callbacks.inc',
'template' => 'panels-dashboard',
);
$theme['panels_dashboard_link'] = array(
- 'arguments' => array('link' => array()),
+ 'variables' => array('link' => array()),
'path' => drupal_get_path('module', 'panels') . '/templates',
'file' => '../includes/callbacks.inc',
'template' => 'panels-dashboard-link',
);
$theme['panels_dashboard_block'] = array(
- 'arguments' => array('block' => array()),
+ 'variables' => array('block' => array()),
'path' => drupal_get_path('module', 'panels') . '/templates',
'file' => '../includes/callbacks.inc',
'template' => 'panels-dashboard-block',
@@ -90,7 +92,7 @@ function panels_theme() {
foreach (array('theme', 'admin theme') as $callback) {
if (!empty($data[$callback])) {
$theme[$data[$callback]] = array(
- 'arguments' => array('css_id' => NULL, 'content' => NULL, 'settings' => NULL, 'display' => NULL, 'layout' => NULL, 'renderer' => NULL),
+ 'variables' => array('css_id' => NULL, 'content' => NULL, 'settings' => NULL, 'display' => NULL, 'layout' => NULL, 'renderer' => NULL),
'path' => $data['path'],
'file' => $data['file'],
);
@@ -108,24 +110,14 @@ function panels_theme() {
foreach ($styles as $name => $data) {
if (!empty($data['render pane'])) {
$theme[$data['render pane']] = array(
- 'arguments' => array('output' => NULL, 'pane' => NULL, 'display' => NULL, 'style' => NULL),
+ 'variables' => array('content' => NULL, 'pane' => NULL, 'display' => NULL, 'style' => NULL, 'settings' => NULL),
'path' => $data['path'],
'file' => $data['file'],
);
}
- // If we're in legacy mode, include the old callback key for legacy styles.
- if (variable_get('panels_legacy_rendering_mode', TRUE)) {
- if (!empty($data['render panel'])) {
- $theme[$data['render panel']] = array(
- 'arguments' => array('display' => NULL, 'panel_id' => NULL, 'panes' => NULL, 'settings' => NULL, 'style' => NULL),
- 'path' => $data['path'],
- 'file' => $data['file'],
- );
- }
- }
if (!empty($data['render region'])) {
$theme[$data['render region']] = array(
- 'arguments' => array('display' => NULL, 'region_id' => NULL, 'panes' => NULL, 'settings' => NULL, 'style' => NULL),
+ 'variables' => array('display' => NULL, 'owner_id' => NULL, 'panes' => NULL, 'settings' => NULL, 'region_id' => NULL, 'style' => NULL),
'path' => $data['path'],
'file' => $data['file'],
);
@@ -166,27 +158,27 @@ function panels_menu() {
'access arguments' => array('use panels dashboard'),
);
// Provide a nice location for a panels admin panel.
- $items['admin/build/panels'] = array(
+ $items['admin/structure/panels'] = array(
'title' => 'Panels',
'page callback' => 'panels_admin_page',
'description' => 'Get a bird\'s eye view of items related to Panels.',
) + $admin_base;
- $items['admin/build/panels/dashboard'] = array(
+ $items['admin/structure/panels/dashboard'] = array(
'title' => 'Dashboard',
'page callback' => 'panels_admin_page',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
) + $admin_base;
- $items['admin/build/panels/settings'] = array(
+ $items['admin/structure/panels/settings'] = array(
'title' => 'Settings',
'page callback' => 'drupal_get_form',
'page arguments' => array('panels_admin_settings_page'),
'type' => MENU_LOCAL_TASK,
) + $admin_base;
- $items['admin/build/panels/settings/general'] = array(
+ $items['admin/structure/panels/settings/general'] = array(
'title' => 'General',
'page callback' => 'drupal_get_form',
'page arguments' => array('panels_admin_settings_page'),
@@ -196,7 +188,7 @@ function panels_menu() {
) + $admin_base;
if (module_exists('page_manager')) {
- $items['admin/build/panels/settings/panel-page'] = array(
+ $items['admin/structure/panels/settings/panel-page'] = array(
'title' => 'Panel pages',
'page callback' => 'panels_admin_panel_context_page',
'type' => MENU_LOCAL_TASK,
@@ -254,19 +246,40 @@ function panels_init() {
}
/**
- * Implementation of hook_perm
+ * Implementation of hook_permission().
+ *
+ * @todo Almost all of these need to be moved into pipelines.
*/
-function panels_perm() {
+function panels_permission() {
return array(
- 'view all panes',
- 'view pane admin links',
- 'administer pane visibility',
- 'administer pane access',
- 'administer advanced pane settings',
- 'administer panels layouts',
- 'use panels caching features',
- 'use panels dashboard',
- 'use panels in place editing',
+ 'use panels dashboard' => array(
+ 'title' => t("Use Panels Dashboard"),
+ 'description' => t("Allows a user to access the !link.", array('!link' => l('Panels Dashboard', 'admin/structure/panels'))),
+ ),
+ 'view pane admin links' => array( // @todo
+ 'title' => t("View administrative links on Panel panes"),
+ 'description' => t(""),
+ ),
+ 'administer pane access' => array( // @todo should we really have a global perm for this, or should it be moved into a pipeline question?
+ 'title' => t("Configure access settings on Panel panes"),
+ 'description' => t("Access rules (often also called visibility rules) can be configured on a per-pane basis. This permission allows users to configure those settings."),
+ ),
+ 'use panels in place editing' => array(
+ 'title' => t("Use the Panels In-Place Editor"),
+ 'description' => t("Allows a user to utilize Panels' In-Place Editor."),
+ ),
+ 'administer advanced pane settings' => array(
+ 'title' => t("Configure advanced settings on Panel panes"),
+ 'description' => t(""),
+ ),
+ 'administer panels layouts' => array(
+ 'title' => t("Administer Panels layouts"),
+ 'description' => t("Allows a user to administer exported Panels layout plugins & instances."),
+ ),
+ 'use panels caching features' => array(
+ 'title' => t("Configure caching settings on Panels"),
+ 'description' => t("Allows a user to configure caching on Panels displays and panes."),
+ ),
);
}
@@ -276,10 +289,10 @@ function panels_perm() {
* We implement this so that we can be sure our legacy rendering state setting
* in $conf is updated whenever caches are cleared.
*/
-function panels_flush_caches() {
- $legacy = panels_get_legacy_state();
- $legacy->determineStatus();
-}
+//function panels_flush_caches() {
+// $legacy = panels_get_legacy_state();
+// $legacy->determineStatus();
+//}
// ---------------------------------------------------------------------------
// CTools hook implementations
@@ -295,20 +308,33 @@ function panels_ctools_plugin_directory($module, $plugin) {
if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
return;
}
- if ($module == 'page_manager' || $module == 'panels' || $module == 'ctools') {
+ if ($module == 'page_manager' || $module == 'panels' || $module == 'ctools' || $module == 'stylizer') {
return 'plugins/' . $plugin;
}
}
/**
- * Inform CTools that the layout plugin can be loaded from themes.
+ * Implements hook_ctools_plugin_type().
+ *
+ * Register layout, style, cache, and display_renderer plugin types, declaring
+ * relevant plugin type information as necessary.
*/
-function panels_ctools_plugin_layouts() {
+function panels_ctools_plugin_type() {
return array(
- 'load themes' => TRUE,
- 'use hooks' => TRUE,
- 'process' => 'panels_layout_process',
- 'child plugins' => TRUE,
+ 'layouts' => array(
+ 'load themes' => TRUE, // Can define layouts in themes
+ 'process' => 'panels_layout_process',
+ 'child plugins' => TRUE,
+ ),
+ 'styles' => array(
+ 'load themes' => TRUE,
+ 'process' => 'panels_plugin_styles_process',
+ 'child plugins' => TRUE,
+ ),
+ 'cache' => array(),
+ 'display_renderers' => array(
+ 'classes' => array('renderer'),
+ ),
);
}
@@ -322,18 +348,6 @@ function panels_layout_process(&$plugin) {
);
}
-/**
- * Inform CTools that the style plugin can be loaded from themes.
- */
-function panels_ctools_plugin_styles() {
- return array(
- 'load themes' => TRUE,
- 'use hooks' => TRUE,
- 'process' => 'panels_plugin_styles_process',
- 'child plugins' => TRUE,
- );
-}
-
/**
* Implementation of hook_ctools_plugin_api().
*
@@ -402,12 +416,12 @@ function panels_ctools_style_base_types() {
'region' => array(
'title' => t('Panel region'),
'preview' => 'panels_stylizer_region_preview',
- 'theme arguments' => array('settings' => NULL, 'classes' => NULL, 'content' => NULL),
+ 'theme variables' => array('settings' => NULL, 'class' => NULL, 'content' => NULL),
),
'pane' => array(
'title' => t('Panel pane'),
'preview' => 'panels_stylizer_pane_preview',
- 'theme arguments' => array('settings' => NULL, 'content' => NULL, 'pane' => NULL, 'display' => NULL),
+ 'theme variables' => array('settings' => NULL, 'content' => NULL, 'pane' => NULL, 'display' => NULL),
),
);
}
@@ -425,7 +439,7 @@ function panels_stylizer_lipsum() {
*/
function panels_stylizer_region_preview($plugin, $settings) {
ctools_stylizer_add_css($plugin, $settings);
- return theme($plugin['theme'], $settings, ctools_stylizer_get_css_class($plugin, $settings), panels_stylizer_lipsum());
+ return theme($plugin['theme'], array('settings' => $settings, 'class' => ctools_stylizer_get_css_class($plugin, $settings), 'content' => panels_stylizer_lipsum()));
}
/**
@@ -446,10 +460,10 @@ function panels_stylizer_pane_preview($plugin, $settings) {
$display = new panels_display();
if (!empty($plugin['theme'])) {
- return theme($plugin['theme'], $settings, $content, $pane, $display);
+ return theme($plugin['theme'], array('settings' => $settings, 'content' => $content, 'pane' => $pane, 'display' => $display));
}
else {
- return theme('panels_pane', $content, $pane, $display);
+ return theme('panels_pane', array('output' => $content, 'pane' => $pane, 'display' => $display));
}
}
@@ -585,13 +599,7 @@ class panels_display {
var $css_id = NULL;
var $context = array();
var $did = 'new';
- var $renderer;
-
- function panels_display() {
- // Set the default renderer to either the legacy or the standard renderer,
- // depending on the legacy rendering state
- $this->renderer = variable_get('panels_legacy_rendering_mode', TRUE) ? 'legacy' : 'standard';
- }
+ var $renderer = 'standard';
function add_pane(&$pane, $location = NULL) {
// If no location specified, use what's set in the pane.
@@ -759,17 +767,16 @@ function panels_load_displays($dids) {
return $displays;
}
- $result = db_query("SELECT * FROM {panels_display} WHERE did IN (" . db_placeholders($dids) . ")", $dids);
+ $result = db_query("SELECT * FROM {panels_display} WHERE did IN (:dids)", array(':dids' => $dids));
ctools_include('export');
- while ($obj = db_fetch_object($result)) {
+ foreach ($result as $obj) {
$displays[$obj->did] = ctools_export_unpack_object('panels_display', $obj);
// Modify the hide_title field to go from a bool to an int if necessary.
}
- $result = db_query("SELECT * FROM {panels_pane} WHERE did IN (" . db_placeholders($dids) . ") ORDER BY did, panel, position", $dids);
-
- while ($obj = db_fetch_object($result)) {
+ $result = db_query("SELECT * FROM {panels_pane} WHERE did IN (:dids) ORDER BY did, panel, position", array(':dids' => $dids));
+ foreach ($result as $obj) {
$pane = ctools_export_unpack_object('panels_pane', $obj);
$displays[$pane->did]->panels[$pane->panel][] = $pane->pid;
@@ -836,8 +843,8 @@ function panels_save_display(&$display) {
if ($update) {
// Get a list of all panes currently in the database for this display so we can know if there
// are panes that need to be deleted. (i.e, aren't currently in our list of panes).
- $result = db_query("SELECT pid FROM {panels_pane} WHERE did = %d", $display->did);
- while ($pane = db_fetch_object($result)) {
+ $result = db_query("SELECT pid FROM {panels_pane} WHERE did = :did", array(':did' => $display->did));
+ foreach ($result as $pane) {
$pids[$pane->pid] = $pane->pid;
}
}
@@ -874,7 +881,12 @@ function panels_save_display(&$display) {
// Do a simple update query to write it so we don't have to rewrite
// the whole record. We can't just save writing the whole record here
// because it was needed to get the did. Chicken, egg, more chicken.
- db_query("UPDATE {panels_display} SET title_pane = %d WHERE did = %d", $pane->pid, $display->did);
+ db_update('panels_display')
+ ->fields(array(
+ 'title_pane' => $pane->pid
+ ))
+ ->condition('did', $display->did)
+ ->execute();
}
}
@@ -890,7 +902,7 @@ function panels_save_display(&$display) {
$display->panels[$id] = $new_panes;
}
if (!empty($pids)) {
- db_query("DELETE FROM {panels_pane} WHERE pid IN (" . db_placeholders($pids) . ")", $pids);
+ db_delete('panels_pane')->condition('pid', $pids)->execute();
}
// Clear any cached content for this display.
@@ -923,8 +935,8 @@ function panels_delete_display($display) {
else {
$did = $display;
}
- db_query("DELETE FROM {panels_display} WHERE did = %d", $did);
- db_query("DELETE FROM {panels_pane} WHERE did = %d", $did);
+ db_delete('panels_display')->condition('did', $did)->execute();
+ db_delete('panels_pane')->condition('did', $did)->execute();
}
/**
@@ -1008,7 +1020,6 @@ function panels_export_display($display, $prefix = '') {
* @ingroup hook_invocations
*/
function panels_render_display(&$display, $renderer = NULL) {
- ctools_include('display-render', 'panels');
ctools_include('plugins', 'panels');
ctools_include('context');
@@ -1031,17 +1042,18 @@ function panels_render_display(&$display, $renderer = NULL) {
* panes. This sets up the form system to be the main caller and we
* then operate as a theme function of the form.
*/
-function theme_panels_render_display_form($form) {
- $form['#children'] = $form['#display']->render();
- drupal_render($form);
- return theme('form', $form);
+function theme_panels_render_display_form($vars) {
+ // @todo this is probably broken in D7
+ $vars['form']['#children'] = $vars['form']['#display']->render();
+ render($vars['form']);
+ return theme('form', $vars);
}
// @layout
function panels_print_layout_icon($id, $layout, $title = NULL) {
ctools_add_css('panels_admin', 'panels');
$file = $layout['path'] . '/' . $layout['icon'];
- return theme('panels_layout_icon', $id, theme('image', $file, strip_tags($layout['title']), strip_tags($layout['description'])), $title);
+ return theme('panels_layout_icon', array('id' => $id, 'image' => theme('image', array('path' => $file, 'alt' => strip_tags($layout['title']), 'title' => strip_tags($layout['description']))), 'title' => $title));
}
/**
@@ -1049,7 +1061,11 @@ function panels_print_layout_icon($id, $layout, $title = NULL) {
* @layout
* @todo move to theme.inc
*/
-function theme_panels_layout_icon($id, $image, $title = NULL) {
+function theme_panels_layout_icon($vars) {
+ $id = $vars['id'];
+ $image = $vars['image'];
+ $title = $vars['title'];
+
$output = '
';
$output .= $image;
if ($title) {
@@ -1062,11 +1078,17 @@ function theme_panels_layout_icon($id, $image, $title = NULL) {
/**
* Theme the layout link image
* @layout
+ *
+ * @todo Why isn't this a template at this point?
+ * @todo Why does this take 4 arguments but only makes use of two?
*/
-function theme_panels_layout_link($title, $id, $image, $link) {
+function theme_panels_layout_link($vars) {
+ $title = $vars['title'];
+ $image = $vars['image'];
+
$output = '
';
- $output .= $image;
- $output .= '
' . $title . '
';
+ $output .= $vars['image'];
+ $output .= '
' . $vars['title'] . '
';
$output .= '
';
return $output;
}
@@ -1082,9 +1104,9 @@ function panels_print_layout_link($id, $layout, $link, $options = array()) {
ctools_add_css('panels_admin', 'panels');
$file = $layout['path'] . '/' . $layout['icon'];
- $image = l(theme('image', $file), $link, array('html' => true) + $options);
+ $image = l(theme('image', array('path' => $file)), $link, array('html' => true) + $options);
$title = l($layout['title'], $link, $options);
- return theme('panels_layout_link', $title, $id, $image, $link);
+ return theme('panels_layout_link', array('title' => $title, 'image' => $image));
}
@@ -1124,8 +1146,49 @@ function panels_get_current_page_display($change = NULL) {
/**
* Clean up the panel pane variables for the template.
*/
-function template_preprocess_panels_pane($vars) {
- $content = $vars['output'];
+function template_preprocess_panels_pane(&$vars) {
+ $content = &$vars['content'];
+
+ $vars['contextual_links'] = array();
+ $vars['classes_array'] = array();
+ $vars['admin_links'] = '';
+
+ if (user_access('access contextual links')) {
+ $links = array();
+ // These are specified by the content.
+ if (!empty($content->admin_links)) {
+ $links += $content->admin_links;
+ }
+
+ // Take any that may have been in the render array we were given and
+ // move them up so they appear outside the pane properly.
+ if (is_array($content->content) && isset($content->content['#contextual_links'])) {
+ $element = array(
+ '#type' => 'contextual_links',
+ '#contextual_links' => $content->content['#contextual_links'],
+ );
+ unset($content->content['#contextual_links']);
+
+ $element = contextual_pre_render_links($element);
+ $links += $element['#links'];
+ }
+
+ if ($links) {
+ $build = array(
+ '#prefix' => '
',
+ '#suffix' => '
',
+ '#theme' => 'links__contextual',
+ '#links' => $links,
+ '#attributes' => array('class' => array('contextual-links')),
+ '#attached' => array(
+ 'library' => array(array('contextual', 'contextual-links')),
+ ),
+ );
+ $vars['classes_array'][] = 'contextual-links-region';
+ $vars['admin_links'] = drupal_render($build);
+ }
+ }
+
// basic classes
$vars['classes'] = 'panel-pane';
$vars['id'] = '';
@@ -1153,18 +1216,11 @@ function template_preprocess_panels_pane($vars) {
}
}
- // administrative links, only if there is permission.
- $vars['admin_links'] = '';
- if (user_access('view pane admin links') && !empty($content->admin_links)) {
- $vars['admin_links'] = theme('links', $content->admin_links);
- }
-
$vars['title'] = !empty($content->title) ? $content->title : '';
$vars['feeds'] = !empty($content->feeds) ? implode(' ', $content->feeds) : '';
- $vars['content'] = !empty($content->content) ? $content->content : '';
- $vars['links'] = !empty($content->links) ? theme('links', $content->links) : '';
+ $vars['links'] = !empty($content->links) ? theme('links', array('links' => $content->links)) : '';
$vars['more'] = '';
if (!empty($content->more)) {
if (empty($content->more['title'])) {
@@ -1172,6 +1228,9 @@ function template_preprocess_panels_pane($vars) {
}
$vars['more'] = l($content->more['title'], $content->more['href'], $content->more);
}
+
+ $vars['content'] = !empty($content->content) ? $content->content : '';
+
}
/**
@@ -1233,8 +1292,10 @@ function panels_ajax_router() {
$renderer->clean_key = ctools_cleanstring($cache_key);
$output = call_user_func_array(array($renderer, $method), $args);
+
if (empty($output) && !empty($renderer->commands)) {
- return ctools_ajax_render($renderer->commands);
+ print ajax_render($renderer->commands);
+ ajax_footer();
}
return $output;
}
@@ -1593,20 +1654,6 @@ function panels_print_layout($layout, $content, $meta = 'standard') {
//
// Everything below this line will eventually go away.
-/**
- * Load a panels include file.
- *
- * @deprecated This function is deprecated and should no longer be used. It will
- * be removed in the next major version of Panels. Use ctools_include() instead.
- */
-function panels_load_include($include, $path = 'includes/') {
- static $loaded = array();
- if (empty($loaded["$path$include.inc"])) {
- require_once './' . panels_get_path("$path$include.inc");
- $loaded["$path$include.inc"] = TRUE;
- }
-}
-
/**
* panels path helper function
*/
@@ -1614,72 +1661,3 @@ function panels_get_path($file, $base_path = FALSE, $module = 'panels') {
$output = $base_path ? base_path() : '';
return $output . drupal_get_path('module', $module) . '/' . $file;
}
-
-/**
- * Given a full layout structure and a content array, render a panel display.
- *
- * @deprecated This function represents an old approach to rendering, and is
- * retained only as a temporary support for other modules still using that
- * approach. It will be removed in the next major version of Panels.
- */
-function panels_render_layout($layout, $content, $css_id = NULL, $settings = array(), $display = NULL) {
- if (!empty($layout['css'])) {
- if (file_exists(path_to_theme() . '/' . $layout['css'])) {
- drupal_add_css(path_to_theme() . '/' . $layout['css']);
- }
- else {
- drupal_add_css($layout['path'] . '/' . $layout['css']);
- }
- }
- // This now comes after the CSS is added, because panels-within-panels must
- // have their CSS added in the right order; inner content before outer content.
-
- // If $content is an object, it's a $display and we have to render its panes.
- if (is_object($content)) {
- $display = $content;
- if (empty($display->cache['method'])) {
- $content = panels_render_panes($display);
- }
- else {
- $cache = panels_get_cached_content($display, $display->args, $display->context);
- if ($cache === FALSE) {
- $cache = new panels_cache_object();
- $cache->set_content(panels_render_panes($display));
- panels_set_cached_content($cache, $display, $display->args, $display->context);
- }
- $content = $cache->content;
- }
- }
-
- $output = theme($layout['theme'], check_plain($css_id), $content, $settings, $display);
-
- return $output;
-}
-
-/**
- * Get a list of panel regions available in the layout.
- *
- * @deprecated Use panels_get_regions instead.
- */
-function panels_get_panels($layout, $display) {
- return panels_get_regions($layout, $display);
-}
-
-/**
- * Select a context for a pane.
- *
- * @param $pane
- * A fully populated pane.
- * @param $contexts
- * A keyed array of available contexts.
- *
- * @return
- * The matching contexts or NULL if none or necessary, or FALSE if
- * requirements can't be met.
- *
- * @deprecated this function will be removed.
- */
-function panels_pane_select_context($pane, $contexts) {
- return ctools_content_select_context($pane->type, $pane->subtype, $pane->configuration, $contexts);
-}
-
diff --git a/panels_ipe/css/panels_ipe.css b/panels_ipe/css/panels_ipe.css
index 77edc1589607cfa8171cdd65147f52f9ee39392c..60f0938f3074b1f223a9659904181bff1b2b6c8b 100644
--- a/panels_ipe/css/panels_ipe.css
+++ b/panels_ipe/css/panels_ipe.css
@@ -172,7 +172,7 @@ div#panels-ipe-control-container {
background-color: #000;
padding: 0.5em 1em;
min-width: 9.5em;
- max-width: 12.5em;
+ max-width: 14.5em;
min-height: 2em;
max-height: 2.5em;
-moz-border-radius-topleft:5px;
diff --git a/panels_ipe/js/panels_ipe.js b/panels_ipe/js/panels_ipe.js
index fd1a5c69674d6fd9026ea08989e87cc402e6f037..efe823cf0892d948a9501eef718b9c99f54ff02a 100644
--- a/panels_ipe/js/panels_ipe.js
+++ b/panels_ipe/js/panels_ipe.js
@@ -27,37 +27,9 @@ $(function() {
});
});
-Drupal.behaviors.PanelsIPE = function(context) {
- Drupal.PanelsIPE.bindClickDelete(context);
-};
-
-Drupal.CTools.AJAX.commands.initIPE = function(data) {
- if (Drupal.PanelsIPE.editors[data.key]) {
- Drupal.PanelsIPE.editors[data.key].initEditing(data.data);
- }
-};
-
-Drupal.CTools.AJAX.commands.unlockIPE = function(data) {
- if (confirm(data.message)) {
- var ajaxOptions = {
- type: "POST",
- url: data.break_path,
- data: { 'js': 1 },
- global: true,
- success: Drupal.CTools.AJAX.respond,
- error: function(xhr) {
- Drupal.CTools.AJAX.handleErrors(xhr, ipe.cfg.formPath);
- },
- dataType: 'json'
- };
-
- $.ajax(ajaxOptions);
- };
-};
-
-Drupal.CTools.AJAX.commands.endIPE = function(data) {
- if (Drupal.PanelsIPE.editors[data.key]) {
- Drupal.PanelsIPE.editors[data.key].endEditing(data);
+Drupal.behaviors.PanelsIPE = {
+ attach: function(context) {
+ Drupal.PanelsIPE.bindClickDelete(context);
}
};
@@ -114,37 +86,28 @@ function DrupalPanelsIPE(cache_key, cfg) {
});
$('.panels-ipe-form-container', ipe.control).append(formdata);
- // bind ajax submit to the form
- $('form', ipe.control).submit(function(event) {
- url = $(this).attr('action');
- try {
- var ajaxOptions = {
- type: 'POST',
- url: url,
- data: { 'js': 1 },
- global: true,
- success: Drupal.CTools.AJAX.respond,
- error: function(xhr) {
- Drupal.CTools.AJAX.handleErrors(xhr, url);
- },
- dataType: 'json'
+
+ $('input:submit:not(.ajax-processed)', ipe.control).addClass('ajax-processed').each(function() {
+ var element_settings = {};
+
+ element_settings.url = $(this.form).attr('action');
+ element_settings.setClick = true;
+ element_settings.event = 'click';
+ element_settings.progress = { 'type': 'throbber' };
+
+ var base = $(this).attr('id');
+ Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings);
+ if ($(this).attr('id') == 'panels-ipe-save') {
+ Drupal.ajax[base].options.beforeSerialize = function (element_settings, options) {
+ ipe.saveEditing();
+ return Drupal.ajax[base].beforeSerialize(element_settings, options);
};
- $(this).ajaxSubmit(ajaxOptions);
}
- catch (err) {
- alert("An error occurred while attempting to process " + url);
- return false;
+ if ($(this).attr('id') == 'panels-ipe-cancel') {
+ Drupal.ajax[base].options.beforeSend = function () {
+ return ipe.cancelEditing();
+ };
}
- return false;
- });
-
- $('input:submit', ipe.control).each(function() {
- if ($(this).val() == 'Save') {
- $(this).click(ipe.saveEditing);
- };
- if ($(this).val() == 'Cancel') {
- $(this).click(ipe.cancelEditing);
- };
});
// Perform visual effects in a particular sequence.
@@ -168,9 +131,6 @@ function DrupalPanelsIPE(cache_key, cfg) {
};
this.saveEditing = function() {
- // Put our button in.
- this.form.clk = this;
-
$('div.panels-ipe-region', ipe.topParent).each(function() {
var val = '';
var region = $(this).attr('id').split('panels-ipe-regionid-')[1];
@@ -183,14 +143,11 @@ function DrupalPanelsIPE(cache_key, cfg) {
val += id;
}
});
- $('input#edit-panel-pane-' + region, ipe.control).val(val);
+ $('input[name="panel[pane][' + region + ']"]', ipe.control).val(val);
});
}
this.cancelEditing = function() {
- // Put our button in.
- this.form.clk = this;
-
if (ipe.topParent.hasClass('changed')) {
ipe.changed = true;
}
@@ -233,9 +190,20 @@ function DrupalPanelsIPE(cache_key, cfg) {
this.createSortContainers();
+ var element_settings = {
+ url: ipe.cfg.formPath,
+ event: 'click',
+ keypress: false,
+ // No throbber at all.
+ progress: { 'type': 'none' }
+ };
+
+ Drupal.ajax['ipe-ajax'] = new Drupal.ajax('ipe-ajax', $('div.panels-ipe-startedit', this.control).get(0), element_settings);
+
+/*
var ajaxOptions = {
type: "POST",
- url: ipe.cfg.formPath,
+ url: ,
data: { 'js': 1 },
global: true,
success: Drupal.CTools.AJAX.respond,
@@ -249,6 +217,41 @@ function DrupalPanelsIPE(cache_key, cfg) {
var $this = $(this);
$.ajax(ajaxOptions);
});
+ */
};
+$(function() {
+ Drupal.ajax.prototype.commands.initIPE = function(ajax, data, status) {
+ if (Drupal.PanelsIPE.editors[data.key]) {
+ Drupal.PanelsIPE.editors[data.key].initEditing(data.data);
+ }
+ };
+
+ Drupal.ajax.prototype.commands.unlockIPE = function(ajax, data, status) {
+ if (confirm(data.message)) {
+ var ajaxOptions = {
+ type: "POST",
+ url: data.break_path,
+ data: { 'js': 1 },
+ global: true,
+ success: Drupal.CTools.AJAX.respond,
+ error: function(xhr) {
+ Drupal.CTools.AJAX.handleErrors(xhr, ipe.cfg.formPath);
+ },
+ dataType: 'json'
+ };
+
+ $.ajax(ajaxOptions);
+ };
+ };
+
+ Drupal.ajax.prototype.commands.endIPE = function(ajax, data, status) {
+ if (Drupal.PanelsIPE.editors[data.key]) {
+ Drupal.PanelsIPE.editors[data.key].endEditing(data);
+ }
+ };
+
+
+});
+
})(jQuery);
diff --git a/panels_ipe/panels_ipe.info b/panels_ipe/panels_ipe.info
index c27a2a95c3a4867d3117d1d92c441177e66256c9..817b03476d4016f2262ed3c70833a1f4b98a94d1 100644
--- a/panels_ipe/panels_ipe.info
+++ b/panels_ipe/panels_ipe.info
@@ -3,5 +3,6 @@ name = Panels In-Place Editor
description = Provide a UI for managing some Panels directly on the frontend, instead of having to use the backend.
package = "Panels"
dependencies[] = panels
-dependencies[] = jquery_ui
-core = 6.x
+core = 7.x
+configure = admin/structure/panels
+files[] = panels_ipe.module
diff --git a/panels_ipe/panels_ipe.module b/panels_ipe/panels_ipe.module
index c0520a25ed7ee06920fd6972f3382fc5b38cd929..a0343073e6eb90ec11a22deb687b5c24aa8b9d41 100644
--- a/panels_ipe/panels_ipe.module
+++ b/panels_ipe/panels_ipe.module
@@ -36,19 +36,19 @@ function panels_ipe_ctools_plugin_api($owner, $api) {
function panels_ipe_theme() {
return array(
'panels_ipe_pane_wrapper' => array(
- 'arguments' => array('output' => NULL, 'pane' => NULL, 'display' => NULL),
+ 'variables' => array('output' => NULL, 'pane' => NULL, 'display' => NULL, 'renderer' => NULL),
),
'panels_ipe_region_wrapper' => array(
- 'arguments' => array('output' => NULL, 'region_id' => NULL, 'display' => NULL, 'renderer' => NULL),
+ 'variables' => array('output' => NULL, 'region_id' => NULL, 'display' => NULL, 'renderer' => NULL),
),
'panels_ipe_add_pane_button' => array(
- 'arguments' => array('region_id' => NULL, 'display' => NULL, 'renderer' => NULL),
+ 'variables' => array('region_id' => NULL, 'display' => NULL, 'renderer' => NULL),
),
'panels_ipe_placeholder_pane' => array(
- 'arguments' => array('region_id' => NULL, 'region_title' => NULL),
+ 'variables' => array('region_id' => NULL, 'region_title' => NULL),
),
'panels_ipe_dnd_form_container' => array(
- 'arguments' => array('link' => NULL, 'cache_key' => NULL, 'display' => NULL),
+ 'variables' => array('link' => NULL, 'cache_key' => NULL, 'display' => NULL),
),
);
}
@@ -60,14 +60,22 @@ function panels_ipe_theme() {
* @param string $region_id
* @param string $region_title
*/
-function theme_panels_ipe_placeholder_pane($region_id, $region_title) {
+function theme_panels_ipe_placeholder_pane($vars) {
+ $region_id = $vars['region_id'];
+ $region_title = $vars['region_title'];
+
$output = '
';
}
@@ -129,19 +141,22 @@ function panels_ipe_get_cache_key($key = NULL) {
*
* @param unknown_type $main
*/
-function panels_ipe_footer($main = 0) {
+function panels_ipe_page_alter(&$page) {
$key = panels_ipe_get_cache_key();
if (!isset($key)) {
return;
}
// TODO should be moved into the IPE plugin - WAAAY too hardcoded right now
- $output = "
',
);
// Set this up and we can use CTools' Export UI's built in wizard caching,
// which already has callbacks for the context cache under this name.
- $module = 'ctools_export_ui-' . $this->plugin['name'];
+ $module = 'export_ui::' . $this->plugin['name'];
$name = $this->edit_cache_get_key($form_state['item'], $form_state['form type']);
ctools_context_add_context_form($module, $form, $form_state, $form['right']['contexts_table'], $form_state['item'], $name);
@@ -192,7 +192,7 @@ class panels_mini_ui extends ctools_export_ui {
// Change the #id of the form so the CSS applies properly.
$form['#id'] = 'panels-choose-layout';
- $form = array_merge($form, panels_choose_layout($form_state));
+ $form = panels_choose_layout($form, $form_state);
if ($form_state['op'] == 'edit') {
$form['buttons']['next']['#value'] = t('Change');
@@ -245,7 +245,7 @@ class panels_mini_ui extends ctools_export_ui {
$form_state['no buttons'] = TRUE;
// Change the #id of the form so the CSS applies properly.
- $form = array_merge($form, panels_change_layout($form_state));
+ $form = panels_change_layout($form, $form_state);
// This form is outside the normal wizard list, so we need to specify the
// previous/next forms.
@@ -280,7 +280,7 @@ class panels_mini_ui extends ctools_export_ui {
$form_state['no buttons'] = TRUE;
$form_state['display_title'] = !empty($cache->display_title);
- $form = array_merge($form, panels_edit_display_form($form_state));
+ $form = panels_edit_display_form($form, $form_state);
// Make sure the theme will work since our form id is different.
$form['#theme'] = 'panels_edit_display_form';
}
diff --git a/panels_node/panels_node.info b/panels_node/panels_node.info
index 530a0398a636a1d5ec1a64f3e65cb6f792eadaad..fe4e13a7820be91a150784bd43ba7a7632f47be0 100644
--- a/panels_node/panels_node.info
+++ b/panels_node/panels_node.info
@@ -3,5 +3,6 @@ name = Panel nodes
description = Create nodes that are divided into areas with selectable content.
package = "Panels"
dependencies[] = panels
-core = 6.x
-
+configure = admin/structure/panels
+core = 7.x
+files[] = panels_node.module
diff --git a/panels_node/panels_node.install b/panels_node/panels_node.install
index a93610a2a8a12bd1eb005269689b410f313c0b4d..0f90060a96b0fc77cde546e8e715de98cf9f3b95 100644
--- a/panels_node/panels_node.install
+++ b/panels_node/panels_node.install
@@ -47,14 +47,12 @@ function panels_node_schema_1() {
*/
function panels_node_install() {
db_query("UPDATE {system} SET weight = 11 WHERE name = 'panels_node'");
- drupal_install_schema('panels_node');
}
/**
* Implementation of hook_uninstall().
*/
function panels_node_uninstall() {
- // TODO: Delete all actual nodes that are panels_nodes.
db_query("DELETE FROM {node} WHERE type = 'panel'");
drupal_uninstall_schema('panels_node');
}
diff --git a/panels_node/panels_node.module b/panels_node/panels_node.module
index 53eec85422f97759b569b70892a4a7ee63882964..2ae73f3f648c1c2c160dade2013970602c87afde 100644
--- a/panels_node/panels_node.module
+++ b/panels_node/panels_node.module
@@ -14,10 +14,35 @@
// General Drupal hooks
/**
- * Implementation of hook_perm().
+ * Implementation of hook_permission().
*/
-function panels_node_perm() {
- return array('create panel-nodes', 'edit any panel-nodes', 'edit own panel-nodes', 'administer panel-nodes', 'delete any panel-nodes', 'delete own panel-nodes');
+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.'),
+ ),
+ );
}
/**
@@ -29,7 +54,7 @@ function panels_node_menu() {
return array();
}
- $items['admin/build/panels/settings/panel-node'] = array(
+ $items['admin/structure/panels/settings/panel-node'] = array(
'title' => 'Panel nodes',
'description' => 'Configure which content is available to add to panel node displays.',
'access arguments' => array('administer panel-nodes'),
@@ -90,7 +115,7 @@ function panels_node_node_info() {
return array(
'panel' => array(
'name' => t('Panel'),
- 'module' => 'panels_node',
+ 'base' => 'panels_node',
'body_label' => t('Teaser'),
'description' => t("A panel layout broken up into rows and columns."),
),
@@ -132,7 +157,7 @@ function panels_node_add() {
/**
* Implementation of hook_form().
*/
-function panels_node_form(&$node, &$param) {
+function panels_node_form(&$node, &$form_state) {
ctools_include('plugins', 'panels');
$form['panels_node']['#tree'] = TRUE;
@@ -156,7 +181,7 @@ function panels_node_form(&$node, &$param) {
);
}
- $type = node_get_types('type', $node);
+ $type = node_type_get_type($node);
$form['title'] = array(
'#type' => 'textfield',
@@ -165,21 +190,6 @@ function panels_node_form(&$node, &$param) {
'#default_value' => $node->title,
);
- if (!empty($type->body_label)) {
- $form['body_field']['#prefix'] = '
';
- $form['body_field']['#suffix'] = '
';
- $form['body_field']['body'] = array(
- '#type' => 'textarea',
- '#title' => check_plain($type->body_label),
- '#rows' => 10,
- '#required' => TRUE,
- '#description' => t('The teaser is a piece of text to describe when the panel is listed (such as when promoted to front page); the actual content will only be displayed on the full node view.'),
- '#default_value' => $node->body,
- );
- $form['body_field']['format'] = filter_form($node->format); // Now we can set the format!
- }
-
-// drupal_set_message('
' . check_plain(var_export($node, true)) . '
');
$css_id = '';
if (!empty($node->panels_node['css_id'])) {
$css_id = $node->panels_node['css_id'];
@@ -204,7 +214,7 @@ function panels_node_form(&$node, &$param) {
// old modules.
$form['panels_node']['pipeline'] = array(
'#type' => 'value',
- '#value' => $node->panels_node['pipeline'],
+ '#value' => isset($node->panels_node['pipeline']) ? $node->panels_node['pipeline'] : 'standard',
);
}
else {
@@ -227,9 +237,9 @@ function panels_node_form(&$node, &$param) {
/**
* Implementation of hook_validate().
*/
-function panels_node_validate($node) {
+function panels_node_validate($node, $form, &$form_state) {
if (!$node->nid && empty($node->panels_node['layout'])) {
- form_set_error('', t('Please select a layout.'));
+ form_error($form['panels_node']['layout'], t('Please select a layout.'));
}
}
@@ -240,11 +250,13 @@ function panels_node_validate($node) {
* to have completely separate displays, and we'd have to copy them,
* and that's going to be a LOT of data.
*/
-function panels_node_load($node) {
+function panels_node_load($nodes) {
// We shortcut this because only in some really drastic corruption circumstance will this
// not work.
- $additions['panels_node'] = db_fetch_array(db_query("SELECT * FROM {panels_node} WHERE nid = %d", $node->nid));
- return $additions;
+ $result = db_query("SELECT * FROM {panels_node} WHERE nid IN (:nids)", array(':nids' => array_keys($nodes)));
+ foreach ($result as $record) {
+ $nodes[$record->nid]->panels_node = (array) $record;
+ }
}
/**
@@ -263,18 +275,23 @@ function panels_node_insert(&$node) {
}
panels_save_display($display);
- $css_id = $node->panels_node['css_id'];
-
- db_query("INSERT INTO {panels_node} (nid, did, css_id, pipeline) VALUES (%d, %d, '%s', '%s')", $node->nid, $display->did, $node->panels_node['css_id'], $node->panels_node['pipeline']);
-
$node->panels_node['did'] = $display->did;
+
+ db_insert('panels_node')
+ ->fields(array(
+ 'nid' => $node->nid,
+ 'did' => $display->did,
+ 'css_id' => $node->panels_node['css_id'],
+ 'pipeline' => $node->panels_node['pipeline'],
+ ))
+ ->execute();
}
/**
* Implementation of hook_delete().
*/
function panels_node_delete(&$node) {
- db_query("DELETE FROM {panels_node} WHERE nid = %d", $node->nid);
+ db_delete('panels_node')->condition('nid', $node->nid)->execute();
if (!empty($node->panels_node['did'])) {
panels_delete_display($node->panels_node['did']);
}
@@ -284,13 +301,27 @@ function panels_node_delete(&$node) {
* Implementation of hook_update().
*/
function panels_node_update($node) {
- db_query("UPDATE {panels_node} SET css_id = '%s', pipeline = '%s' WHERE nid = %d", $node->panels_node['css_id'], $node->panels_node['pipeline'], $node->nid);
+ db_insert('panels_node')
+ ->condition('nid', $node->nid)
+ ->fields(array(
+ 'css_id' => $node->panels_node['css_id'],
+ 'pipeline' => $node->panels_node['pipeline'],
+ ))
+ ->execute();
}
/**
* Implementation of hook_view().
*/
-function panels_node_view($node, $teaser = FALSE, $page = FALSE) {
+function panels_node_view($node, $view_mode) {
+ // Because we have the module 'panels' and the module 'panels_node'
+ // and because Drupal has hook_view and hook_node_view, this
+ // erroneously gets run for 'panels' hook 'node_view'. We detect
+ // this because the arguments are slightly different.
+ if (count(func_get_args()) != 4) {
+ return;
+ }
+
static $rendering = array();
// Prevent loops if someone foolishly puts the node inside itself:
@@ -300,9 +331,7 @@ function panels_node_view($node, $teaser = FALSE, $page = FALSE) {
$rendering[$node->nid] = TRUE;
ctools_include('plugins', 'panels');
- if ($teaser) {
- // Do the standard view for teaser.
- $node = node_prepare($node, $teaser);
+ if ($view_mode == 'teaser') {
// Because our teasier is never the same as our content, *always* provide
// the read more flag.
$node->readmore = TRUE;
@@ -315,7 +344,7 @@ function panels_node_view($node, $teaser = FALSE, $page = FALSE) {
$display->context = panels_node_get_context($node);
$renderer = panels_get_renderer($node->panels_node['pipeline'], $display);
$node->content['body'] = array(
- '#value' => panels_render_display($display, $renderer),
+ '#markup' => panels_render_display($display, $renderer),
'#weight' => 0,
);
}
@@ -354,17 +383,13 @@ function panels_node_edit_layout($node) {
* Pass through to the panels content editor.
*/
function panels_node_edit_content($node) {
-// ctools_include('plugins', 'panels');
ctools_include('context');
$display = panels_load_display($node->panels_node['did']);
$display->context = panels_node_get_context($node);
ctools_include('common', 'panels');
$content_types = panels_common_get_allowed_types('panels_node', $display->context);
- // Print this with theme('page') so that blocks are disabled while editing a display.
- // This is important because negative margins in common block layouts (i.e, Garland)
- // messes up the drag & drop.
- print theme('page', panels_edit($display, "node/$node->nid/panel_content", $content_types), FALSE);
+ return panels_edit($display, "node/$node->nid/panel_content", $content_types);
}
/**
diff --git a/plugins/display_renderers/editor.inc b/plugins/display_renderers/editor.inc
index 501b7b8db37f498374c1abfeb7ec651f57f4063f..6bfdf845c9009968f9557d8a53a2b115b2e238b6 100644
--- a/plugins/display_renderers/editor.inc
+++ b/plugins/display_renderers/editor.inc
@@ -1,8 +1,5 @@
array(
- 'class' => 'panels_renderer_editor',
- 'parent' => 'standard',
- ),
-);
\ No newline at end of file
+ 'renderer' => 'panels_renderer_editor',
+);
diff --git a/plugins/display_renderers/legacy.inc b/plugins/display_renderers/legacy.inc
deleted file mode 100644
index 2082105015c7af08519e7e57d4bbd58ae55dfe75..0000000000000000000000000000000000000000
--- a/plugins/display_renderers/legacy.inc
+++ /dev/null
@@ -1,7 +0,0 @@
- array(
- 'class' => 'panels_renderer_legacy',
- ),
-);
\ No newline at end of file
diff --git a/plugins/display_renderers/panels_renderer_editor.class.php b/plugins/display_renderers/panels_renderer_editor.class.php
index 8b4b9f43155c2f860b0cb51210632b6bc6f8f86e..728dd9cf5f2a5221b08e0cb1619c6e72d9bdbaca 100644
--- a/plugins/display_renderers/panels_renderer_editor.class.php
+++ b/plugins/display_renderers/panels_renderer_editor.class.php
@@ -18,35 +18,30 @@ class panels_renderer_editor extends panels_renderer_standard {
// Display edit rendering.
function edit() {
- ctools_include('form');
$form_state = array(
'display' => &$this->display,
'renderer' => &$this,
'content_types' => $this->cache->content_types,
- 're_render' => FALSE,
'no_redirect' => TRUE,
'display_title' => !empty($this->cache->display_title),
'cache key' => $this->display->cache_key,
);
- $output = ctools_build_form('panels_edit_display_form', $form_state);
- if ($output) {
+ $output = drupal_build_form('panels_edit_display_form', $form_state);
+ if (empty($form_state['executed']) || !empty($form_state['clicked_button']['preview'])) {
return $output;
}
- // no output == submit
- if (!$output) {
- if (!empty($form_state['clicked_button']['#save-display'])) {
- drupal_set_message(t('Panel content has been updated.'));
- panels_save_display($this->display);
- }
- else {
- drupal_set_message(t('Your changes have been discarded.'));
- }
-
- panels_cache_clear('display', $this->display->did);
- return $this->display;
+ if (!empty($form_state['clicked_button']['#save-display'])) {
+ drupal_set_message(t('Panel content has been updated.'));
+ panels_save_display($this->display);
}
+ else {
+ drupal_set_message(t('Your changes have been discarded.'));
+ }
+
+ panels_cache_clear('display', $this->display->did);
+ return $this->display;
}
function add_meta() {
@@ -91,7 +86,7 @@ class panels_renderer_editor extends panels_renderer_standard {
// @todo this should be panel-region not panels-display -- but CSS and .js has to be updated.
$output = "
base['canvas'] . "-inside \">\n";
@@ -526,7 +540,7 @@ function panels_flexible_render_item($renderer, $item, $content, $id, $position,
$output .= ' ' . $base . '-last';
}
if ($clear) {
- $output .= ' clear-block';
+ $output .= ' clearfix';
}
if (isset($item['class'])) {
@@ -547,7 +561,7 @@ function panels_flexible_render_item($renderer, $item, $content, $id, $position,
$output .= ' ' . $base . '-inside-last';
}
if ($clear) {
- $output .= ' clear-block';
+ $output .= ' clearfix';
}
$output .= "\">\n";
@@ -676,33 +690,32 @@ function panels_flexible_render_item_links($renderer, $id, $item) {
$links[] = array(
'title' => $settings,
'href' => $renderer->handler->get_url('layout', 'settings', $id),
- 'attributes' => array('class' => 'ctools-use-modal'),
+ 'attributes' => array('class' => array('ctools-use-modal')),
);
}
if ($add) {
$links[] = array(
'title' => $add,
'href' => $renderer->handler->get_url('layout', 'add', $id),
- 'attributes' => array('class' => 'ctools-use-modal'),
+ 'attributes' => array('class' => array('ctools-use-modal')),
);
}
if (isset($add2)) {
$links[] = array(
'title' => $add2,
'href' => $renderer->handler->get_url('layout', 'add', $id, 'right'),
- 'attributes' => array('class' => 'ctools-use-modal'),
+ 'attributes' => array('class' => array('ctools-use-modal')),
);
}
if ($remove) {
$links[] = array(
'title' => $remove,
'href' => $renderer->handler->get_url('layout', 'remove', $id),
- 'attributes' => array('class' => 'ctools-use-ajax'),
+ 'attributes' => array('class' => array('use-ajax')),
);
}
- return theme('ctools_dropdown', $title, $links, FALSE,
- 'flexible-layout-only flexible-links flexible-title flexible-links-' . $id);
+ return theme('ctools_dropdown', array('title' => $title, 'links' => $links, 'class' => 'flexible-layout-only flexible-links flexible-title flexible-links-' . $id));
}
/**
* Provide CSS for a flexible layout.
@@ -972,7 +985,7 @@ function panels_ajax_flexible_edit_settings($handler, $id) {
);
$output = ctools_modal_form_wrapper('panels_flexible_config_item_form', $form_state);
- if (empty($output)) {
+ if (!empty($form_state['executed'])) {
// If the width type changed then other nearby items will have
// to have their widths adjusted.
panels_edit_cache_set($handler->cache);
@@ -984,12 +997,12 @@ function panels_ajax_flexible_edit_settings($handler, $id) {
// If the item is a region, replace the title.
$class = $renderer->base[$item['type']] . '-' . $id;
if ($item['type'] == 'region') {
- $output[] = ctools_ajax_command_replace(".$class h2.label",
+ $output[] = ajax_command_replace(".$class h2.label",
'
' . check_plain($item['title']) . '
');
}
// Rerender our links in case something changed.
- $output[] = ctools_ajax_command_replace('.flexible-links-' . $id,
+ $output[] = ajax_command_replace('.flexible-links-' . $id,
panels_flexible_render_item_links($renderer, $id, $item));
// If editing the canvas, reset the CSS width
@@ -1015,7 +1028,7 @@ function panels_ajax_flexible_edit_settings($handler, $id) {
$css['.' . $renderer->base['canvas']] = array('width' => 'auto');
}
foreach ($css as $selector => $data) {
- $output[] = ctools_ajax_command_css($selector, $data);
+ $output[] = ajax_command_css($selector, $data);
}
}
@@ -1031,7 +1044,7 @@ function panels_ajax_flexible_edit_settings($handler, $id) {
* @param $form_state
* @return
*/
-function panels_flexible_config_item_form(&$form_state) {
+function panels_flexible_config_item_form($form, &$form_state) {
$display = &$form_state['display'];
$item = &$form_state['item'];
$siblings = &$form_state['siblings'];
@@ -1271,7 +1284,7 @@ function panels_ajax_flexible_edit_add($handler, $id, $location = 'left') {
);
$output = ctools_modal_form_wrapper('panels_flexible_add_item_form', $form_state);
- if (empty($output)) {
+ if (!empty($form_state['executed'])) {
// If the width type changed then other nearby items will have
// to have their widths adjusted.
panels_edit_cache_set($handler->cache);
@@ -1283,13 +1296,13 @@ function panels_ajax_flexible_edit_add($handler, $id, $location = 'left') {
$content = '';
if ($item['type'] == 'region') {
- $handler->plugins['layout']['panels'][$form_state['key']] = $item['title'];
+ $handler->plugins['layout']['regions'][$form_state['key']] = $item['title'];
$content = $handler->render_region($form_state['key'], array());
// Manually add the hidden field that our region uses to store pane info.
$content .= '';
+ $form_state['key'] . ']" value="" />';
}
else {
@@ -1321,36 +1334,36 @@ function panels_ajax_flexible_edit_add($handler, $id, $location = 'left') {
case 'left':
if ($location == 'left') {
$item_output .= panels_flexible_render_splitter($renderer, $form_state['key'], $form_state['sibling']);
- $output[] = ctools_ajax_command_prepend('#panels-dnd-main .' . $parent_class . '-left', $item_output);
+ $output[] = ajax_command_prepend('#panels-dnd-main .' . $parent_class . '-left', $item_output);
}
else if ($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[] = ctools_ajax_command_remove('panels-flexible-splitter-for-' . $renderer->base[$item['type']] . '-' . $form_state['key']);
+ $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['key'], NULL);
- $output[] = ctools_ajax_command_append('#panels-dnd-main .' . $parent_class . '-left', $item_output);
+ $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;
}
- $output[] = ctools_ajax_command_append('#panels-dnd-main .' . $parent_class . '-right', $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'])) {
$item_output .= panels_flexible_render_splitter($renderer, $form_state['key'], $form_state['sibling']);
}
- $output[] = ctools_ajax_command_prepend('#panels-dnd-main .' . $parent_class . '-middle', $item_output);
+ $output[] = ajax_command_prepend('#panels-dnd-main .' . $parent_class . '-middle', $item_output);
}
else {
if (!empty($form_state['sibling'])) {
$item_output = panels_flexible_render_splitter($renderer, $form_state['sibling'], $form_state['key']) . $item_output;
}
- $output[] = ctools_ajax_command_append('#panels-dnd-main .' . $parent_class . '-middle', $item_output);
+ $output[] = ajax_command_append('#panels-dnd-main .' . $parent_class . '-middle', $item_output);
}
break;
@@ -1361,14 +1374,14 @@ function panels_ajax_flexible_edit_add($handler, $id, $location = 'left') {
if (!empty($form_state['sibling'])) {
$sibling_width = '#panels-dnd-main .' . $renderer->base[$item['type']] . '-' . $form_state['sibling'] . '-width';
- $output[] = ctools_ajax_command_html($sibling_width, $settings['items'][$form_state['sibling']]['width']);
+ $output[] = ajax_command_html($sibling_width, $settings['items'][$form_state['sibling']]['width']);
}
foreach ($css as $selector => $data) {
- $output[] = ctools_ajax_command_css($selector, $data);
+ $output[] = ajax_command_css($selector, $data);
}
// Rerender our parent item links:
- $output[] = ctools_ajax_command_replace('.flexible-links-' . $id,
+ $output[] = ajax_command_replace('.flexible-links-' . $id,
panels_flexible_render_item_links($renderer, $id, $parent));
$output[] = array(
@@ -1387,7 +1400,7 @@ function panels_ajax_flexible_edit_add($handler, $id, $location = 'left') {
* @param $form_state
* @return
*/
-function panels_flexible_add_item_form(&$form_state) {
+function panels_flexible_add_item_form($form, &$form_state) {
$display = &$form_state['display'];
$item = &$form_state['item'];
$parent = &$form_state['parent'];
@@ -1542,7 +1555,7 @@ function panels_ajax_flexible_edit_remove($handler, $id) {
panels_flexible_convert_settings($settings, $handler->plugins['layout']);
if (empty($settings['items'][$id])) {
- ctools_ajax_render_error(t('Invalid item id.'));
+ ajax_render_error(t('Invalid item id.'));
}
$item = &$settings['items'][$id];
@@ -1591,7 +1604,7 @@ function panels_ajax_flexible_edit_remove($handler, $id) {
$class = $renderer->base[$item['type']] . '-' . $id;
$output = array();
- $output[] = ctools_ajax_command_remove('#panels-dnd-main .' . $class);
+ $output[] = ajax_command_remove('#panels-dnd-main .' . $class);
// Regenerate the CSS for siblings.
if (!empty($siblings)) {
@@ -1600,28 +1613,28 @@ function panels_ajax_flexible_edit_remove($handler, $id) {
$css = array();
panels_flexible_get_css_group($css, $renderer, $siblings, $parent_class, $item['type'], $item['parent']);
foreach ($css as $selector => $data) {
- $output[] = ctools_ajax_command_css($selector, $data);
+ $output[] = ajax_command_css($selector, $data);
}
}
// There are potentially two splitters linked to this item to be removed.
if (!empty($prev)) {
- $output[] = ctools_ajax_command_remove('.flexible-splitter-for-' . $renderer->base[$item['type']] . '-' . $prev);
+ $output[] = ajax_command_remove('.flexible-splitter-for-' . $renderer->base[$item['type']] . '-' . $prev);
}
// Try to remove the 'next' one even if there isn't a $next.
- $output[] = ctools_ajax_command_remove('.flexible-splitter-for-' . $renderer->base[$item['type']] . '-' . $id);
+ $output[] = ajax_command_remove('.flexible-splitter-for-' . $renderer->base[$item['type']] . '-' . $id);
if (!empty($prev) && !empty($next)) {
// Add a new splitter that links $prev and $next:
$splitter = panels_flexible_render_splitter($renderer, $prev, $next);
$prev_class = '#panels-dnd-main .' . $renderer->base[$item['type']] . '-' . $prev;
- $output[] = ctools_ajax_command_after($prev_class, $splitter);
+ $output[] = ajax_command_after($prev_class, $splitter);
// Send our fix height command.
$output[] = array('command' => 'flexible_fix_height');
}
// Rerender our parent item links:
- $output[] = ctools_ajax_command_replace('.flexible-links-' . $item['parent'],
+ $output[] = ajax_command_replace('.flexible-links-' . $item['parent'],
panels_flexible_render_item_links($renderer, $item['parent'], $settings['items'][$item['parent']]));
$output[] = array(
@@ -1698,11 +1711,11 @@ function panels_ajax_flexible_edit_reuse($handler) {
$handler->commands = $output;
}
-function panels_flexible_reuse_form(&$form_state) {
+function panels_flexible_reuse_form($form, &$form_state) {
$form['markup'] = array(
'#prefix' => '
',
'#suffix' => '
',
- '#value' => t('If you save this layout for reuse it will appear in the list of reusable layouts at admin/build/panels/layouts, and you will need to go there to edit it. This layout will then become an option for all future panels you make.'),
+ '#value' => t('If you save this layout for reuse it will appear in the list of reusable layouts at admin/structure/panels/layouts, and you will need to go there to edit it. This layout will then become an option for all future panels you make.'),
);
$form['admin_title'] = array(
diff --git a/plugins/layouts/onecol/onecol.inc b/plugins/layouts/onecol/onecol.inc
index 58bae762d496b88efc1ed713b7df2f3ab338c40d..36aa5be2358c39791f4bf6a2c3387afe02a46ce7 100644
--- a/plugins/layouts/onecol/onecol.inc
+++ b/plugins/layouts/onecol/onecol.inc
@@ -11,5 +11,5 @@ $plugin = array(
'icon' => 'onecol.png',
'theme' => 'panels_onecol',
'css' => 'onecol.css',
- 'panels' => array('middle' => t('Middle column')),
+ 'regions' => array('middle' => t('Middle column')),
);
diff --git a/plugins/layouts/onecol/panels-onecol.tpl.php b/plugins/layouts/onecol/panels-onecol.tpl.php
index 337f9066a34f5c1e099b45a66b6f0a27007b91d2..3c1df0271622ca1280560cbda8ad0247c34ad403 100644
--- a/plugins/layouts/onecol/panels-onecol.tpl.php
+++ b/plugins/layouts/onecol/panels-onecol.tpl.php
@@ -13,7 +13,7 @@
* $content['middle']: The only panel in the layout.
*/
?>
-
>
+
>
diff --git a/plugins/layouts/threecol_25_50_25/panels-threecol-25-50-25.tpl.php b/plugins/layouts/threecol_25_50_25/panels-threecol-25-50-25.tpl.php
index 2251fb1d803b61e20943c807946b7845fb9b85aa..f8c9b8f37a260a1176907c8915188dcaad034ca3 100644
--- a/plugins/layouts/threecol_25_50_25/panels-threecol-25-50-25.tpl.php
+++ b/plugins/layouts/threecol_25_50_25/panels-threecol-25-50-25.tpl.php
@@ -15,7 +15,7 @@
* - $content['right']: Content in the right column.
*/
?>
-
diff --git a/plugins/layouts/twocol_stacked/twocol_stacked.inc b/plugins/layouts/twocol_stacked/twocol_stacked.inc
index 61e38b82ed1061e7eab40580b507be79aa1f9ed7..5cb2f6bb3745c6ece068de6ccdbee8389c1bd3e7 100644
--- a/plugins/layouts/twocol_stacked/twocol_stacked.inc
+++ b/plugins/layouts/twocol_stacked/twocol_stacked.inc
@@ -8,7 +8,7 @@ $plugin = array(
'icon' => 'twocol_stacked.png',
'theme' => 'panels_twocol_stacked',
'css' => 'twocol_stacked.css',
- 'panels' => array(
+ 'regions' => array(
'top' => t('Top'),
'left' => t('Left side'),
'right' => t('Right side'),
diff --git a/plugins/page_wizards/landing_page.inc b/plugins/page_wizards/landing_page.inc
index 63180ea77400e212aea87e616d645684add51131..cf8ae722a8d949f9a63db99a3e848b53733a59bd 100644
--- a/plugins/page_wizards/landing_page.inc
+++ b/plugins/page_wizards/landing_page.inc
@@ -66,14 +66,14 @@ function panels_landing_page_new_page(&$cache) {
),
);
$cache->display = panels_new_display();
- $cache->display->layout = 'flexible';
+ $cache->display->layout = 'twocol';
}
/**
* First page of our page creator wizard.
*/
-function panels_landing_page_basic(&$form, &$form_state) {
- $cache = &$form_state['cache'];
+function panels_landing_page_basic($form, &$form_state) {
+ $cache = &$form_state['wizard cache'];
ctools_include('dependent');
$form['admin_title'] = array(
@@ -155,6 +155,8 @@ function panels_landing_page_basic(&$form, &$form_state) {
ctools_include('page-wizard', 'panels');
panels_page_wizard_add_layout($form, $form_state);
+
+ return $form;
}
/**
@@ -181,15 +183,15 @@ function panels_landing_page_basic_validate(&$form, &$form_state) {
}
// Check to see if something is already using the path
- $result = db_query("SELECT * FROM {menu_router} WHERE path = '%s'", $form_state['values']['path']);
- while ($router = db_fetch_object($result)) {
+ $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.'));
return;
}
// Ensure the path is not already an alias to something else.
- $result = db_query("SELECT src, dst FROM {url_alias} WHERE dst = '%s'", $form_state['values']['path']);
- if ($alias = db_fetch_object($result)) {
+ $alias = db_query('SELECT alias, source FROM {url_alias} WHERE alias = :path', array(':path' => $form_state['values']['path']))->fetchObject();
+ if ($alias) {
form_error($form['path'], t('That path is currently assigned to be an alias for @alias. This system cannot override existing aliases.', array('@alias' => $alias->src)));
}
}
@@ -198,7 +200,7 @@ function panels_landing_page_basic_validate(&$form, &$form_state) {
* Submit function to store the form data in our cache.
*/
function panels_landing_page_basic_submit(&$form, &$form_state) {
- $cache = &$form_state['cache'];
+ $cache = &$form_state['wizard cache'];
$cache->name = $form_state['values']['name'];
$cache->admin_title = $form_state['values']['admin_title'];
$cache->admin_description = $form_state['values']['admin_description'];
@@ -216,9 +218,11 @@ function panels_landing_page_basic_submit(&$form, &$form_state) {
* Second page of our wizard. This one provides a layout and lets the
* user add content.
*/
-function panels_landing_page_content(&$form, &$form_state) {
+function panels_landing_page_content($form, &$form_state) {
ctools_include('page-wizard', 'panels');
panels_page_wizard_add_content($form, $form_state);
+
+ return $form;
}
/**
@@ -235,7 +239,7 @@ function panels_landing_page_submit(&$form, &$form_state) {
* page, save it, and redirect the user to view the new work.
*/
function panels_landing_page_finish(&$form_state) {
- $cache = &$form_state['cache'];
+ $cache = &$form_state['wizard cache'];
// Ensure all 'page' features are loaded.
$page_task = page_manager_get_task('page');
diff --git a/plugins/page_wizards/node_override.inc b/plugins/page_wizards/node_override.inc
index 9fb96a59de5acb5e511bf363a9a4cf3da52b1f10..d81d06c36491b1db466cd2702c92e2d7e097d7b7 100644
--- a/plugins/page_wizards/node_override.inc
+++ b/plugins/page_wizards/node_override.inc
@@ -60,7 +60,7 @@ function panels_node_override_start($form_info, $step, &$form_state) {
$form_state['page'] = page_manager_get_page_cache('node_view');
if (!empty($form_state['page']->locked)) {
$account = user_load($form_state['page']->locked->uid);
- $name = theme('username', $account);
+ $name = theme('username', array('account' => $account));
$lock_age = format_interval(time() - $form_state['page']->locked->updated);
$break = url(page_manager_edit_url($form_state['page']->task_name, array('actions', 'break-lock')));
@@ -71,7 +71,7 @@ function panels_node_override_start($form_info, $step, &$form_state) {
/**
* First page of our page creator wizard.
*/
-function panels_node_override_basic(&$form, &$form_state) {
+function panels_node_override_basic($form, &$form_state) {
$types = node_get_types();
$form_state['types'] = $types;
@@ -98,7 +98,7 @@ function panels_node_override_basic(&$form, &$form_state) {
$form['already_done'] = array(
'#type' => 'item',
'#title' => t('Existing node templates'),
- '#value' => theme('item_list', $items),
+ '#value' => theme('item_list', array('items' => $items)),
);
}
@@ -118,6 +118,8 @@ function panels_node_override_basic(&$form, &$form_state) {
ctools_include('page-wizard', 'panels');
panels_page_wizard_add_layout($form, $form_state);
+
+ return $form;
}
/**
@@ -257,9 +259,11 @@ function panels_node_override_basic_submit(&$form, &$form_state) {
* Second page of our wizard. This one provides a layout and lets the
* user add content.
*/
-function panels_node_override_content(&$form, &$form_state) {
+function panels_node_override_content($form, &$form_state) {
ctools_include('page-wizard', 'panels');
panels_page_wizard_add_content($form, $form_state);
+
+ return $form;
}
/**
diff --git a/plugins/style_bases/pane/pane_rounded_shadow/pane-rounded-shadow.tpl.php b/plugins/style_bases/pane/pane_rounded_shadow/pane-rounded-shadow.tpl.php
index c2560cfe2a41a124fd383591d17de20ae14aefe4..e32823faf4c6c8d1b6283d881387d314e7e8b858 100644
--- a/plugins/style_bases/pane/pane_rounded_shadow/pane-rounded-shadow.tpl.php
+++ b/plugins/style_bases/pane/pane_rounded_shadow/pane-rounded-shadow.tpl.php
@@ -20,7 +20,7 @@
-
+
diff --git a/plugins/style_bases/pane/pane_rounded_shadow/pane_rounded_shadow.inc b/plugins/style_bases/pane/pane_rounded_shadow/pane_rounded_shadow.inc
index c3d8f82e5113cebfd6846c4f7cefcf2b41234317..6d835f8bbce64600966be6492e794bc258ac4623 100644
--- a/plugins/style_bases/pane/pane_rounded_shadow/pane_rounded_shadow.inc
+++ b/plugins/style_bases/pane/pane_rounded_shadow/pane_rounded_shadow.inc
@@ -63,7 +63,7 @@ function template_preprocess_pane_rounded_shadow(&$vars) {
$vars['classes'] = $vars['content']->css_class;
$vars['content']->css_class = '';
- $vars['output'] = theme('panels_pane', $vars['content'], $vars['pane'], $vars['display']);
+ $vars['output'] = theme('panels_pane', $vars);
}
function panels_pane_rounded_shadow_style_settings(&$form, &$form_state) {
diff --git a/plugins/style_bases/region/region_plain_box/region-plain-box.tpl.php b/plugins/style_bases/region/region_plain_box/region-plain-box.tpl.php
index 2c354632050852c2f65978d073812496e2a6f24a..58166c39b521bde34cc55b2675cc0e76c7f9084e 100644
--- a/plugins/style_bases/region/region_plain_box/region-plain-box.tpl.php
+++ b/plugins/style_bases/region/region_plain_box/region-plain-box.tpl.php
@@ -9,7 +9,7 @@
* - $classes: The classes that must be applied to the top divs.
*/
?>
-
+
@@ -17,7 +17,7 @@
-
+
diff --git a/plugins/style_bases/region/region_rounded_shadow/region-rounded-shadow.tpl.php b/plugins/style_bases/region/region_rounded_shadow/region-rounded-shadow.tpl.php
index 2c354632050852c2f65978d073812496e2a6f24a..58166c39b521bde34cc55b2675cc0e76c7f9084e 100644
--- a/plugins/style_bases/region/region_rounded_shadow/region-rounded-shadow.tpl.php
+++ b/plugins/style_bases/region/region_rounded_shadow/region-rounded-shadow.tpl.php
@@ -9,7 +9,7 @@
* - $classes: The classes that must be applied to the top divs.
*/
?>
-
+
@@ -17,7 +17,7 @@
-
+
diff --git a/plugins/styles/block.inc b/plugins/styles/block.inc
index af5a066f45a32798c0976c881ddd4643a2059f7f..022b2364415c35c0dd136dfa20de35287f756715 100644
--- a/plugins/styles/block.inc
+++ b/plugins/styles/block.inc
@@ -19,7 +19,9 @@ $plugin = array(
*
* @ingroup themeable
*/
-function theme_panels_block_style_render_pane($content, $pane, $display) {
+function theme_panels_block_style_render_pane($vars) {
+ $content = $vars['content'];
+
if (empty($content->content)) {
return;
}
@@ -39,6 +41,6 @@ function theme_panels_block_style_render_pane($content, $pane, $display) {
// If using per pane classes, $block->css_class will need to be added in your
// preprocess or template, along with any other Panels specific field you
// might want to utilize.
- return theme('block', $content);
+ return theme('block', array('block' => $content));
}
diff --git a/plugins/styles/corners/panels-rounded-corners-box.tpl.php b/plugins/styles/corners/panels-rounded-corners-box.tpl.php
index e2c86831457679cbbcc47d6b132bdb212a60850c..19914d387e5c1fcf505041f9282c17fb4dadc354 100644
--- a/plugins/styles/corners/panels-rounded-corners-box.tpl.php
+++ b/plugins/styles/corners/panels-rounded-corners-box.tpl.php
@@ -12,7 +12,7 @@
-
+
diff --git a/plugins/styles/corners/rounded_corners.inc b/plugins/styles/corners/rounded_corners.inc
index 0dd7db70917efa1064d939d656eaf47db3ef912f..7bdfd43a5192068654f09de9157f356c57e0160c 100644
--- a/plugins/styles/corners/rounded_corners.inc
+++ b/plugins/styles/corners/rounded_corners.inc
@@ -10,12 +10,12 @@
$plugin = array(
'title' => t('Rounded corners'),
'description' => t('Presents the panes or panels with a rounded corner box around them'),
- 'render panel' => 'panels_rounded_corners_style_render_panel',
+ 'render region' => 'panels_rounded_corners_style_render_region',
'render pane' => 'panels_rounded_corners_style_render_pane',
'settings form' => 'panels_rounded_corners_style_settings_form',
'hook theme' => array(
'panels_rounded_corners_box' => array(
- 'arguments' => array('content' => NULL),
+ 'variables' => array('content' => NULL),
'path' => panels_get_path('plugins/styles/corners'),
'template' => 'panels-rounded-corners-box',
),
@@ -27,7 +27,12 @@ $plugin = array(
*
* @ingroup themeable
*/
-function theme_panels_rounded_corners_style_render_panel($display, $panel_id, $panes, $settings) {
+function theme_panels_rounded_corners_style_render_region($vars) {
+ $display = $vars['display'];
+ $region_id = $vars['region_id'];
+ $panes = $vars['panes'];
+ $settings = $vars['settings'];
+
$output = '';
// Determine where to put the box. If empty or 'pane' around each pane. If
@@ -36,25 +41,22 @@ function theme_panels_rounded_corners_style_render_panel($display, $panel_id, $p
$print_separator = FALSE;
foreach ($panes as $pane_id => $pane) {
- $text = panels_render_pane($pane, $display->content[$pane_id], $display);
- if ($text) {
- // Add the separator if we've already displayed a pane.
- if ($print_separator) {
- $output .= '
';
- }
-
- if ($where == 'pane') {
- $output .= theme('panels_rounded_corners_box', $text);
- }
- else {
- $output .= $text;
- $print_separator = TRUE;
- }
+ // Add the separator if we've already displayed a pane.
+ if ($print_separator) {
+ $output .= '
';
+ }
+
+ if ($where == 'pane') {
+ $output .= theme('panels_rounded_corners_box', array('content' => $pane));
+ }
+ else {
+ $output .= $pane;
+ $print_separator = TRUE;
}
}
if ($where == 'panel') {
- $output = theme('panels_rounded_corners_box', $output);
+ $output = theme('panels_rounded_corners_box', array('content' => $output));
}
panels_add_rounded_corners_css($display, $where);
@@ -73,15 +75,19 @@ function panels_add_rounded_corners_css($display, $where) {
/**
* Render callback for a single pane.
*/
-function theme_panels_rounded_corners_style_render_pane($content, $pane, $display) {
+function theme_panels_rounded_corners_style_render_pane($vars) {
+ $content = $vars['content'];
+ $pane = $vars['pane'];
+ $display = $vars['display'];
+
if (empty($content->content)) {
return;
}
- $output = theme('panels_pane', $content, $pane, $display);
+ $output = theme('panels_pane', array('content' => $content, 'pane' => $pane, 'display' => $display));
// Just stick a box around the standard theme_panels_pane.
- $output = theme('panels_rounded_corners_box', $output);
+ $output = theme('panels_rounded_corners_box', array('content' => $output));
panels_add_rounded_corners_css($display, 'pane');
return $output;
}
diff --git a/plugins/styles/default.inc b/plugins/styles/default.inc
index 20206760671e1dd027545690975a3ee53cac644d..88bb9ee6bc7da9340925f4982dc362fb68c9484f 100644
--- a/plugins/styles/default.inc
+++ b/plugins/styles/default.inc
@@ -10,7 +10,7 @@
$plugin = array(
'title' => t('No style'),
'description' => t('The default panel rendering style; displays each pane with a separator.'),
- 'render panel' => 'panels_default_style_render_panel',
+ 'render region' => 'panels_default_style_render_region',
);
/**
@@ -18,22 +18,7 @@ $plugin = array(
*
* @ingroup themeable
*/
-function theme_panels_default_style_render_panel($display, $panel_id, $panes, $settings) {
- $output = '';
-
- $print_separator = FALSE;
- foreach ($panes as $pane_id => $content) {
- // Add the separator if we've already displayed a pane.
- if ($print_separator) {
- $output .= '';
- }
- $output .= $text = panels_render_pane($content, $display->content[$pane_id], $display);
-
- // If we displayed a pane, this will become true; if not, it will become
- // false.
- $print_separator = (bool) $text;
- }
-
- return $output;
+function theme_panels_default_style_render_region($vars) {
+ return implode('', $vars['panes']);
}
diff --git a/plugins/styles/list.inc b/plugins/styles/list.inc
index 4f2e4cbc34de052e58c2222653e6a8b7807918f1..69e847317d8b43f529c12cfb82e2f2b217244651 100644
--- a/plugins/styles/list.inc
+++ b/plugins/styles/list.inc
@@ -11,7 +11,7 @@
$plugin = array(
'title' => t('List'),
'description' => t('Presents the panes in the form of an HTML list.'),
- 'render panel' => 'panels_list_style_render_panel',
+ 'render region' => 'panels_list_style_render_region',
'settings form' => 'panels_list_style_settings_form',
'settings validate' => 'panels_list_style_settings_validate',
);
@@ -21,21 +21,23 @@ $plugin = array(
*
* @ingroup themeable
*/
-function theme_panels_list_style_render_panel($display, $panel_id, $panes, $settings) {
+function theme_panels_list_style_render_region($vars) {
+ $display = $vars['display'];
+ $region_id = $vars['region_id'];
+ $panes = $vars['panes'];
+ $settings = $vars['settings'];
+
$items = array();
- foreach ($panes as $pane_id => $content) {
- $item = panels_render_pane($content, $display->content[$pane_id], $display);
- if (isset($item)) {
- $items[] = $item;
- }
+ foreach ($panes as $pane_id => $item) {
+ $items[] = $item;
}
if (empty($settings['list_type'])) {
$settings['list_type'] = 'ul';
}
- return theme('item_list', $items, NULL, $settings['list_type']);
+ return theme('item_list', array('items' => $items, 'type' => $settings['list_type']));
}
/**
diff --git a/plugins/styles/naked.inc b/plugins/styles/naked.inc
index 58746c5ae56b0dcf4ea490f174d1f6022d14c947..15b2f41a21012cf1f8707e4aec9818a1e84e7bc1 100644
--- a/plugins/styles/naked.inc
+++ b/plugins/styles/naked.inc
@@ -19,7 +19,7 @@ $plugin = array(
*
* @ingroup themeable
*/
-function theme_panels_naked_style_render_pane($content, $pane, $display) {
- return $content->content;
+function theme_panels_naked_style_render_pane($vars) {
+ return $vars['content']->content;
}
diff --git a/plugins/styles/stylizer.inc b/plugins/styles/stylizer.inc
index a299787d5ab8255bbc4ecf7ac1cf0838998fbb17..80950d6350e3aa1e57725e9348774df2c966e9e7 100644
--- a/plugins/styles/stylizer.inc
+++ b/plugins/styles/stylizer.inc
@@ -6,28 +6,30 @@
* Definition of the 'stylizer' panel style.
*/
-// Plugin definition
-$plugin = array(
- 'title' => t('Custom style'),
- 'weight' => -10,
- 'description' => t('Allows choice of a stylizer style'),
-
- 'render pane' => 'panels_stylizer_stylizer_style_render_pane',
- 'pane settings form' => 'panels_stylizer_stylizer_style_settings_form',
-
- 'render region' => 'panels_stylizer_stylizer_style_render_region',
- 'settings form' => 'panels_stylizer_stylizer_style_settings_form',
-
- // We offer substyles so provide callbacks to do so.
- 'get child' => 'panels_stylizer_get_substyle',
- 'get children' => 'panels_stylizer_get_substyles',
-
- // Set up an AJAX callback for the style
- 'ajax' => array(
- 'custom' => 'panels_stylizer_pane_add_style',
- ),
-// 'settings validate' => 'panels_stylizer_stylizer_style_settings_validate',
-);
+if (module_exists('stylizer')) {
+ // Plugin definition
+ $plugin = array(
+ 'title' => t('Custom style'),
+ 'weight' => -10,
+ 'description' => t('Allows choice of a stylizer style'),
+
+ 'render pane' => 'panels_stylizer_stylizer_style_render_pane',
+ 'pane settings form' => 'panels_stylizer_stylizer_style_settings_form',
+
+ 'render region' => 'panels_stylizer_stylizer_style_render_region',
+ 'settings form' => 'panels_stylizer_stylizer_style_settings_form',
+
+ // We offer substyles so provide callbacks to do so.
+ 'get child' => 'panels_stylizer_get_substyle',
+ 'get children' => 'panels_stylizer_get_substyles',
+
+ // Set up an AJAX callback for the style
+ 'ajax' => array(
+ 'custom' => 'panels_stylizer_pane_add_style',
+ ),
+ // 'settings validate' => 'panels_stylizer_stylizer_style_settings_validate',
+ );
+}
/**
* Merge the main stylizer plugin with a style to create a sub plugin.
@@ -105,7 +107,13 @@ function _panels_stylizer_get_style($plugin, $style_settings) {
/**
* Region render theme.
*/
-function theme_panels_stylizer_stylizer_style_render_region($display, $owner_id, $panes, $style_settings, $region_id, $plugin) {
+function theme_panels_stylizer_stylizer_style_render_region($vars) {
+ $display = $vars['display'];
+ $panes = $vars['panes'];
+ $style_settings = $vars['settings'];
+ $region_id = $vars['region_id'];
+ $plugin = $vars['style'];
+
$output = '';
foreach ($panes as $pane_id => $pane_output) {
@@ -119,7 +127,7 @@ function theme_panels_stylizer_stylizer_style_render_region($display, $owner_id,
$plugin = ctools_get_style_base($settings['style_base']);
ctools_stylizer_add_css($plugin, $settings);
- return theme($plugin['theme'], $settings, ctools_stylizer_get_css_class($plugin, $settings), $output);
+ return theme($plugin['theme'], array('settings' => $settings, 'class' => ctools_stylizer_get_css_class($plugin, $settings), 'content' => $output));
}
else {
// if the style is gone, just display the output.
@@ -130,8 +138,13 @@ function theme_panels_stylizer_stylizer_style_render_region($display, $owner_id,
/**
* Pane render theme
*/
-function theme_panels_stylizer_stylizer_style_render_pane($content, $pane, $display, $plugin) {
- $settings = _panels_stylizer_get_style($plugin, $pane->style['settings']);
+function theme_panels_stylizer_stylizer_style_render_pane($vars) {
+ $content = $vars['content'];
+ $pane = $vars['pane'];
+ $display = $vars['display'];
+ $plugin = $vars['style'];
+
+ $settings = _panels_stylizer_get_style($plugin, $vars['settings']);
if ($settings) {
ctools_include('stylizer');
@@ -147,12 +160,12 @@ function theme_panels_stylizer_stylizer_style_render_pane($content, $pane, $disp
ctools_stylizer_add_css($plugin, $settings);
if (isset($plugin['theme'])) {
- return theme($plugin['theme'], $settings, $content, $pane, $display);
+ return theme($plugin['theme'], array('settings' => $settings, 'content' => $content, 'pane' => $pane, 'display' => $display));
}
}
// if the style is gone or has no theme of its own, just display the output.
- return theme('panels_pane', $content, $pane, $display);
+ return theme('panels_pane', array('content' => $content, 'pane' => $pane, 'display' => $display));
}
/**
diff --git a/plugins/task_handlers/panel_context.inc b/plugins/task_handlers/panel_context.inc
index 767352e3c378ba9cd92b64f43ca64f4d44238e74..0df1d1f8282a15c920234228428031d67fc129a4 100644
--- a/plugins/task_handlers/panel_context.inc
+++ b/plugins/task_handlers/panel_context.inc
@@ -279,11 +279,6 @@ function panels_panel_context_render($handler, $base_contexts, $args, $test = TR
// With an argument, this actually sets the display.
panels_get_current_page_display($display);
- // Handle backward compatibility with the IPE checkbox.
- if (empty($handler->conf['pipeline'])) {
- $handler->conf['pipeline'] = !empty($handler->conf['use_ipe']) ? 'ipe' : 'standard';
- }
-
$renderer = panels_get_renderer($handler->conf['pipeline'], $display);
$info = array(
@@ -404,7 +399,7 @@ function panels_panel_context_admin_summary($handler, $task, $subtask, $page, $s
// Get operations for just this handler.
$operations = $operations['handlers']['children'][$handler->name]['children']['actions']['children'];
$args = array('handlers', $handler->name, 'actions');
- $rendered_operations = page_manager_render_operations($page, $operations, array(), array('class' => 'actions'), 'actions', $args);
+ $rendered_operations = page_manager_render_operations($page, $operations, array(), array('class' => array('actions')), 'actions', $args);
$layout = panels_get_layout($display->layout);
@@ -464,27 +459,16 @@ function panels_panel_context_admin_summary($handler, $task, $subtask, $page, $s
$content_link = ' [' . l(t('Edit'), page_manager_edit_url($task_name, array('handlers', $handler->name, 'content'))) . ']';
$context_link = ' [' . l(t('Edit'), page_manager_edit_url($task_name, array('handlers', $handler->name, 'context'))) . ']';
- $info = theme('table', array(), $rows, array('class' => 'page-manager-handler-summary'));
-
-/*
- $content = theme('panels_common_content_list', $display);
- if (empty($contents)) {
- $contents = t('This panel has no content.');
- }
- $contexts = theme('ctools_context_list_no_table', $object);
- if (empty($contexts)) {
- $contexts = t('This panel has no contexts.');
- }
-*/
+ $info = theme('table', array('rows' => $rows, 'attributes' => array('class' => 'page-manager-handler-summary')));
$title = $handler->conf['title'];
if ($title != t('Panel')) {
$title = t('Panel: @title', array('@title' => $title));
}
- $output .= '
';
+ $output .= '
';
if ($show_title) {
- $output .= '
';
+ $output .= '
';
$output .= '
' . $rendered_operations['actions'] . '
';
$output .= '' . $title . '';
}
@@ -531,7 +515,7 @@ function panels_panel_context_admin_summary($handler, $task, $subtask, $page, $s
* previous layout to choose from. a different, only slightly different
* variant is called to change a pre-existing layout.
*/
-function panels_panel_context_edit_choose(&$form, &$form_state) {
+function panels_panel_context_edit_choose($form, &$form_state) {
ctools_include('common', 'panels');
ctools_include('display-layout', 'panels');
ctools_include('plugins', 'panels');
@@ -546,7 +530,9 @@ function panels_panel_context_edit_choose(&$form, &$form_state) {
// Change the #id of the form so the CSS applies properly.
$form['#id'] = 'panels-choose-layout';
- $form = array_merge($form, panels_choose_layout($form_state));
+ $form = panels_choose_layout($form, $form_state);
+
+ return $form;
}
/**
@@ -577,7 +563,7 @@ function panels_panel_context_edit_choose_submit(&$form, &$form_state) {
* to the move content form, which is 'hidden' so it won't be accessed
* directly.
*/
-function panels_panel_context_edit_layout(&$form, &$form_state) {
+function panels_panel_context_edit_layout($form, &$form_state) {
ctools_include('common', 'panels');
ctools_include('display-layout', 'panels');
ctools_include('plugins', 'panels');
@@ -592,7 +578,9 @@ function panels_panel_context_edit_layout(&$form, &$form_state) {
// Change the #id of the form so the CSS applies properly.
$form['#id'] = 'panels-choose-layout';
- $form = array_merge($form, panels_choose_layout($form_state));
+ $form = panels_choose_layout($form, $form_state);
+
+ return $form;
}
/**
@@ -623,7 +611,7 @@ function panels_panel_context_edit_layout_submit(&$form, &$form_state) {
/**
* When a layout is changed, the user is given the opportunity to move content.
*/
-function panels_panel_context_edit_move(&$form, &$form_state) {
+function panels_panel_context_edit_move($form, &$form_state) {
$form_state['display'] = &panels_panel_context_get_display($form_state['handler']);
$form_state['layout'] = $form_state['handler']->conf['temp_layout'];
@@ -635,7 +623,7 @@ function panels_panel_context_edit_move(&$form, &$form_state) {
$form_state['no buttons'] = TRUE;
// Change the #id of the form so the CSS applies properly.
- $form = array_merge($form, panels_change_layout($form_state));
+ $form = panels_change_layout($form, $form_state);
// Change the 'back' button to just go directly to the previous form
// $task_id = $form_state['task']['name'];
@@ -648,13 +636,14 @@ function panels_panel_context_edit_move(&$form, &$form_state) {
$form['buttons']['next']['#next'] = 'content';
$form_state['form_info']['return path'] = page_manager_edit_url($form_state['page']->task_name, array('handlers', $form_state['handler_id'], 'content'));
+ return $form;
}
/**
* Present the panels drag & drop editor to edit the display attached
* to the task handler.
*/
-function panels_panel_context_edit_content(&$form, &$form_state) {
+function panels_panel_context_edit_content($form, &$form_state) {
ctools_include('ajax');
ctools_include('plugins', 'panels');
ctools_include('common', 'panels');
@@ -674,7 +663,7 @@ function panels_panel_context_edit_content(&$form, &$form_state) {
$form_state['no preview'] = TRUE;
$form_state['page']->display_cache[$form_state['handler_id']] = $cache;
- $form = array_merge($form, panels_edit_display_form($form_state));
+ $form = panels_edit_display_form($form, $form_state);
// Make sure the theme will work since our form id is different.
$form['#theme'] = 'panels_edit_display_form';
@@ -682,6 +671,7 @@ function panels_panel_context_edit_content(&$form, &$form_state) {
$form['buttons']['preview'] = $form['buttons']['return'];
$form['buttons']['preview']['#value'] = t('Update and preview');
}
+ return $form;
}
function panels_panel_context_edit_content_submit(&$form, &$form_state) {
@@ -701,7 +691,7 @@ function panels_panel_context_edit_content_submit(&$form, &$form_state) {
/**
* General settings for the panel
*/
-function panels_panel_context_edit_settings(&$form, &$form_state) {
+function panels_panel_context_edit_settings($form, &$form_state) {
$conf = $form_state['handler']->conf;
$form['conf']['title'] = array(
'#type' => 'textfield',
@@ -763,6 +753,8 @@ function panels_panel_context_edit_settings(&$form, &$form_state) {
'#description' => t('Enter well-formed CSS code here; this code will be embedded into the page, and should only be used for minor adjustments; it is usually better to try to put CSS for the page into the theme if possible. This CSS will be filtered for safety so some CSS may not work.'),
'#default_value' => $conf['css'],
);
+
+ return $form;
}
/**
@@ -784,7 +776,7 @@ function panels_panel_context_edit_settings_submit(&$form, &$form_state) {
/**
* Form to show a nice preview.
*/
-function panels_panel_context_edit_preview(&$form, &$form_state) {
+function panels_panel_context_edit_preview($form, &$form_state) {
ctools_include('context');
ctools_include('context-task-handler');
@@ -809,11 +801,13 @@ function panels_panel_context_edit_preview(&$form, &$form_state) {
if (!empty($output)) {
$form['output'] = array(
- '#value' => $output,
+ '#markup' => $output,
);
}
$form_state['do not cache'] = TRUE;
+
+ return $form;
}
/**
diff --git a/plugins/views/panels_views_plugin_row_fields.inc b/plugins/views/panels_views_plugin_row_fields.inc
index a9f66b6c7998edd20d037fe7bfd9c4c856c7050c..1090a067b367ac237d0d0835f1c72791c82c3bdc 100644
--- a/plugins/views/panels_views_plugin_row_fields.inc
+++ b/plugins/views/panels_views_plugin_row_fields.inc
@@ -119,7 +119,7 @@ class panels_views_plugin_row_fields extends views_plugin_row {
if (!$layout) {
// Fall back to normal behavior if the layout is somehow invalid. This
// can happen if the layout was removed, for example.
- return theme($this->theme_functions(), $this->view, $this->options, $row, $this->field_alias);
+ return theme($this->theme_functions(), array('view' => view, 'options' => $this->options, 'row' => $row, 'field_alias' => $this->field_alias));
}
// Store a backup copy of the array because we're going to be screwing
@@ -169,7 +169,7 @@ class panels_views_plugin_row_fields extends views_plugin_row {
// render them into the content array.
foreach ($this->region_fields as $region_id => $fields) {
$this->view->field = $fields;
- $content[$region_id] = theme($this->theme_functions(), $this->view, $this->options, $row, $this->field_alias);
+ $content[$region_id] = theme($this->theme_functions(), array('view' => $this->view, 'options' => $this->options, 'row' => $row, 'field_alias' => $this->field_alias));
}
// Restore our $fields array.
diff --git a/templates/panels-dashboard-link.tpl.php b/templates/panels-dashboard-link.tpl.php
index 9f403a78db3e08544f0b9dbc23350a27ecdd42ce..8514ec2340c49ed52a481cd84641b7cf6fa894bf 100644
--- a/templates/panels-dashboard-link.tpl.php
+++ b/templates/panels-dashboard-link.tpl.php
@@ -1,7 +1,7 @@
-