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 clear-block" <?php if (!empty($css_id)) { print "id=\"$css_id\""; } ?>>  
+
<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 clear-block" <?php if (!empty($css_id)) { print "id=\"$css_id\""; } ?>>  
+
<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 = '
'; foreach (panels_get_regions($layout, $display) as $panel_id => $title) { @@ -540,7 +542,7 @@ function panels_common_print_layout_links($layouts, $base_path, $link_options = $output .= drupal_render($form); - $output .= '
'; + $output .= '
'; // 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' => '
', + '#prefix' => '
', '#suffix' => '
', ); @@ -122,7 +121,7 @@ function panels_choose_layout(&$form_state) { ); $form['layout'][$category] = array( - '#prefix' => '
' . $categories[$category] . '
', + '#prefix' => '
' . $categories[$category] . '
', '#suffix' => '
', ); @@ -133,7 +132,7 @@ function panels_choose_layout(&$form_state) { '#type' => 'radio', '#title' => $choice, '#parents' => array('layout'), - '#id' => form_clean_id('edit-layout-' . $key), + '#id' => drupal_clean_css_identifier('edit-layout-' . $key), '#return_value' => check_plain($key), '#default_value' => in_array($display->layout, array_keys($layouts)) ? $display->layout : NULL, ); @@ -173,17 +172,11 @@ function panels_choose_layout_submit($form, &$form_state) { * @ingroup forms * * @param array $form - * A structured FAPI $form array. - * @param object $display instanceof panels_display \n - * The panels_display object that was modified on the preceding display layout - * editing form. - * @param string $new_layout_id - * A string containing the name of the layout the display is to be converted to. - * These strings correspond exactly to the filenames of the *.inc files in panels/layouts. - * So, if the new layout that's been selected is the 'Two Column bricks' layout, then - * $new_layout_id will be 'twocol_bricks', corresponding to panels/layouts/twocol_bricks.inc. + * A structured FAPI $form array. + * @param &$form_state + * The Drupal $form_state */ -function panels_change_layout(&$form_state) { +function panels_change_layout($form, &$form_state) { $display = &$form_state['display']; $new_layout = panels_get_layout($form_state['layout']); @@ -196,24 +189,19 @@ function panels_change_layout(&$form_state) { $old_layout = panels_get_layout($display->layout); $form['container'] = array( - '#prefix' => '
', + '#prefix' => '
', '#suffix' => '
', ); $form['container']['old_layout'] = array( - '#value' => panels_print_layout_icon($display->layout, $old_layout, check_plain($old_layout['title'])), + '#markup' => panels_print_layout_icon($display->layout, $old_layout, check_plain($old_layout['title'])), ); $form['container']['right_arrow'] = array( - '#value' => theme('image', drupal_get_path('module', 'panels') . '/images/go-right.png'), + '#markup' => theme('image', array('path' => drupal_get_path('module', 'panels') . '/images/go-right.png')), ); $form['container']['new_layout'] = array( - '#value' => panels_print_layout_icon($form_state['layout'], $new_layout, check_plain($new_layout['title'])), - ); - - $form['container-clearer'] = array( - // TODO: FIx this ot use clear-block instead - '#value' => '
', + '#markup' => panels_print_layout_icon($form_state['layout'], $new_layout, check_plain($new_layout['title'])), ); $form['old'] = array( @@ -226,7 +214,7 @@ function panels_change_layout(&$form_state) { if (empty($display->panels)) { $form['old'] = 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 += ' '; + + $('#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 = ''; 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' => '', + '#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 = '
'; $output .= "

$region_title

"; $output .= '
'; return $output; } -function theme_panels_ipe_pane_wrapper($output, $pane, $display, $renderer) { +function theme_panels_ipe_pane_wrapper($vars) { + $output = $vars['output']; + $pane = $vars['pane']; + $display = $vars['display']; + $renderer = $vars['renderer']; + $content_type = ctools_get_content_type($pane->type); $subtype = ctools_content_get_subtype($content_type, $pane->subtype); $links = array(); @@ -94,23 +102,27 @@ function theme_panels_ipe_pane_wrapper($output, $pane, $display, $renderer) { ), ); - $attr = array( + $attributes = array( 'class' => 'panels-ipe-linkbar', ); - $links = theme('links', $links, $attr); + $links = theme('links', array('links' => $links, 'attributes' => $attributes)); $links .= '
 
'; - $handlebar = '
' . $links . '
'; + $handlebar = '
' . $links . '
'; return $handlebar . $output; } -function theme_panels_ipe_region_wrapper($output, $region_id, $display) { - return $output; +function theme_panels_ipe_region_wrapper($vars) { + return $vars['output']; } -function theme_panels_ipe_add_pane_button($region_id, $display, $renderer) { - $attr = array('class' => 'ctools-use-modal'); - $link = l(t('Add new pane'), $renderer->get_url('select-content', $region_id), array('attributes' => $attr)); +function theme_panels_ipe_add_pane_button($vars) { + $region_id = $vars['region_id']; + $display = $vars['display']; + $renderer = $vars['renderer']; + + $attributes = array('class' => 'ctools-use-modal'); + $link = l(t('Add new pane'), $renderer->get_url('select-content', $region_id), array('attributes' => $attributes)); return '
' . $link . '
'; } @@ -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 = "
"; + $output = "
"; $output .= "
"; $output .= "
"; $output .= "" . t('Customize this page') . ""; $output .= "
"; - $output .= "
"; + $output .= "
"; $output .= "
"; - return $output; + + $page['page_bottom']['panels_ipe'] = array( + '#markup' => $output, + ); } diff --git a/panels_ipe/plugins/display_renderers/ipe.inc b/panels_ipe/plugins/display_renderers/ipe.inc index afe1e444c2f5dceecaff1e238899b94e792fa437..ab63f9ee761a329edff81a4503f93788fc3912f0 100644 --- a/panels_ipe/plugins/display_renderers/ipe.inc +++ b/panels_ipe/plugins/display_renderers/ipe.inc @@ -1,8 +1,5 @@ array( - 'class' => 'panels_renderer_ipe', - 'parent' => 'editor', - ), -); \ No newline at end of file + 'renderer' => 'panels_renderer_ipe', +); diff --git a/panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php b/panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php index fad426c81eb9c09fd2640c5c0d062d24b0a7bb27..4d4a23a73eebad15e4858860cdfc399064873628 100644 --- a/panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php +++ b/panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php @@ -43,7 +43,13 @@ class panels_renderer_ipe extends panels_renderer_editor { drupal_add_js(array('PanelsIPECacheKeys' => array($this->clean_key)), 'setting'); drupal_add_js(array('PanelsIPESettings' => array($this->clean_key => $settings)), 'setting'); - jquery_ui_add(array('ui.draggable', 'ui.droppable', 'ui.sortable')); + drupal_add_library('system', 'ui.draggable'); + drupal_add_library('system', 'ui.droppable'); + drupal_add_library('system', 'ui.sortable'); +// drupal_add_js('misc/ui/jquery.ui.draggable.min.js'); +// drupal_add_js('misc/ui/jquery.ui.droppable.min.js'); +// drupal_add_js('misc/ui/jquery.ui.sortable.min.js'); +// jquery_ui_add(array('ui.draggable', 'ui.droppable', 'ui.sortable')); parent::add_meta(); } @@ -68,7 +74,7 @@ class panels_renderer_ipe extends panels_renderer_editor { $output = "
$output
"; } // Hand it off to the plugin/theme for placing draggers/buttons - $output = theme('panels_ipe_pane_wrapper', $output, $pane, $this->display, $this); + $output = theme('panels_ipe_pane_wrapper', array('output' => $output, 'pane' => $pane, 'display' => $this->display, 'renderer' => $this)); return "
pid}\" class=\"panels-ipe-portlet-wrapper panels-ipe-portlet-marker\">" . $output . "
"; } @@ -95,16 +101,16 @@ class panels_renderer_ipe extends panels_renderer_editor { */ function render_region($region_id, $panes) { // Generate this region's 'empty' placeholder pane from the IPE plugin. - $empty_ph = theme('panels_ipe_placeholder_pane', $region_id, $this->plugins['layout']['panels'][$region_id]); + $empty_ph = theme('panels_ipe_placeholder_pane', array('region_id' => $region_id, 'region_title' => $this->plugins['layout']['regions'][$region_id])); // Wrap the placeholder in some guaranteed markup. $panes['empty_placeholder'] = '
' . $empty_ph . "
"; // Generate this region's add new pane button. FIXME waaaaay too hardcoded - $panes['add_button'] = theme('panels_ipe_add_pane_button', $region_id, $this->display, $this); + $panes['add_button'] = theme('panels_ipe_add_pane_button', array('region_id' => $region_id, 'display' => $this->display, 'renderer' => $this)); $output = parent::render_region($region_id, $panes); - $output = theme('panels_ipe_region_wrapper', $output, $region_id, $this->display); + $output = theme('panels_ipe_region_wrapper', array('output' => $output, 'region_id' => $region_id, 'display' => $this->display, 'renderer' => $this)); $classes = 'panels-ipe-region'; ctools_include('cleanstring'); @@ -116,11 +122,10 @@ class panels_renderer_ipe extends panels_renderer_editor { * AJAX entry point to create the controller form for an IPE. */ function ajax_save_form($break = NULL) { - ctools_include('form'); if (!empty($this->cache->locked)) { if ($break != 'break') { $account = user_load($this->cache->locked->uid); - $name = theme('username', $account); + $name = theme('username', array('account' => $account)); $lock_age = format_interval(time() - $this->cache->locked->updated); $message = t("This panel is being edited by user !user, and is therefore locked from editing by others. This lock is !age old.\n\nClick OK to break this lock and discard any changes made by !user.", array('!user' => $name, '!age' => $lock_age)); @@ -146,19 +151,19 @@ class panels_renderer_ipe extends panels_renderer_editor { 'layout' => $this->plugins['layout'], ); - $output = ctools_build_form('panels_ipe_edit_control_form', $form_state); - if ($output) { + $output = drupal_build_form('panels_ipe_edit_control_form', $form_state); + if (empty($form_state['executed'])) { // At this point, we want to save the cache to ensure that we have a lock. panels_edit_cache_set($this->cache); $this->commands[] = array( 'command' => 'initIPE', 'key' => $this->clean_key, - 'data' => $output, + 'data' => drupal_render($output), ); return; } - // no output == submit + // Otherwise it was submitted. if (!empty($form_state['clicked_button']['#save-display'])) { // Saved. Save the cache. panels_edit_cache_save($this->cache); @@ -186,8 +191,8 @@ class panels_renderer_ipe extends panels_renderer_editor { $pane = $this->display->content[$pid]; } - $this->commands[] = ctools_ajax_command_replace("#panels-ipe-paneid-$pane->pid", $this->render_pane($pane)); - $this->commands[] = ctools_ajax_command_changed("#panels-ipe-display-{$this->clean_key}"); + $this->commands[] = ajax_command_replace("#panels-ipe-paneid-$pane->pid", $this->render_pane($pane)); + $this->commands[] = ajax_command_changed("#panels-ipe-display-{$this->clean_key}"); } /** @@ -203,15 +208,15 @@ class panels_renderer_ipe extends panels_renderer_editor { ctools_include('cleanstring'); $region_id = ctools_cleanstring($pane->panel); - $this->commands[] = ctools_ajax_command_append("#panels-ipe-regionid-$region_id div.panels-ipe-sort-container", $this->render_pane($pane)); - $this->commands[] = ctools_ajax_command_changed("#panels-ipe-display-{$this->clean_key}"); + $this->commands[] = ajax_command_append("#panels-ipe-regionid-$region_id div.panels-ipe-sort-container", $this->render_pane($pane)); + $this->commands[] = ajax_command_changed("#panels-ipe-display-{$this->clean_key}"); } } /** * FAPI callback to create the Save/Cancel form for the IPE. */ -function panels_ipe_edit_control_form(&$form_state) { +function panels_ipe_edit_control_form($form, &$form_state) { $display = &$form_state['display']; // @todo -- this should be unnecessary as we ensure cache_key is set in add_meta() // $display->cache_key = isset($display->cache_key) ? $display->cache_key : $display->did; @@ -247,6 +252,7 @@ function panels_ipe_edit_control_form(&$form_state) { ); $form['buttons']['cancel'] = array( '#type' => 'submit', + '#id' => 'panels-ipe-cancel', '#value' => t('Cancel'), ); return $form; diff --git a/panels_mini/panels_mini.admin.inc b/panels_mini/panels_mini.admin.inc deleted file mode 100644 index 4adc7caf39047831663c3817edd5ada60daad07f..0000000000000000000000000000000000000000 --- a/panels_mini/panels_mini.admin.inc +++ /dev/null @@ -1,42 +0,0 @@ - array('create mini panels'), - 'file' => 'panels_mini.admin.inc', - ); - - $items['admin/build/mini-panels/settings'] = array( - 'title' => 'Settings', - 'page callback' => 'panels_mini_settings', - 'type' => MENU_LOCAL_TASK, - ) + $base; - // Also provide settings on the main panel UI - $items['admin/build/panels/settings/panels-mini'] = array( - 'title' => 'Mini panels', - 'page callback' => 'panels_mini_settings', - 'type' => MENU_LOCAL_TASK, - ) + $base; - - return $items; -} - -/** - * Settings for mini panels. - */ -function panels_mini_settings() { - ctools_include('common', 'panels'); - return drupal_get_form('panels_common_settings', 'panels_mini'); -} diff --git a/panels_mini/panels_mini.info b/panels_mini/panels_mini.info index 912111c9fbad9866a6e333302ed6066eea02680d..3f7037d7893dce4f118ff813994172eb3e7e664e 100644 --- a/panels_mini/panels_mini.info +++ b/panels_mini/panels_mini.info @@ -3,4 +3,5 @@ name = Mini panels description = Create mini panels that can be used as blocks by Drupal and panes by other panel modules. package = "Panels" dependencies[] = panels -core = 6.x \ No newline at end of file +core = 7.x +files[] = plugins/export_ui/panels_mini_ui.class.php \ No newline at end of file diff --git a/panels_mini/panels_mini.install b/panels_mini/panels_mini.install index d26c9b67e8a1a17bc341853c1b9e986cd221a4bc..235e611b6802fffc4b083def5a3c0ed9a248feac 100644 --- a/panels_mini/panels_mini.install +++ b/panels_mini/panels_mini.install @@ -95,13 +95,6 @@ function panels_mini_schema_1() { return $schema; } -/** - * Implementation of hook_install(). - */ -function panels_mini_install() { - drupal_install_schema('panels_mini'); -} - /** * Implementation of hook_uninstall(). */ @@ -120,9 +113,6 @@ function panels_mini_uninstall() { // Delete all configured blocks. db_query("DELETE FROM {blocks} WHERE module = 'panels_mini' AND delta = %d", $panel_mini->pid); } - - // Finally, delete all mini panels. - drupal_uninstall_schema('panels_mini'); } /** diff --git a/panels_mini/panels_mini.module b/panels_mini/panels_mini.module index 7ffaf8803e150eef3485c5f5e74452955a04b08d..4012d21bf5584c6566e52ae8517d46f94380629e 100644 --- a/panels_mini/panels_mini.module +++ b/panels_mini/panels_mini.module @@ -9,10 +9,19 @@ */ /** - * Implementation of hook_perm(). + * Implementation of hook_permission(). */ -function panels_mini_perm() { - return array('create mini panels', 'administer mini panels'); +function panels_mini_permission() { + return array( + 'create mini panels' => array( + 'title' => t('Create mini panels'), + 'description' => t('Create new mini panels'), + ), + 'administer mini panels' => array( + 'title' => t('Administer mini panels'), + 'description' => t('Edit and delete mini panels'), + ), + ); } /** @@ -23,79 +32,106 @@ function panels_mini_menu() { if (!defined('PANELS_REQUIRED_CTOOLS_API') || !module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) { return array(); } - require_once drupal_get_path('module', 'panels_mini') . '/panels_mini.admin.inc'; - return _panels_mini_menu(); + + $items['admin/structure/mini-panels/settings'] = array( + 'title' => 'Settings', + 'page callback' => 'panels_mini_settings', + 'access arguments' => array('create mini panels'), + 'type' => MENU_LOCAL_TASK, + ); + + // Also provide settings on the main panel UI + $items['admin/structure/panels/settings/panels-mini'] = array( + 'title' => 'Mini panels', + 'page callback' => 'panels_mini_settings', + 'access arguments' => array('create mini panels'), + 'type' => MENU_LOCAL_TASK, + ); + + return $items; +} + +/** + * Settings for mini panels. + */ +function panels_mini_settings() { + ctools_include('common', 'panels'); + return drupal_get_form('panels_common_settings', 'panels_mini'); } // --------------------------------------------------------------------------- // Allow the rest of the system access to mini panels /** - * Implementation of hook_block(). - * - * Expose qualifying mini panels to Drupal's block system. + * Implementation of hook_block_list(). */ -function panels_mini_block($op = 'list', $delta = 0, $edit = array()) { +function panels_mini_block_info() { // Safety: go away if CTools is not at an appropriate version. if (!defined('PANELS_REQUIRED_CTOOLS_API') || !module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) { return array(); } - if ($op == 'list') { - $blocks = array(); + $blocks = array(); - $minis = panels_mini_load_all(); - foreach ($minis as $panel_mini) { - if (empty($mini->disabled) && empty($mini->requiredcontext)) { - $blocks[$panel_mini->name] = array( - 'info' => t('Mini panel: "@title"', array('@title' => $panel_mini->admin_title)), - 'cache' => BLOCK_NO_CACHE, - ); - } + $minis = panels_mini_load_all(); + foreach ($minis as $panel_mini) { + if (empty($mini->disabled) && empty($mini->requiredcontext)) { + $blocks[$panel_mini->name] = array( + 'info' => t('Mini panel: "@title"', array('@title' => $panel_mini->admin_title)), + 'cache' => DRUPAL_NO_CACHE, + ); } + } + + return $blocks; +} - return $blocks; +/** + * Implementation of hook_block_view(). + */ +function panels_mini_block_view($delta = 0) { + // static recursion protection. + static $viewing = array(); + if (!empty($viewing[$delta])) { + return; } - elseif ($op == 'view') { - // static recursion protection. - static $viewing = array(); - if (!empty($viewing[$delta])) { - return; - } - $viewing[$delta] = TRUE; + $viewing[$delta] = TRUE; - $panel_mini = panels_mini_load($delta); - if (empty($panel_mini)) { - // Bail out early if the specified mini panel doesn't exist. - return; - } + $panel_mini = panels_mini_load($delta); + if (empty($panel_mini)) { + // Bail out early if the specified mini panel doesn't exist. + return; + } - ctools_include('context'); - $panel_mini->context = $panel_mini->display->context = ctools_context_load_contexts($panel_mini); - $panel_mini->display->css_id = panels_mini_get_id($panel_mini->name); + ctools_include('context'); + $panel_mini->context = $panel_mini->display->context = ctools_context_load_contexts($panel_mini); + $panel_mini->display->css_id = panels_mini_get_id($panel_mini->name); - $block = array(); + $block = array(); - $block['content'] = panels_render_display($panel_mini->display); - $block['subject'] = $panel_mini->display->get_title(); + $block['content'] = panels_render_display($panel_mini->display); + $block['subject'] = $panel_mini->display->get_title(); - unset($viewing[$delta]); - return $block; - } - elseif ($op = 'configure') { - return array( - 'admin-shortcut' => array( - '#value' => l(t('Manage this mini-panel'), 'admin/build/panel-mini/' . $delta . '/edit-general') - ), - ); - } + unset($viewing[$delta]); + return $block; +} + +/** + * Implementation of hook_block_configure(). + */ +function panels_mini_block_configure($delta = 0) { + return array( + 'admin-shortcut' => array( + '#value' => l(t('Manage this mini-panel'), 'admin/structure/mini-panels/' . $delta . '/edit') + ), + ); } /** * Statically store all used IDs to ensure all mini panels get a unique id. */ function panels_mini_get_id($name) { - static $id_cache = array(); + $id_cache = &drupal_static(__FUNCTION__, array()); $id = 'mini-panel-' . $name; if (!empty($id_cache[$name])) { @@ -123,7 +159,7 @@ function panels_mini_new($set_defaults = TRUE) { * Load a single mini panel. */ function panels_mini_load($name) { - $cache = &ctools_static('panels_mini_load_all', array()); + $cache = &drupal_static('panels_mini_load_all', array()); // We use array_key_exists because failed loads will be NULL and // isset() will try to load it again. @@ -156,7 +192,7 @@ function panels_mini_load($name) { * Load all mini panels. */ function panels_mini_load_all($reset = FALSE) { - $cache = &ctools_static('panels_mini_load_all', array()); + $cache = &drupal_static('panels_mini_load_all', array()); static $all_loaded = FALSE; // We check our own private static because individual minis could have @@ -196,7 +232,6 @@ function panels_mini_load_all($reset = FALSE) { } $cache[$dids[$did]]->display = $display; } - return $result[$name]; } return $cache; @@ -221,9 +256,17 @@ function panels_mini_save(&$mini) { * Remove a mini panel. */ function panels_mini_delete($mini) { - db_query("DELETE FROM {panels_mini} WHERE name = '%s'", $mini->name); + db_delete('panels_mini') + ->condition('name', $mini->name) + ->execute(); + if ($mini->type != t('Overridden')) { + // Also remove from blocks table as long as there isn't a default that may appear. db_query("DELETE FROM {blocks} WHERE module = 'panels_mini' AND delta = '%s'", $mini->name); + db_delete('blocks') + ->condition('delta', $mini->name) + ->condition('module', 'panels_mini') + ->execute(); } return panels_delete_display($mini->did); } @@ -337,17 +380,6 @@ function panels_mini_panels_cache_save($key, $cache) { function panels_mini_panels_cache_break_lock($key, $cache) { } -/** - * Alter default mini panels to ensure they have new fields and avoid warnings. - */ -function panels_mini_default_panels_mini_alter(&$minis) { - foreach ($minis as $name => $mini) { - if (!isset($mini->admin_description)) { - $minis[$name]->admin_description = ''; - } - } -} - /** * Implementation of hook_panels_dashboard_blocks(). * @@ -355,7 +387,7 @@ function panels_mini_default_panels_mini_alter(&$minis) { */ function panels_mini_panels_dashboard_blocks(&$vars) { $vars['links']['panels_mini'] = array( - 'title' => l(t('Mini panel'), 'admin/build/mini-panels/add'), + 'title' => l(t('Mini panel'), 'admin/structure/mini-panels/add'), 'description' => t('Mini panels are small content areas exposed as blocks, for when you need to have complex block layouts or layouts within layouts.'), 'weight' => -1, ); @@ -369,7 +401,7 @@ function panels_mini_panels_dashboard_blocks(&$vars) { $rows[] = array( check_plain($panel_mini->admin_title), array( - 'data' => l(t('Edit'), "admin/build/mini-panels/list/$panel_mini->name/edit"), + 'data' => l(t('Edit'), "admin/structure/mini-panels/list/$panel_mini->name/edit"), 'class' => 'links', ), ); @@ -381,7 +413,7 @@ function panels_mini_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 mini panels.') . '

'; @@ -390,30 +422,10 @@ function panels_mini_panels_dashboard_blocks(&$vars) { $vars['blocks']['panels_mini'] = array( 'weight' => -100, 'title' => t('Manage mini panels'), - 'link' => l(t('Go to list'), 'admin/build/mini-panels'), + 'link' => l(t('Go to list'), 'admin/structure/mini-panels'), 'content' => $content, 'class' => 'dashboard-mini-panels', 'section' => 'left', ); } - -/** - * Implementation of hook_ctools_plugin_directory() to let the system know - * we implement task and task_handler plugins. - */ -function panels_mini_ctools_plugin_directory($module, $plugin) { - if ($module == 'ctools' && $plugin == 'content_types') { - return 'plugins/' . $plugin; - } -} - -function panels_mini_panels_mini_list() { - $all_panels = panels_mini_load_all(); - $list = array(); - - foreach ($all_panels as $name => $panel) { - $list[$name] = check_plain($name) . ' (' . check_plain($panel->title) . ')'; - } - return $list; -} diff --git a/panels_mini/plugins/content_types/panels_mini.inc b/panels_mini/plugins/content_types/panels_mini.inc index 6f5782205af2d42c9dd3b23daa126cd603f0ab19..d36deaba85479a22c6b0146044424b8c5c977562 100644 --- a/panels_mini/plugins/content_types/panels_mini.inc +++ b/panels_mini/plugins/content_types/panels_mini.inc @@ -112,8 +112,9 @@ function panels_mini_panels_mini_content_type_render($subtype, $conf, $panel_arg /** * Edit form for the mini panel content type. */ -function panels_mini_panels_mini_content_type_edit_form(&$form, &$form_state) { +function panels_mini_panels_mini_content_type_edit_form($form, &$form_state) { // Empty form to ensure we have the override title + context gadgets. + return $form; } /** diff --git a/panels_mini/plugins/export_ui/panels_mini_ui.class.php b/panels_mini/plugins/export_ui/panels_mini_ui.class.php index 3c9828a540f15d8c529f0ba51e7cf85306eb2f4b..00e62781f0e202203fe20e02bb9d3ce0e996a9e2 100644 --- a/panels_mini/plugins/export_ui/panels_mini_ui.class.php +++ b/panels_mini/plugins/export_ui/panels_mini_ui.class.php @@ -90,26 +90,26 @@ class panels_mini_ui extends ctools_export_ui { $this->rows[$item->name] = array( 'data' => array( - array('data' => check_plain($item->admin_title), 'class' => 'ctools-export-ui-title'), - array('data' => check_plain($item->name), 'class' => 'ctools-export-ui-name'), - array('data' => $category, 'class' => 'ctools-export-ui-category'), - array('data' => $layout, 'class' => 'ctools-export-ui-layout'), - array('data' => $item->type, 'class' => 'ctools-export-ui-storage'), - array('data' => theme('links', $operations), 'class' => 'ctools-export-ui-operations'), + array('data' => check_plain($item->admin_title), 'class' => array('ctools-export-ui-title')), + array('data' => check_plain($item->name), 'class' => array('ctools-export-ui-name')), + array('data' => $category, 'class' => array('ctools-export-ui-category')), + array('data' => $layout, 'class' => array('ctools-export-ui-layout')), + array('data' => $item->type, 'class' => array('ctools-export-ui-storage')), + array('data' => theme('links', array('links' => $operations)), 'class' => array('ctools-export-ui-operations')), ), 'title' => !empty($item->admin_description) ? check_plain($item->admin_description) : '', - 'class' => !empty($item->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled', + 'class' => array(!empty($item->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled'), ); } function list_table_header() { return array( - array('data' => t('Title'), 'class' => 'ctools-export-ui-title'), - array('data' => t('Name'), 'class' => 'ctools-export-ui-name'), - array('data' => t('Category'), 'class' => 'ctools-export-ui-category'), - array('data' => t('Layout'), 'class' => 'ctools-export-ui-layout'), - array('data' => t('Storage'), 'class' => 'ctools-export-ui-storage'), - array('data' => t('Operations'), 'class' => 'ctools-export-ui-operations'), + array('data' => t('Title'), 'class' => array('ctools-export-ui-title')), + array('data' => t('Name'), 'class' => array('ctools-export-ui-name')), + array('data' => t('Category'), 'class' => array('ctools-export-ui-category')), + array('data' => t('Layout'), 'class' => array('ctools-export-ui-layout')), + array('data' => t('Storage'), 'class' => array('ctools-export-ui-storage')), + array('data' => t('Operations'), 'class' => array('ctools-export-ui-operations')), ); } @@ -155,13 +155,13 @@ class panels_mini_ui extends ctools_export_ui { ); $form['left'] = array( - '#prefix' => '
', + '#prefix' => '
', '#suffix' => '
', ); // 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 = "
"; $output .= $panel_buttons; - $output .= "

" . $this->plugins['layout']['panels'][$region_id] . "

"; + $output .= "

" . $this->plugins['layout']['regions'][$region_id] . "

"; $output .= $content; $output .= "
"; @@ -154,7 +149,7 @@ class panels_renderer_editor extends panels_renderer_standard { $output .= '
'; $output .= '
' . $block->title . '
'; - $output .= '
' . filter_xss_admin($block->content) . '
'; + $output .= '
' . filter_xss_admin(render($block->content)) . '
'; $output .= '
'; // panel-pane-collapsible $output .= '
'; // panel-pane @@ -176,13 +171,13 @@ class panels_renderer_editor extends panels_renderer_standard { $style_links[] = array( 'title' => $style_title, - 'attributes' => array('class' => 'panels-text'), + 'attributes' => array('class' => array('panels-text')), ); $style_links[] = array( 'title' => t('Change'), 'href' => $this->get_url('style-type', $type, $id), - 'attributes' => array('class' => 'ctools-use-modal'), + 'attributes' => array('class' => array('ctools-use-modal')), ); $function = $type != 'pane' ? 'settings form' : 'pane settings form'; @@ -190,7 +185,7 @@ class panels_renderer_editor extends panels_renderer_standard { $style_links[] = array( 'title' => t('Settings'), 'href' => $this->get_url('style-settings', $type, $id), - 'attributes' => array('class' => 'ctools-use-modal'), + 'attributes' => array('class' => array('ctools-use-modal')), ); } @@ -205,11 +200,10 @@ class panels_renderer_editor extends panels_renderer_standard { function get_display_links() { $links = array(); $style_links = $this->get_style_links('display'); - $links[] = array( - 'title' => '' . t('Style') . '' . theme_links($style_links), + 'title' => '' . t('Style') . '' . theme_links(array('links' => $style_links, 'attributes' => array(), 'heading' => array())), 'html' => TRUE, - 'attributes' => array('class' => 'panels-sub-menu'), + 'attributes' => array('class' => array('panels-sub-menu')), ); if (user_access('use panels caching features')) { @@ -224,29 +218,29 @@ class panels_renderer_editor extends panels_renderer_standard { $cache_links[] = array( 'title' => $cache_method, - 'attributes' => array('class' => 'panels-text'), + 'attributes' => array('class' => array('panels-text')), ); $cache_links[] = array( 'title' => t('Change'), 'href' => $this->get_url('cache-method', 'display'), - 'attributes' => array('class' => 'ctools-use-modal'), + 'attributes' => array('class' => array('ctools-use-modal')), ); if (panels_plugin_get_function('cache', $info, 'settings form')) { $cache_links[] = array( 'title' => t('Settings'), 'href' => $this->get_url('cache-settings', 'display'), - 'attributes' => array('class' => 'ctools-use-modal'), + 'attributes' => array('class' => array('ctools-use-modal')), ); } $links[] = array( - 'title' => '' . t('Caching') . '' . theme_links($cache_links), + 'title' => '' . t('Caching') . '' . theme_links(array('links' => $cache_links, 'attributes' => array(), 'heading' => array())), 'html' => TRUE, - 'attributes' => array('class' => 'panels-sub-menu'), + 'attributes' => array('class' => array('panels-sub-menu')), ); } - return theme('ctools_dropdown', t('Display settings'), $links, FALSE, 'panels-display-links'); + return theme('ctools_dropdown', array('title' => t('Display settings'), 'link' => $links, 'class' => 'panels-display-links')); } /** @@ -258,7 +252,7 @@ class panels_renderer_editor extends panels_renderer_standard { 'title' => t('Add content'), 'href' => $this->get_url('select-content', $region_id), 'attributes' => array( - 'class' => 'ctools-use-modal', + 'class' => array('ctools-use-modal'), ), ); @@ -270,12 +264,12 @@ class panels_renderer_editor extends panels_renderer_standard { $style_links = $this->get_style_links('region', $region_id); $links[] = array( - 'title' => '' . t('Style') . '' . theme_links($style_links), + 'title' => '' . t('Style') . '' . theme_links(array('links' => $style_links, 'attributes' => array(), 'heading' => array())), 'html' => TRUE, - 'attributes' => array('class' => 'panels-sub-menu'), + 'attributes' => array('class' => array('panels-sub-menu')), ); - return theme('ctools_dropdown', theme('image', ctools_image_path('icon-addcontent.png', 'panels')), $links, TRUE, 'pane-add-link panels-region-links-' . $region_id); + return theme('ctools_dropdown', array('title' => theme('image', array('path' => ctools_image_path('icon-addcontent.png', 'panels'))), 'links' => $links, 'image' => TRUE, 'class' => 'pane-add-link panels-region-links-' . $region_id)); } /** @@ -288,14 +282,14 @@ class panels_renderer_editor extends panels_renderer_standard { $links[] = array( 'title' => t('Disable this pane'), 'href' => $this->get_url('hide', $pane->pid), - 'attributes' => array('class' => 'ctools-use-ajax'), + 'attributes' => array('class' => array('use-ajax')), ); } else { $links[] = array( 'title' => t('Enable this pane'), 'href' => $this->get_url('show', $pane->pid), - 'attributes' => array('class' => 'ctools-use-ajax'), + 'attributes' => array('class' => array('use-ajax')), ); } @@ -309,7 +303,7 @@ class panels_renderer_editor extends panels_renderer_standard { $links['panels-set-title'] = array( 'title' => t('Panel title'), 'href' => $this->get_url('panel-title', $pane->pid), - 'attributes' => array('class' => 'ctools-use-ajax'), + 'attributes' => array('class' => array('use-ajax')), ); } @@ -319,7 +313,7 @@ class panels_renderer_editor extends panels_renderer_standard { $links[] = array( 'title' => isset($content_type['edit text']) ? $content_type['edit text'] : t('Settings'), 'href' => $this->get_url('edit-pane', $pane->pid), - 'attributes' => array('class' => 'ctools-use-modal'), + 'attributes' => array('class' => array('ctools-use-modal')), ); } @@ -327,7 +321,7 @@ class panels_renderer_editor extends panels_renderer_standard { $links[] = array( 'title' => t('CSS properties'), 'href' => $this->get_url('pane-css', $pane->pid), - 'attributes' => array('class' => 'ctools-use-modal'), + 'attributes' => array('class' => array('ctools-use-modal')), ); } @@ -339,9 +333,9 @@ class panels_renderer_editor extends panels_renderer_standard { $style_links = $this->get_style_links('pane', $pane->pid); $links[] = array( - 'title' => '' . t('Style') . '' . theme_links($style_links), + 'title' => '' . t('Style') . '' . theme_links(array('links' => $style_links, 'attributes' => array(), 'heading' => array())), 'html' => TRUE, - 'attributes' => array('class' => 'panels-sub-menu'), + 'attributes' => array('class' => array('panels-sub-menu')), ); if (user_access('administer pane access')) { @@ -367,33 +361,33 @@ class panels_renderer_editor extends panels_renderer_standard { $visibility_links[] = array( 'title' => $access_description, 'href' => $this->get_url('access-configure-test', $pane->pid, $id), - 'attributes' => array('class' => 'ctools-use-modal panels-italic'), + 'attributes' => array('class' => array('ctools-use-modal', 'panels-italic')), ); } } if (empty($visibility_links)) { $visibility_links[] = array( 'title' => t('No rules'), - 'attributes' => array('class' => 'panels-text'), + 'attributes' => array('class' => array('panels-text')), ); } $visibility_links[] = array( 'title' => t('Add new rule'), 'href' => $this->get_url('access-add-test', $pane->pid), - 'attributes' => array('class' => 'ctools-use-modal'), + 'attributes' => array('class' => array('ctools-use-modal')), ); $visibility_links[] = array( 'title' => t('Settings'), 'href' => $this->get_url('access-settings', $pane->pid), - 'attributes' => array('class' => 'ctools-use-modal'), + 'attributes' => array('class' => array('ctools-use-modal')), ); $links[] = array( - 'title' => '' . t('Visibility rules') . '' . theme_links($visibility_links), + 'title' => '' . t('Visibility rules') . '' . theme_links(array('links' => $visibility_links, 'attributes' => array(), 'heading' => array())), 'html' => TRUE, - 'attributes' => array('class' => 'panels-sub-menu'), + 'attributes' => array('class' => array('panels-sub-menu')), ); } @@ -408,25 +402,25 @@ class panels_renderer_editor extends panels_renderer_standard { $cache_method = isset($info['title']) ? $info['title'] : t('No caching'); $cache_links[] = array( 'title' => $cache_method, - 'attributes' => array('class' => 'panels-text'), + 'attributes' => array('class' => array('panels-text')), ); $cache_links[] = array( 'title' => t('Change'), 'href' => $this->get_url('cache-method', $pane->pid), - 'attributes' => array('class' => 'ctools-use-modal'), + 'attributes' => array('class' => array('ctools-use-modal')), ); if (panels_plugin_get_function('cache', $info, 'settings form')) { $cache_links[] = array( 'title' => t('Settings'), 'href' => $this->get_url('cache-settings', $pane->pid), - 'attributes' => array('class' => 'ctools-use-modal'), + 'attributes' => array('class' => array('ctools-use-modal')), ); } $links[] = array( - 'title' => '' . t('Caching') . '' . theme_links($cache_links), + 'title' => '' . t('Caching') . '' . theme_links(array('links' => $cache_links, 'attributes' => array(), 'heading' => array())), 'html' => TRUE, - 'attributes' => array('class' => 'panels-sub-menu'), + 'attributes' => array('class' => array('panels-sub-menu')), ); } @@ -439,12 +433,12 @@ class panels_renderer_editor extends panels_renderer_standard { 'title' => t('Remove'), 'href' => '#', 'attributes' => array( - 'class' => 'pane-delete', + 'class' => array('pane-delete'), 'id' => "pane-delete-panel-pane-$pane->pid", ), ); - return theme('ctools_dropdown', theme('image', ctools_image_path('icon-configure.png', 'panels')), $links, TRUE); + return theme('ctools_dropdown', array('title' => theme('image', array('path' => ctools_image_path('icon-configure.png', 'panels'))), 'links' => $links, 'image' => TRUE)); } // ----------------------------------------------------------------------- @@ -496,11 +490,11 @@ class panels_renderer_editor extends panels_renderer_standard { * AJAX command to present a dialog with a list of available content. */ function ajax_select_content($region = NULL, $category = NULL) { - if (!array_key_exists($region, $this->plugins['layout']['panels'])) { + if (!array_key_exists($region, $this->plugins['layout']['regions'])) { ctools_modal_render(t('Error'), t('Invalid input')); } - $title = t('Add content to !s', array('!s' => $this->plugins['layout']['panels'][$region])); + $title = t('Add content to !s', array('!s' => $this->plugins['layout']['regions'][$region])); $categories = $this->get_categories($this->cache->content_types); @@ -607,7 +601,7 @@ class panels_renderer_editor extends panels_renderer_standard { $icon = ctools_content_admin_icon($content_type); $url = $this->get_url('add-pane', $region, $content_type['type_name'], $content_type['subtype_name']); - $output = '
'; + $output = '
'; $output .= ctools_ajax_image_button($icon, $url, $description, 'panels-modal-add-config'); $output .= '
' . ctools_ajax_text_button($title, $url, $description, 'panels-modal-add-config') . '
'; $output .= '
'; @@ -703,7 +697,7 @@ class panels_renderer_editor extends panels_renderer_standard { 'contexts' => $this->cache->display->context, 'pane' => &$pane, 'cache_key' => $this->display->cache_key, - 'cache' => &$this->cache, + 'display cache' => &$this->cache, 'ajax' => TRUE, 'modal' => TRUE, // This will force the system to not automatically render. @@ -764,7 +758,7 @@ class panels_renderer_editor extends panels_renderer_standard { 'display' => &$this->cache->display, 'contexts' => $this->cache->display->context, 'pane' => &$pane, - 'cache' => &$this->cache, + 'display cache' => &$this->cache, 'ajax' => TRUE, 'modal' => TRUE, 'modal return' => TRUE, @@ -855,7 +849,7 @@ class panels_renderer_editor extends panels_renderer_standard { ); $output = ctools_modal_form_wrapper('panels_edit_cache_method_form', $form_state); - if (!empty($output)) { + if (empty($form_state['executed'])) { $this->commands = $output; return; } @@ -929,7 +923,7 @@ class panels_renderer_editor extends panels_renderer_standard { ); $output = ctools_modal_form_wrapper('panels_edit_cache_settings_form', $form_state); - if (!empty($output)) { + if (empty($form_state['executed'])) { $this->commands = $output; return; } @@ -965,7 +959,7 @@ class panels_renderer_editor extends panels_renderer_standard { case 'region': $style = isset($this->display->panel_settings[$pid]['style']) ? $this->display->panel_settings[$pid]['style'] : '-1'; // -1 signifies to use the default setting. - $title = t('Panel style for region "!region"', array('!region' => $this->plugins['layout']['panels'][$pid])); + $title = t('Panel style for region "!region"', array('!region' => $this->plugins['layout']['regions'][$pid])); break; case 'pane': @@ -998,7 +992,7 @@ class panels_renderer_editor extends panels_renderer_standard { ); $output = ctools_modal_form_wrapper('panels_edit_style_type_form', $form_state); - if (!empty($output)) { + if (empty($form_state['executed'])) { $this->commands = $output; return; } @@ -1154,7 +1148,7 @@ class panels_renderer_editor extends panels_renderer_standard { break; case 'region': - $title = t('Style settings for style @style (Region "!region")', array('@style' => $style['title'], '!region' => $this->plugins['layout']['panels'][$pid])); + $title = t('Style settings for style @style (Region "!region")', array('@style' => $style['title'], '!region' => $this->plugins['layout']['regions'][$pid])); break; case 'pane': @@ -1178,7 +1172,7 @@ class panels_renderer_editor extends panels_renderer_standard { ); $output = ctools_modal_form_wrapper('panels_edit_style_settings_form', $form_state); - if (!empty($output)) { + if (empty($form_state['executed'])) { $this->commands = $output; return; } @@ -1225,7 +1219,7 @@ class panels_renderer_editor extends panels_renderer_standard { ); $output = ctools_modal_form_wrapper('panels_edit_configure_pane_css_form', $form_state); - if (!empty($output)) { + if (empty($form_state['executed'])) { $this->commands = $output; return; } @@ -1257,7 +1251,7 @@ class panels_renderer_editor extends panels_renderer_standard { ); $output = ctools_modal_form_wrapper('panels_edit_configure_access_settings_form', $form_state); - if (!empty($output)) { + if (empty($form_state['executed'])) { $this->commands = $output; return; } @@ -1286,7 +1280,7 @@ class panels_renderer_editor extends panels_renderer_standard { ); $output = ctools_modal_form_wrapper('panels_edit_add_access_test_form', $form_state); - if (empty($output)) { + if (!empty($form_state['executed'])) { // Set up the plugin in cache $plugin = ctools_get_access_plugin($form_state['values']['type']); $this->cache->new_plugin = ctools_access_new_test($plugin); @@ -1296,7 +1290,7 @@ class panels_renderer_editor extends panels_renderer_standard { return $this->ajax_access_configure_test($pid, 'add'); } - ctools_ajax_render($output); + $this->commands = $output; } /** @@ -1335,7 +1329,7 @@ class panels_renderer_editor extends panels_renderer_standard { ); $output = ctools_modal_form_wrapper('panels_edit_configure_access_test_form', $form_state); - if (!empty($output)) { + if (empty($form_state['executed'])) { $this->commands = $output; return; } @@ -1428,8 +1422,8 @@ class panels_renderer_editor extends panels_renderer_standard { $pane = $this->display->content[$pid]; } - $this->commands[] = ctools_ajax_command_replace("#panel-pane-$pane->pid", $this->render_pane($pane)); - $this->commands[] = ctools_ajax_command_changed("#panel-pane-$pane->pid", "div.grabber span.text"); + $this->commands[] = ajax_command_replace("#panel-pane-$pane->pid", $this->render_pane($pane)); + $this->commands[] = ajax_command_changed("#panel-pane-$pane->pid", "div.grabber span.text"); } /** @@ -1443,22 +1437,22 @@ class panels_renderer_editor extends panels_renderer_standard { $pane = $this->display->content[$pid]; } - $this->commands[] = ctools_ajax_command_append("#panel-pane-$pane->panel", $this->render_pane($pane)); - $this->commands[] = ctools_ajax_command_changed("#panel-pane-$pane->pid", "div.grabber span.text"); + $this->commands[] = ajax_command_append("#panel-pane-$pane->panel", $this->render_pane($pane)); + $this->commands[] = ajax_command_changed("#panel-pane-$pane->pid", "div.grabber span.text"); } /** * Create a command to update the links on a display after a change was made. */ function command_update_display_links() { - $this->commands[] = ctools_ajax_command_replace('.panels-display-links', $this->get_display_links()); + $this->commands[] = ajax_command_replace('.panels-display-links', $this->get_display_links()); } /** * Create a command to update the links on a region after a change was made. */ function command_update_region_links($id) { - $this->commands[] = ctools_ajax_command_replace('.panels-region-links-' . $id, $this->get_region_links($id)); + $this->commands[] = ajax_command_replace('.panels-region-links-' . $id, $this->get_region_links($id)); } } @@ -1468,8 +1462,8 @@ class panels_renderer_editor extends panels_renderer_standard { * All we need to do is store the updated pane in the cache. */ function panels_ajax_edit_pane_next(&$form_state) { - $form_state['cache']->new_pane = $form_state['pane']; - panels_edit_cache_set($form_state['cache']); + $form_state['display cache']->new_pane = $form_state['pane']; + panels_edit_cache_set($form_state['display cache']); } /** @@ -1497,7 +1491,7 @@ function panels_ajax_edit_pane_cancel(&$form_state) { /** * Choose cache method form */ -function panels_edit_cache_method_form(&$form_state) { +function panels_edit_cache_method_form($form, &$form_state) { $display = &$form_state['display']; $conf = &$form_state['conf']; @@ -1545,7 +1539,7 @@ function panels_edit_cache_method_form_submit($form, &$form_state) { /** * Cache settings form */ -function panels_edit_cache_settings_form(&$form_state) { +function panels_edit_cache_settings_form($form, &$form_state) { $display = &$form_state['display']; $conf = &$form_state['conf']; $pid = $form_state['pid']; @@ -1605,14 +1599,14 @@ function panels_edit_cache_settings_form_submit($form, &$form_state) { /** * Choose style form */ -function panels_edit_style_type_form(&$form_state) { +function panels_edit_style_type_form($form, &$form_state) { $display = &$form_state['display']; $style = $form_state['style']; $type = $form_state['type']; $styles = panels_get_styles(); - $function = ($type == 'pane' ? 'render pane' : (variable_get('panels_legacy_rendering_mode', TRUE) ? 'render panel' : 'render region')); + $function = ($type == 'pane' ? 'render pane' : 'render region'); $options = array(); if ($type == 'region') { $options[-1] = t('Use display default style'); @@ -1655,7 +1649,7 @@ function panels_edit_style_type_form_submit($form, &$form_state) { /** * Style settings form */ -function panels_edit_style_settings_form(&$form_state) { +function panels_edit_style_settings_form($form, &$form_state) { $display = &$form_state['display']; $conf = &$form_state['conf']; $pid = $form_state['pid']; @@ -1709,7 +1703,7 @@ function panels_edit_style_settings_form_submit($form, &$form_state) { /** * Configure CSS on a pane form. */ -function panels_edit_configure_pane_css_form(&$form_state) { +function panels_edit_configure_pane_css_form($form, &$form_state) { $display = &$form_state['display']; $pane = &$form_state['pane']; @@ -1788,7 +1782,7 @@ function panels_edit_configure_access_settings_form_submit($form, &$form_state) /** * Form to add a visibility rule. */ -function panels_edit_add_access_test_form(&$form_state) { +function panels_edit_add_access_test_form($form, &$form_state) { $display = &$form_state['display']; $pane = &$form_state['pane']; @@ -1817,7 +1811,7 @@ function panels_edit_add_access_test_form(&$form_state) { /** * Form to configure a visibility rule. */ -function panels_edit_configure_access_test_form(&$form_state) { +function panels_edit_configure_access_test_form($form, &$form_state) { $display = &$form_state['display']; $test = &$form_state['test']; $plugin = &$form_state['plugin']; @@ -1835,7 +1829,7 @@ function panels_edit_configure_access_test_form(&$form_state) { $form['settings'] = array('#tree' => TRUE); if ($function = ctools_plugin_get_function($plugin, 'settings form')) { - $function($form, $form_state, $test['settings']); + $form = $function($form, $form_state, $test['settings']); } $form['not'] = array( diff --git a/plugins/display_renderers/panels_renderer_legacy.class.php b/plugins/display_renderers/panels_renderer_legacy.class.php deleted file mode 100644 index 7c99046425af5cbc8fa7770f9ae43d090fc7e9a0..0000000000000000000000000000000000000000 --- a/plugins/display_renderers/panels_renderer_legacy.class.php +++ /dev/null @@ -1,292 +0,0 @@ -plugin = $plugin; - $this->plugins['layout'] = panels_get_layout($display->layout); - if (empty($this->plugins['layout'])) { - watchdog('panels', "Layout: @layout couldn't been found, maybe the theme is disabled.", array('@layout' => $display->layout)); - } - $this->display = &$display; - } - - /** - * Add CSS information to the renderer. - * - * To facilitate previews over Views, CSS can now be added in a manner - * that does not necessarily mean just using drupal_add_css. Therefore, - * during the panel rendering process, this method can be used to add - * css and make certain that ti gets to the proper location. - * - * The arguments should exactly match drupal_add_css(). - * - * @see drupal_add_css - */ - function add_css($filename, $type = 'module', $media = 'all', $preprocess = TRUE) { - $path = file_create_path($filename); - switch ($this->meta_location) { - case 'standard': - if ($path) { - // Use CTools CSS add because it can handle temporary CSS in private - // filesystem. - ctools_include('css'); - ctools_css_add_css($filename, $type, $media, $preprocess); - } - else { - drupal_add_css($filename, $type, $media, $preprocess); - } - break; - case 'inline': - if ($path) { - $url = file_create_url($filename); - } - else { - $url = base_path() . $filename; - } - - $this->prefix .= ''."\n"; - break; - } - } - - /** - * Builds inner content, then hands off to layout-specified theme function for - * final render step. - * - * This is the outermost method in the Panels render pipeline. It calls the - * inner methods, which return a content array, which is in turn passed to the - * theme function specified in the layout plugin. - * - * @return string - * Themed & rendered HTML output. - */ - function render() { - if (!empty($this->plugins['layout']['css'])) { - if (file_exists(path_to_theme() . '/' . $this->plugins['layout']['css'])) { - drupal_add_css(path_to_theme() . '/' . $this->plugins['layout']['css']); - } - else { - drupal_add_css($this->plugins['layout']['path'] . '/' . $this->plugins['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 (empty($this->display->cache['method']) || !empty($this->display->skip_cache)) { - $content = $this->render_regions(); - } - else { - $cache = panels_get_cached_content($this->display, $this->display->args, $this->display->context); - if ($cache === FALSE) { - $cache = new panels_cache_object(); - $cache->set_content($this->render_regions()); - panels_set_cached_content($cache, $this->display, $this->display->args, $this->display->context); - } - $content = $cache->content; - } - - $output = theme($this->plugins['layout']['theme'], check_plain($this->display->css_id), $content, $this->display->layout_settings, $this->display, $this->plugins['layout'], $this); - - return $this->prefix . $output . $this->suffix; - } - - /** - * Render all panes in the attached display into their panel regions, then - * render those regions. - * - * @return array $content - * An array of rendered panel regions, keyed on the region name. - */ - function render_regions() { - ctools_include('content'); - - // First, render all the panes into little boxes. We do this here because - // some panes request to be rendered after other panes (primarily so they - // can do the leftovers of forms). - $panes = $first = $normal = $last = array(); - - foreach ($this->display->content as $pid => $pane) { - $pane->shown = !empty($pane->shown); // guarantee this field exists. - // If the user can't see this pane, do not render it. - if (!$pane->shown || !panels_pane_access($pane, $this->display)) { - continue; - } - - $content_type = ctools_get_content_type($pane->type); - - // If this pane wants to render last, add it to the $last array. We allow - // this because some panes need to be rendered after other panes, - // primarily so they can do things like the leftovers of forms. - if (!empty($content_type['render last'])) { - $last[$pid] = $pane; - } - // If it wants to render first, add it to the $first array. This is used - // by panes that need to do some processing before other panes are - // rendered. - else if (!empty($content_type['render first'])) { - $first[$pid] = $pane; - } - // Otherwise, render it in the normal order. - else { - $normal[$pid] = $pane; - } - } - - foreach (($first + $normal + $last) as $pid => $pane) { - $panes[$pid] = $this->render_pane($pane); - } - - // Loop through all panels, put all panes that belong to the current panel - // in an array, then render the panel. Primarily this ensures that the - // panes are in the proper order. - $content = array(); - foreach ($this->display->panels as $panel_name => $pids) { - $panel_panes = array(); - foreach ($pids as $pid) { - if (!empty($panes[$pid])) { - $panel_panes[$pid] = $panes[$pid]; - } - } - $content[$panel_name] = $this->render_region($panel_name, $panel_panes); - } - - // Prevent notices by making sure that all panels at least have an entry: - $panels = panels_get_regions($this->plugins['layout'], $this->display); - foreach ($panels as $id => $panel) { - if (!isset($content[$id])) { - $content[$id] = NULL; - } - } - - return $content; - } - - /** - * Render the contents of a single pane. - * - * This method retrieves pane content and produces a ready-to-render content - * object. It also manages pane-specific caching. - * - * @param stdClass $pane - * A Panels pane object, as loaded from the database. - */ - function render_pane($pane) { - ctools_include('context'); - if (!is_array($this->display->context)) { - $this->display->context = array(); - } - - $content = FALSE; - $caching = !empty($pane->cache['method']) && empty($this->display->skip_cache); - if ($caching && ($cache = panels_get_cached_content($this->display, $this->display->args, $this->display->context, $pane))) { - $content = $cache->content; - } - else { - $content = ctools_content_render($pane->type, $pane->subtype, $pane->configuration, array(), $this->display->args, $this->display->context); - foreach (module_implements('panels_pane_content_alter') as $module) { - $function = $module . '_panels_pane_content_alter'; - $function($content, $pane, $this->display->args, $this->display->context); - } - if ($caching) { - $cache = new panels_cache_object(); - $cache->set_content($content); - panels_set_cached_content($cache, $this->display, $this->display->args, $this->display->context, $pane); - $content = $cache->content; - } - } - - // Pass long the css_id that is usually available. - if (!empty($pane->css['css_id'])) { - $content->css_id = $pane->css['css_id']; - } - - // Pass long the css_class that is usually available. - if (!empty($pane->css['css_class'])) { - $content->css_class = $pane->css['css_class']; - } - - return $content; - } - - /** - * Render a single panel region. - * - * Primarily just a passthrough to the panel region rendering callback - * specified by the style plugin that is attached to the current panel region. - * - * @param $region_name - * The ID of the panel region being rendered - * @param $panes - * An array of panes that are assigned to the panel that's being rendered. - * - * @return - * The rendered HTML for the passed-in panel region. - */ - function render_region($region_name, $panes) { - list($style, $style_settings) = panels_get_panel_style_and_settings($this->display->panel_settings, $region_name); - $callback = 'render panel'; - - // Retrieve the pid (can be a panel page id, a mini panel id, etc.), this - // might be used (or even necessary) for some panel display styles. - $owner_id = 0; - if (isset($this->display->owner) && is_object($this->display->owner) && isset($this->display->owner->id)) { - $owner_id = $this->display->owner->id; - } - - // Check to see if we're actually running a current style plugin even though - // we're in the legacy renderer - if (version_compare($style['version'], 2.0, '>=')) { - // We are, so pre-render the content as the current version expects - foreach($panes as $pane_id => $pane) { - $content = panels_render_pane($pane, $this->display->content[$pane_id], $this->display); - if ($content) { - $panes[$pane_id] = $content; - } - else { - unset($panes[$pane_id]); - } - } - // And set the callback to the new key - $callback = 'render region'; - - } - - return theme($style[$callback], $this->display, $owner_id, $panes, $style_settings, $region_name, $style); - } -} diff --git a/plugins/display_renderers/panels_renderer_single_pane.class.php b/plugins/display_renderers/panels_renderer_single_pane.class.php deleted file mode 100644 index ccdebaf1fd9b9d21915d5499a7a062e5ea0431b2..0000000000000000000000000000000000000000 --- a/plugins/display_renderers/panels_renderer_single_pane.class.php +++ /dev/null @@ -1,41 +0,0 @@ -plugin = $plugin; - $this->display = &$display; - } - - function prepare($external_settings = NULL) { - $this->render_pid = $external_settings; - } - - function render() { - // If no requested pid, or requested pid does not exist, - if (empty($this->render_pid) || empty($this->display->content[$this->render_pid])) { - return NULL; - } - return $this->render_pane($this->display->content[$this->render_pid]); - } - - function render_single($pid) { - return $this->render_pane($this->display->content[$pid]); - } -} \ No newline at end of file diff --git a/plugins/display_renderers/panels_renderer_standard.class.php b/plugins/display_renderers/panels_renderer_standard.class.php index 554d62ba96c9dbbced325617a1e9c9316bf3bf74..e8b26b78226b6ca9cfe5f30a3b0116d1f62b7528 100644 --- a/plugins/display_renderers/panels_renderer_standard.class.php +++ b/plugins/display_renderers/panels_renderer_standard.class.php @@ -169,7 +169,7 @@ class panels_renderer_standard { $this->display = &$display; $this->plugins['layout'] = $layout; if (!isset($layout['panels'])) { - $this->plugins['layout']['panels'] = panels_get_regions($layout, $display); + $this->plugins['layout']['regions'] = panels_get_regions($layout, $display); } if (empty($this->plugins['layout'])) { @@ -299,7 +299,7 @@ class panels_renderer_standard { $regions = array(); if (empty($settings)) { // No display/panel region settings exist, init all with the defaults. - foreach ($this->plugins['layout']['panels'] as $region_id => $title) { + foreach ($this->plugins['layout']['regions'] as $region_id => $title) { // Ensure this region has at least an empty panes array. $panes = !empty($region_pane_list[$region_id]) ? $region_pane_list[$region_id] : array(); @@ -309,7 +309,7 @@ class panels_renderer_standard { } else { // Some settings exist; iterate through each region and set individually. - foreach ($this->plugins['layout']['panels'] as $region_id => $title) { + foreach ($this->plugins['layout']['regions'] as $region_id => $title) { // Ensure this region has at least an empty panes array. $panes = !empty($region_pane_list[$region_id]) ? $region_pane_list[$region_id] : array(); @@ -382,7 +382,8 @@ class panels_renderer_standard { else { $theme = $this->plugins['layout']['theme']; } - $this->rendered['layout'] = theme($theme, check_plain($this->display->css_id), $this->rendered['regions'], $this->display->layout_settings, $this->display, $this->plugins['layout'], $this); + + $this->rendered['layout'] = theme($theme, array('css_id' => check_plain($this->display->css_id), 'content' => $this->rendered['regions'], 'settings' => $this->display->layout_settings, 'display' => $this->display, 'layout' => $this->plugins['layout'], 'renderer' => $this)); return $this->prefix . $this->rendered['layout'] . $this->suffix; } @@ -419,27 +420,19 @@ class panels_renderer_standard { * * @see drupal_add_css */ - function add_css($filename, $type = 'module', $media = 'all', $preprocess = TRUE) { - $path = file_create_path($filename); + function add_css($filename) { +// $path = file_create_path($filename); switch ($this->meta_location) { case 'standard': - if ($path) { - // Use CTools CSS add because it can handle temporary CSS in private - // filesystem. - ctools_include('css'); - ctools_css_add_css($filename, $type, $media, $preprocess); - } - else { - drupal_add_css($filename, $type, $media, $preprocess); - } + drupal_add_css($filename); break; case 'inline': - if ($path) { - $url = file_create_url($filename); - } - else { +// if ($path) { +// $url = file_create_url($filename); +// } +// else { $url = base_path() . $filename; - } +// } $this->prefix .= ''."\n"; break; @@ -497,7 +490,7 @@ class panels_renderer_standard { $style = panels_get_style($pane->style['style']); if (isset($style) && isset($style['render pane'])) { - $output = theme($style['render pane'], $content, $pane, $this->display, $style); + $output = theme($style['render pane'], array('content' => $content, 'pane' => $pane, 'display' => $this->display, 'style' => $style, 'settings' => $pane->style['settings'])); // This could be null if no theme function existed. if (isset($output)) { @@ -507,7 +500,7 @@ class panels_renderer_standard { } // fallback - return theme('panels_pane', $content, $pane, $this->display); + return theme('panels_pane', array('content' => $content, 'pane' => $pane, 'display' => $this->display)); } } @@ -538,6 +531,7 @@ class panels_renderer_standard { } else { $content = ctools_content_render($pane->type, $pane->subtype, $pane->configuration, array(), $this->display->args, $this->display->context); + foreach (module_implements('panels_pane_content_alter') as $module) { $function = $module . '_panels_pane_content_alter'; $function($content, $pane, $this->display->args, $this->display->context); @@ -618,6 +612,6 @@ class panels_renderer_standard { $owner_id = $this->display->owner->id; } - return theme($style['render region'], $this->display, $owner_id, $panes, $style_settings, $region_id, $style); + return theme($style['render region'], array('display' => $this->display, 'owner_id' => $owner_id, 'panes' => $panes, 'settings' => $style_settings, 'region_id' => $region_id, 'style' => $style)); } } diff --git a/plugins/display_renderers/simple.inc b/plugins/display_renderers/simple.inc index 725c28dc35d5e22d0e2d73a550da66d6f9f93c0a..a37021654bc97d005aeb4caa7b0ce1a86d9bed57 100644 --- a/plugins/display_renderers/simple.inc +++ b/plugins/display_renderers/simple.inc @@ -4,8 +4,5 @@ * already rendered, not in panes. */ $plugin = array( - 'handler' => array( - 'class' => 'panels_renderer_simple', - 'parent' => 'standard', - ), -); \ No newline at end of file + 'renderer' => 'panels_renderer_simple', +); diff --git a/plugins/display_renderers/single_pane.inc b/plugins/display_renderers/single_pane.inc deleted file mode 100644 index 67ef61dc02b39eec03e5307bc10657b8cc06e8fa..0000000000000000000000000000000000000000 --- a/plugins/display_renderers/single_pane.inc +++ /dev/null @@ -1,8 +0,0 @@ - array( - 'class' => 'panels_renderer_single_pane', - 'parent' => 'standard', - ), -); \ No newline at end of file diff --git a/plugins/display_renderers/standard.inc b/plugins/display_renderers/standard.inc index 39b235daf8136de276d25548ddf7de227f368812..2e86b31f929ccb18cd4a1ab9a4fc55b99b9988b3 100644 --- a/plugins/display_renderers/standard.inc +++ b/plugins/display_renderers/standard.inc @@ -1,7 +1,5 @@ array( - 'class' => 'panels_renderer_standard', - ), -); \ No newline at end of file + 'renderer' => 'panels_renderer_standard', +); diff --git a/plugins/export_ui/panels_layouts.inc b/plugins/export_ui/panels_layouts.inc index 0a05efe5a38353dccf24f9bd67b85d6037fbcd38..8ba766db0465d51b47c621b41f27475f1d46f0a4 100644 --- a/plugins/export_ui/panels_layouts.inc +++ b/plugins/export_ui/panels_layouts.inc @@ -6,7 +6,7 @@ $plugin = array( 'access' => 'administer panels layouts', 'menu' => array( - 'menu prefix' => 'admin/build/panels', + 'menu prefix' => 'admin/structure/panels', 'menu item' => 'layouts', 'menu title' => 'Layouts', 'menu description' => 'Add, edit or delete custom content layouts.', @@ -17,9 +17,6 @@ $plugin = array( 'title plural' => t('layouts'), 'title plural proper' => t('Layouts'), - 'handler' => array( - 'class' => 'panels_layouts_ui', - 'parent' => 'ctools_export_ui', - ), + 'class' => 'panels_layouts_ui', ); diff --git a/plugins/export_ui/panels_layouts_ui.class.php b/plugins/export_ui/panels_layouts_ui.class.php index b8f578868fa21f33bce9c482f1e17d43b0c7fc51..9b4e0e4213cc52e594a28c8619ef1810f96a9b63 100644 --- a/plugins/export_ui/panels_layouts_ui.class.php +++ b/plugins/export_ui/panels_layouts_ui.class.php @@ -12,7 +12,7 @@ class panels_layouts_ui extends ctools_export_ui { } // Change the item to a tab on the Panels page. - $this->plugin['menu']['items']['list callback']['type'] = MENU_LOCAL_TASK; + $this->plugin['menu']['items']['list callback']['type'] = MENU_LOCAL_ACTION; // Establish a base for adding plugins $base = $this->plugin['menu']['items']['add']; @@ -208,24 +208,24 @@ class panels_layouts_ui extends ctools_export_ui { $category = $item->category ? check_plain($item->category) : t('Miscellaneous'); $this->rows[$item->name] = array( 'data' => array( - array('data' => check_plain($type), 'class' => 'ctools-export-ui-type'), - array('data' => check_plain($item->name), 'class' => 'ctools-export-ui-name'), - array('data' => check_plain($item->admin_title), 'class' => 'ctools-export-ui-title'), - array('data' => $category, 'class' => 'ctools-export-ui-category'), - array('data' => theme('links', $operations), 'class' => 'ctools-export-ui-operations'), + array('data' => check_plain($type), 'class' => array('ctools-export-ui-type')), + array('data' => check_plain($item->name), 'class' => array('ctools-export-ui-name')), + array('data' => check_plain($item->admin_title), 'class' => array('ctools-export-ui-title')), + array('data' => $category, 'class' => array('ctools-export-ui-category')), + array('data' => theme('links', array('links' => $operations)), 'class' => array('ctools-export-ui-operations')), ), 'title' => check_plain($item->admin_description), - 'class' => !empty($item->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled', + 'class' => array(!empty($item->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled'), ); } function list_table_header() { return array( - array('data' => t('Type'), 'class' => 'ctools-export-ui-type'), - array('data' => t('Name'), 'class' => 'ctools-export-ui-name'), - array('data' => t('Title'), 'class' => 'ctools-export-ui-title'), - array('data' => t('Category'), 'class' => 'ctools-export-ui-category'), - array('data' => t('Operations'), 'class' => 'ctools-export-ui-operations'), + array('data' => t('Type'), 'class' => array('ctools-export-ui-type')), + array('data' => t('Name'), 'class' => array('ctools-export-ui-name')), + array('data' => t('Title'), 'class' => array('ctools-export-ui-title')), + array('data' => t('Category'), 'class' => array('ctools-export-ui-category')), + array('data' => t('Operations'), 'class' => array('ctools-export-ui-operations')), ); } } diff --git a/plugins/layouts/flexible/flexible-admin.js b/plugins/layouts/flexible/flexible-admin.js index d3c4808ba5415941bc388ffa6c10c665255ef54a..716795570992ad654f90e62335c97b93f9a2b14a 100644 --- a/plugins/layouts/flexible/flexible-admin.js +++ b/plugins/layouts/flexible/flexible-admin.js @@ -1,4 +1,5 @@ // $Id$ +(function ($) { Drupal.flexible = Drupal.flexible || {}; @@ -14,43 +15,35 @@ Drupal.flexible.fixHeight = function() { } } -Drupal.behaviors.flexibleAdmin = function(context) { - // Show/hide layout manager button - $('input#panels-flexible-toggle-layout:not(.panels-flexible-processed)', context) - .addClass('panels-flexible-processed') - .click(function() { - $('.panel-flexible-admin') - .toggleClass('panel-flexible-no-edit-layout') - .toggleClass('panel-flexible-edit-layout'); - - if ($('.panel-flexible-admin').hasClass('panel-flexible-edit-layout')) { - $(this).val(Drupal.t('Hide layout designer')); - Drupal.flexible.fixHeight(); - } - else { - $(this).val(Drupal.t('Show layout designer')); - } - return false; - }); - - // Window splitter behavior. - $('div.panels-flexible-splitter:not(.panels-splitter-processed)', context) - .addClass('panels-splitter-processed') - .each(function() { - Drupal.flexible.splitters.push(new Drupal.flexible.splitter($(this))); - }); - - // Sometimes the splitter IS the context and the above syntax won't - // catch that. - if ($(context).hasClass('panels-flexible-splitter')) { - $(context) +Drupal.behaviors.flexibleAdmin = { + attach: function(context) { + // Show/hide layout manager button + $('input#panels-flexible-toggle-layout:not(.panels-flexible-processed)', context) + .addClass('panels-flexible-processed') + .click(function() { + $('.panel-flexible-admin') + .toggleClass('panel-flexible-no-edit-layout') + .toggleClass('panel-flexible-edit-layout'); + + if ($('.panel-flexible-admin').hasClass('panel-flexible-edit-layout')) { + $(this).val(Drupal.t('Hide layout designer')); + Drupal.flexible.fixHeight(); + } + else { + $(this).val(Drupal.t('Show layout designer')); + } + return false; + }); + + // Window splitter behavior. + $('div.panels-flexible-splitter:not(.panels-splitter-processed)') .addClass('panels-splitter-processed') .each(function() { Drupal.flexible.splitters.push(new Drupal.flexible.splitter($(this))); }); - } - Drupal.flexible.fixHeight(); + Drupal.flexible.fixHeight(); + } }; Drupal.flexible.splitter = function($splitter) { @@ -337,22 +330,14 @@ Drupal.flexible.splitter = function($splitter) { .unbind("mouseup", splitterEnd); // Store the data on the server. - $.ajax({ - type: "POST", - url: Drupal.settings.flexible.resize, - data: { - 'left': splitter.left_id, - 'left_width': splitter.left_width, - 'right': splitter.right_id, - 'right_width': splitter.right_width - }, - global: true, - success: Drupal.CTools.AJAX.respond, - error: function() { - alert("An error occurred while attempting to process " + Drupal.settings.flexible.resize); - }, - dataType: 'json' - }); + Drupal.ajax['flexible-splitter-ajax'].options.data = { + 'left': splitter.left_id, + 'left_width': splitter.left_width, + 'right': splitter.right_id, + 'right_width': splitter.right_width + }; + + $('.panel-flexible-edit-layout').trigger('UpdateFlexibleSplitter'); }; this.getSizes = function() { @@ -384,26 +369,42 @@ Drupal.flexible.splitter = function($splitter) { }; -/** - * Provide an AJAX response command to allow the server to request - * height fixing. - */ -Drupal.CTools.AJAX.commands.flexible_fix_height = function() { - Drupal.flexible.fixHeight(); -}; +$(function() { + /** + * Provide an AJAX response command to allow the server to request + * height fixing. + */ + Drupal.ajax.prototype.commands.flexible_fix_height = function(ajax, command, status) { + Drupal.flexible.fixHeight(); + }; -/** - * Provide an AJAX response command to fix the first/last bits of a - * group. - */ -Drupal.CTools.AJAX.commands.flexible_fix_firstlast = function(data) { - $(data.selector + ' > div > .' + data.base) - .removeClass(data.base + '-first') - .removeClass(data.base + '-last'); - - $(data.selector + ' > div > .' + data.base + ':first') - .addClass(data.base + '-first'); - $(data.selector + ' > div > .' + data.base + ':last') - .addClass(data.base + '-last'); -}; + /** + * Provide an AJAX response command to fix the first/last bits of a + * group. + */ + Drupal.ajax.prototype.commands.flexible_fix_firstlast = function(ajax, data, status) { + $(data.selector + ' > div > .' + data.base) + .removeClass(data.base + '-first') + .removeClass(data.base + '-last'); + + $(data.selector + ' > div > .' + data.base + ':first') + .addClass(data.base + '-first'); + $(data.selector + ' > div > .' + data.base + ':last') + .addClass(data.base + '-last'); + }; + + // Create a generic ajax callback for use with the splitters which + // background AJAX to store their data. + var element_settings = { + url: Drupal.settings.flexible.resize, + event: 'UpdateFlexibleSplitter', + keypress: false, + // No throbber at all. + progress: { 'type': 'none' } + }; + + Drupal.ajax['flexible-splitter-ajax'] = new Drupal.ajax('flexible-splitter-ajax', $('.panel-flexible-admin').get(0), element_settings); + +}); +})(jQuery); diff --git a/plugins/layouts/flexible/flexible.inc b/plugins/layouts/flexible/flexible.inc index 9fb53cbe09ef54d8be3251db5c636f93d6012628..b061be9f538418834062a63ebfcb1369b3f4d7de 100644 --- a/plugins/layouts/flexible/flexible.inc +++ b/plugins/layouts/flexible/flexible.inc @@ -16,7 +16,7 @@ $plugin = array( 'settings form' => 'panels_flexible_settings_form', 'settings submit' => 'panels_flexible_settings_submit', 'settings validate' => 'panels_flexible_settings_validate', - 'panels function' => 'panels_flexible_panels', + 'regions function' => 'panels_flexible_panels', 'hook menu' => 'panels_flexible_menu', // Reuisable layout Builder specific directives @@ -270,11 +270,11 @@ function panels_flexible_panels($display, $settings, $layout) { * * @todo Convert the functions to methods and make this properly OO. */ -function panels_flexible_create_renderer($admin, $id, $content, $settings, &$display, $layout, $handler) { +function panels_flexible_create_renderer($admin, $css_id, $content, $settings, &$display, $layout, $handler) { $renderer = new stdClass; $renderer->settings = $settings; $renderer->content = $content; - $renderer->css_id = $id; + $renderer->css_id = $css_id; $renderer->did = &$display->did; if ($admin) { // always scale in admin mode. @@ -283,7 +283,7 @@ function panels_flexible_create_renderer($admin, $id, $content, $settings, &$dis else { $renderer->scale_base = !empty($settings['items']['canvas']['no_scale']) ? 100.0 : 99.0; } - $renderer->id_str = $id ? 'id="' . $id . '"' : ''; + $renderer->id_str = $css_id ? 'id="' . $css_id . '"' : ''; $renderer->admin = $admin; $renderer->handler = $handler; @@ -340,10 +340,17 @@ function panels_flexible_create_renderer($admin, $id, $content, $settings, &$dis /** * Draw the flexible layout. */ -function theme_panels_flexible($id, $content, $settings, $display, $layout, $handler) { +function theme_panels_flexible($vars) { + $css_id = $vars['css_id']; + $content = $vars['content']; + $settings = $vars['settings']; + $display = $vars['display']; + $layout = $vars['layout']; + $handler = $vars['renderer']; + panels_flexible_convert_settings($settings, $layout); - $renderer = panels_flexible_create_renderer(FALSE, $id, $content, $settings, $display, $layout, $handler); + $renderer = panels_flexible_create_renderer(FALSE, $css_id, $content, $settings, $display, $layout, $handler); // CSS must be generated because it reports back left/middle/right // positions. @@ -362,7 +369,7 @@ function theme_panels_flexible($id, $content, $settings, $display, $layout, $han $handler->add_css($filename, 'module', 'all', FALSE); } else { - ctools_css_add_css($filename, 'module', 'all', FALSE); + drupal_add_css($filename); } } else { @@ -370,14 +377,14 @@ function theme_panels_flexible($id, $content, $settings, $display, $layout, $han // because the display does not truly exist, so we'll stick it in the // head tag. We also do this if we've been told we're in the layout // editor so that it always gets fresh CSS. - drupal_set_html_head("\n"); + drupal_add_css($css, 'inline'); } // Also store the CSS on the display in case the live preview or something // needs it $display->add_css = $css; - $output = "
base['canvas'] . " clear-block\" $renderer->id_str>\n"; + $output = "
base['canvas'] . " clearfix\" $renderer->id_str>\n"; $output .= "
base['canvas'] . "-inside\">\n"; $output .= panels_flexible_render_items($renderer, $settings['items']['canvas']['children'], $renderer->base['canvas']); @@ -391,33 +398,40 @@ function theme_panels_flexible($id, $content, $settings, $display, $layout, $han /** * Draw the flexible layout. */ -function theme_panels_flexible_admin($id, $content, $settings, $display, $layout, $handler) { +function theme_panels_flexible_admin($vars) { + $css_id = $vars['css_id']; + $content = $vars['content']; + $settings = $vars['settings']; + $display = $vars['display']; + $layout = $vars['layout']; + $handler = $vars['renderer']; + // We never draw stored flexible layouts in admin mode; they must be edited // from the stored layout UI at that point. if (!empty($layout['layout'])) { - return theme_panels_flexible($id, $content, $settings, $display, $layout, $handler); + return theme_panels_flexible(array('css_id' => $css_id, 'content' => $content, 'settings' => $settings, 'display' => $display, 'layout' => $layout, 'renderer' => $handler)); } panels_flexible_convert_settings($settings, $layout); - $renderer = panels_flexible_create_renderer(TRUE, $id, $content, $settings, $display, $layout, $handler); + $renderer = panels_flexible_create_renderer(TRUE, $css_id, $content, $settings, $display, $layout, $handler); $css = panels_flexible_render_css($renderer); // For the administrative view, add CSS directly to head. - drupal_set_html_head("\n"); + drupal_add_css($css, 'inline'); if (empty($display->editing_layout)) { - $output = ''; if (user_access('administer panels layouts')) { $output .= ''; - $output .= ''; } - $output .= "
base['canvas'] . " clear-block panel-flexible-admin panel-flexible-no-edit-layout\" $renderer->id_str>\n"; + $output .= "
base['canvas'] . " clearfix panel-flexible-admin panel-flexible-no-edit-layout\" $renderer->id_str>\n"; } else { - $output = "
base['canvas'] . " clear-block panel-flexible-admin panel-flexible-edit-layout\" $renderer->id_str>\n"; + $output = "
base['canvas'] . " clearfix panel-flexible-admin panel-flexible-edit-layout\" $renderer->id_str>\n"; } $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/threecol_25_50_25/threecol_25_50_25.inc b/plugins/layouts/threecol_25_50_25/threecol_25_50_25.inc index 2d166fdd2e7975b2479d0127da69e2dc64b8601f..6796cb3224dc935e76a975760c44be2c96712bf1 100644 --- a/plugins/layouts/threecol_25_50_25/threecol_25_50_25.inc +++ b/plugins/layouts/threecol_25_50_25/threecol_25_50_25.inc @@ -12,7 +12,7 @@ $plugin = array( 'theme' => 'panels_threecol_25_50_25', 'theme arguments' => array('id', 'content'), 'css' => 'threecol_25_50_25.css', - 'panels' => array( + 'regions' => array( 'left' => t('Left side'), 'middle' => t('Middle column'), 'right' => t('Right side') diff --git a/plugins/layouts/threecol_25_50_25_stacked/panels-threecol-25-50-25-stacked.tpl.php b/plugins/layouts/threecol_25_50_25_stacked/panels-threecol-25-50-25-stacked.tpl.php index dc106ce9d9062ebc00f1901d5aadff7ed1a7f485..c39f152402804a824ef69ffee4cb6427aca23919 100644 --- a/plugins/layouts/threecol_25_50_25_stacked/panels-threecol-25-50-25-stacked.tpl.php +++ b/plugins/layouts/threecol_25_50_25_stacked/panels-threecol-25-50-25-stacked.tpl.php @@ -18,11 +18,11 @@ * - $content['bottom']: Content in the bottom row. */ ?> -
> +
>
-
+
@@ -42,6 +42,6 @@
-
+
diff --git a/plugins/layouts/threecol_25_50_25_stacked/threecol_25_50_25_stacked.inc b/plugins/layouts/threecol_25_50_25_stacked/threecol_25_50_25_stacked.inc index 8e24eb72c5aecb21f70b05aee578d7371d6500f1..bef92a0f0a836ca971c92a58a54af38bcdc55ad8 100644 --- a/plugins/layouts/threecol_25_50_25_stacked/threecol_25_50_25_stacked.inc +++ b/plugins/layouts/threecol_25_50_25_stacked/threecol_25_50_25_stacked.inc @@ -8,7 +8,7 @@ $plugin = array( 'icon' => 'threecol_25_50_25_stacked.png', 'theme' => 'panels_threecol_25_50_25_stacked', 'css' => 'threecol_25_50_25_stacked.css', - 'panels' => array( + 'regions' => array( 'top' => t('Top'), 'left' => t('Left side'), 'middle' => t('Middle column'), diff --git a/plugins/layouts/threecol_33_34_33/panels-threecol-33-34-33.tpl.php b/plugins/layouts/threecol_33_34_33/panels-threecol-33-34-33.tpl.php index 643e6d237265e7ca801f04d1e747c48647693bfb..9a5d953f2191df793f07a303f54cee8e84684567 100644 --- a/plugins/layouts/threecol_33_34_33/panels-threecol-33-34-33.tpl.php +++ b/plugins/layouts/threecol_33_34_33/panels-threecol-33-34-33.tpl.php @@ -17,7 +17,7 @@ */ ?> -
> +
>
diff --git a/plugins/layouts/threecol_33_34_33/threecol_33_34_33.inc b/plugins/layouts/threecol_33_34_33/threecol_33_34_33.inc index b78f20a823452652d67da2acc87bd09840203042..e6dd4fb86e460be05a85549db5b9db2ac6d901f2 100644 --- a/plugins/layouts/threecol_33_34_33/threecol_33_34_33.inc +++ b/plugins/layouts/threecol_33_34_33/threecol_33_34_33.inc @@ -8,7 +8,7 @@ $plugin = array( 'icon' => 'threecol_33_34_33.png', 'theme' => 'panels_threecol_33_34_33', 'css' => 'threecol_33_34_33.css', - 'panels' => array( + 'regions' => array( 'left' => t('Left side'), 'middle' => t('Middle column'), 'right' => t('Right side') diff --git a/plugins/layouts/threecol_33_34_33_stacked/panels-threecol-33-34-33-stacked.tpl.php b/plugins/layouts/threecol_33_34_33_stacked/panels-threecol-33-34-33-stacked.tpl.php index bc9ee4f83df92b4118d90b441f0b9cf30f4b6bae..7593e76eeb83c64b596b7fbbbe932efca72e0c59 100644 --- a/plugins/layouts/threecol_33_34_33_stacked/panels-threecol-33-34-33-stacked.tpl.php +++ b/plugins/layouts/threecol_33_34_33_stacked/panels-threecol-33-34-33-stacked.tpl.php @@ -18,11 +18,11 @@ * - $content['bottom']: Content in the bottom row. */ ?> -
> +
>
-
+
@@ -42,6 +42,6 @@
-
+
diff --git a/plugins/layouts/threecol_33_34_33_stacked/threecol_33_34_33_stacked.inc b/plugins/layouts/threecol_33_34_33_stacked/threecol_33_34_33_stacked.inc index 5182b0d7d48d5a7239dc9c7131a57443bf196710..104251091aa3666725056bb7b0405ce868541b9e 100644 --- a/plugins/layouts/threecol_33_34_33_stacked/threecol_33_34_33_stacked.inc +++ b/plugins/layouts/threecol_33_34_33_stacked/threecol_33_34_33_stacked.inc @@ -11,7 +11,7 @@ function panels_threecol_33_34_33_stacked_panels_layouts() { 'icon' => 'threecol_33_34_33_stacked.png', 'theme' => 'panels_threecol_33_34_33_stacked', 'css' => 'threecol_33_34_33_stacked.css', - 'panels' => array( + 'regions' => array( 'top' => t('Top'), 'left' => t('Left side'), 'middle' => t('Middle column'), diff --git a/plugins/layouts/twocol/panels-twocol.tpl.php b/plugins/layouts/twocol/panels-twocol.tpl.php index 60b95e0d2b8f083e0066ce53db69a2396d9b7da7..5b25afb915326f3bd13cd8e7fc2169c44cb4cf70 100644 --- a/plugins/layouts/twocol/panels-twocol.tpl.php +++ b/plugins/layouts/twocol/panels-twocol.tpl.php @@ -15,7 +15,7 @@ * - $content['right']: Content in the right column. */ ?> -
> +
>
diff --git a/plugins/layouts/twocol/twocol.inc b/plugins/layouts/twocol/twocol.inc index 45735cd63e2a0705ad279fdce6935aa8e046487d..67016089f1c96858b4a8fb3503ae67e3d4117477 100644 --- a/plugins/layouts/twocol/twocol.inc +++ b/plugins/layouts/twocol/twocol.inc @@ -8,7 +8,7 @@ $plugin = array( 'icon' => 'twocol.png', 'theme' => 'panels_twocol', 'css' => 'twocol.css', - 'panels' => array( + 'regions' => array( 'left' => t('Left side'), 'right' => t('Right side') ), diff --git a/plugins/layouts/twocol_bricks/panels-twocol-bricks.tpl.php b/plugins/layouts/twocol_bricks/panels-twocol-bricks.tpl.php index 676a8e0d3a63205d1c123778d077ae5ccd58250a..5079048450e7942366f9b635b403ed5028141a49 100644 --- a/plugins/layouts/twocol_bricks/panels-twocol-bricks.tpl.php +++ b/plugins/layouts/twocol_bricks/panels-twocol-bricks.tpl.php @@ -23,7 +23,7 @@ * - $content['bottom']: Content in the bottom row. */ ?> -
> +
>
diff --git a/plugins/layouts/twocol_bricks/twocol_bricks.inc b/plugins/layouts/twocol_bricks/twocol_bricks.inc index b42b9cf9a700cddc3e7348bd6fe4f09b00120d27..7a2b64a4699939519d272ddfdd9b175dd066b104 100644 --- a/plugins/layouts/twocol_bricks/twocol_bricks.inc +++ b/plugins/layouts/twocol_bricks/twocol_bricks.inc @@ -13,7 +13,7 @@ $plugin = array( 'icon' => 'twocol_bricks.png', 'theme' => 'panels_twocol_bricks', 'css' => 'twocol_bricks.css', - 'panels' => array( + 'regions' => array( 'top' => t('Top'), 'left_above' => t('Left above'), 'right_above' => t('Right above'), diff --git a/plugins/layouts/twocol_stacked/panels-twocol-stacked.tpl.php b/plugins/layouts/twocol_stacked/panels-twocol-stacked.tpl.php index 7e30ca8d71b5177375ff7bde741b481297b88e99..2f75aa0af8c7e1e03d1335d31ff66a4a582f31b6 100644 --- a/plugins/layouts/twocol_stacked/panels-twocol-stacked.tpl.php +++ b/plugins/layouts/twocol_stacked/panels-twocol-stacked.tpl.php @@ -17,11 +17,11 @@ * - $content['bottom']: Content in the bottom row. */ ?> -
> +
>
-
+
@@ -36,6 +36,6 @@
-
+
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 @@ -
+