Common subdirectories: /root/panelizer-6.x/includes and panelizer/includes diff -up /root/panelizer-6.x/panelizer.info panelizer/panelizer.info --- /root/panelizer-6.x/panelizer.info 2011-02-26 07:09:41.000000000 -0500 +++ panelizer/panelizer.info 2011-05-17 13:45:10.000000000 -0400 @@ -5,11 +5,18 @@ package = "Panels" dependencies[] = panels dependencies[] = ctools dependencies[] = page_manager -core = 6.x +core = 7.x + +files[] = panelizer.install +files[] = panelizer.module +files[] = includes/admin.inc +files[] = includes/common.inc +files[] = includes/node.inc +files[] = includes/panelizer.pages_default.inc +files[] = task_handlers/panelizer_node.inc ; Information added by drupal.org packaging script on 2011-02-26 -version = "6.x-1.x-dev" -core = "6.x" +version = "7.x-1.x-dev" project = "panelizer" datestamp = "1298722181" diff -up /root/panelizer-6.x/panelizer.install panelizer/panelizer.install --- /root/panelizer-6.x/panelizer.install 2011-02-26 02:40:37.000000000 -0500 +++ panelizer/panelizer.install 2011-05-17 13:39:55.000000000 -0400 @@ -1,12 +1,15 @@ 'text', 'size' => 'big', 'description' => 'Any CSS the author provided for the panel.', - 'default' => '', ), 'pipeline' => array( 'type' => 'varchar', @@ -99,7 +101,7 @@ function panelizer_schema_1() { 'minimum_version' => 1, 'current_version' => 1, ), -// 'create callback' => 'panelizer_export_create_callback', + // 'create callback' => 'panelizer_export_create_callback', 'save callback' => 'panelizer_export_save_callback', 'export callback' => 'panelizer_export_export_callback', 'delete callback' => 'panelizer_export_delete_callback', @@ -142,17 +144,27 @@ function panelizer_schema_1() { } /** - * Implementation of hook_install(). + * Implements hook_install(). */ function panelizer_install() { - db_query("UPDATE {system} SET weight = 21 WHERE name = 'panelizer'"); - drupal_install_schema('panelizer'); + // TODO Please review the conversion of this statement to the D7 database API syntax. + /* db_query("UPDATE {system} SET weight = 21 WHERE name = 'panelizer'") */ + // Set the module weight so it can execute after Panels. + db_update('system') + ->fields(array( + 'weight' => 21, + )) + ->condition('name', 'panelizer') + ->execute(); } /** - * Implementation of hook_uninstall(). + * Implements hook_uninstall(). */ function panelizer_uninstall() { - drupal_uninstall_schema('panelizer'); - db_query("DELETE FROM {variable} WHERE name like 'panelizer%%'"); + // TODO Please review the conversion of this statement to the D7 database API syntax. + /* db_query("DELETE FROM {variable} WHERE name like 'panelizer%%'") */ + // db_delete('variable') + // ->condition("name LIKE 'panelizer%%'", '') + // ->execute(); } diff -up /root/panelizer-6.x/panelizer.module panelizer/panelizer.module --- /root/panelizer-6.x/panelizer.module 2011-02-26 02:40:37.000000000 -0500 +++ panelizer/panelizer.module 2011-05-18 09:30:24.000000000 -0400 @@ -1,7 +1,4 @@ array( + 'title' => t('administer panelizer'), + 'description' => t('TODO Add a description for \'administer panelizer\''), + ), + ); } /** - * Implements hook_theme() + * Implements hook_theme(). */ function panelizer_theme() { $items = array(); $items['panelizer_node_settings_page_form'] = array( - 'arguments' => array('form' => NULL), + 'render element' => 'form', 'file' => 'includes/admin.inc', ); @@ -31,7 +33,7 @@ function panelizer_theme() { } /** - * Implementation of hook_menu(). + * Implements hook_menu(). */ function panelizer_menu() { // Safety: go away if CTools is not at an appropriate version. @@ -45,7 +47,7 @@ function panelizer_menu() { 'file' => 'includes/admin.inc', ); - $items['admin/settings/panelizer'] = array( + $items['admin/config/content/panelizer'] = array( 'title' => 'Panelizer', 'description' => 'Configure panelizer availability and defaults', 'page callback' => 'drupal_get_form', @@ -53,7 +55,7 @@ function panelizer_menu() { 'type' => MENU_NORMAL_ITEM, ) + $settings_base; - $items['admin/settings/panelizer/%/%'] = array( + $items['admin/config/content/panelizer/%/%'] = array( 'title callback' => 'panelizer_default_title_callback', 'title arguments' => array(3, 4), 'page callback' => 'panelizer_allowed_content_page', @@ -61,7 +63,7 @@ function panelizer_menu() { 'type' => MENU_CALLBACK, ) + $settings_base; - $items['admin/settings/panelizer/%/%/allowed'] = array( + $items['admin/config/content/panelizer/%/%/allowed'] = array( 'title' => 'Available content', 'page callback' => 'panelizer_allowed_content_page', 'page arguments' => array(3, 4), @@ -69,7 +71,7 @@ function panelizer_menu() { 'weight' => -10, ) + $settings_base; - $items['admin/settings/panelizer/%/%/list'] = array( + $items['admin/config/content/panelizer/%/%/list'] = array( 'title' => 'List defaults', 'access callback' => 'panelizer_has_choice_callback', 'access arguments' => array(3, 4, ''), @@ -87,26 +89,26 @@ function panelizer_menu() { 'file' => 'includes/admin.inc', ); - $items['admin/settings/panelizer/%/%/settings'] = array( + $items['admin/config/content/panelizer/%/%/settings'] = array( 'title' => 'Settings', 'page callback' => 'panelizer_default_settings_page', 'weight' => -5, ) + $tabs_base; - $items['admin/settings/panelizer/%/%/context'] = array( + $items['admin/config/content/panelizer/%/%/context'] = array( 'title' => 'Contexts', 'page callback' => 'panelizer_default_context_page', 'weight' => -4, ) + $tabs_base; - $items['admin/settings/panelizer/%/%/layout'] = array( + $items['admin/config/content/panelizer/%/%/layout'] = array( 'title' => 'Layout', 'page callback' => 'panelizer_default_layout_page', 'weight' => -3, ) + $tabs_base; - $items['admin/settings/panelizer/%/%/content'] = array( + $items['admin/config/content/panelizer/%/%/content'] = array( 'title' => 'Content', 'page callback' => 'panelizer_default_content_page', 'weight' => -2, @@ -120,33 +122,33 @@ function panelizer_menu() { 'file' => 'includes/admin.inc', ); - $items['admin/settings/panelizer/%/%/%'] = array( + $items['admin/config/content/panelizer/%/%/%'] = array( 'title' => 'Settings', 'page callback' => 'panelizer_default_settings_page', 'title callback' => 'panelizer_default_name_title_callback', 'type' => MENU_CALLBACK, ) + $subtabs_base; - $items['admin/settings/panelizer/%/%/%/settings'] = array( + $items['admin/config/content/panelizer/%/%/%/settings'] = array( 'title' => 'Settings', 'page callback' => 'panelizer_default_settings_page', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -5, ) + $subtabs_base; - $items['admin/settings/panelizer/%/%/%/context'] = array( + $items['admin/config/content/panelizer/%/%/%/context'] = array( 'title' => 'Contexts', 'page callback' => 'panelizer_default_context_page', 'weight' => -4, ) + $subtabs_base; - $items['admin/settings/panelizer/%/%/%/layout'] = array( + $items['admin/config/content/panelizer/%/%/%/layout'] = array( 'title' => 'Layout', 'page callback' => 'panelizer_default_layout_page', 'weight' => -3, ) + $subtabs_base; - $items['admin/settings/panelizer/%/%/%/content'] = array( + $items['admin/config/content/panelizer/%/%/%/content'] = array( 'title' => 'Content', 'page callback' => 'panelizer_default_content_page', 'weight' => -2, @@ -225,7 +227,7 @@ function panelizer_edit_node_callback($n function panelizer_default_title_callback($type, $key) { switch ($type) { case 'node': - $name = node_get_types('name', $key); + $name = node_type_get_name($key); return check_plain($name); case 'user': } @@ -267,8 +269,48 @@ function panelizer_has_no_choice_callbac // --------------------------------------------------------------------------- // Node hooks -// @todo -- need a nodeapi hook for insert/update so that node_save() can work -// as expected if panelizer settings are attached to the node. +function panelizer_node_view($node, $view_mode, $lang) { + + static $rendering = array(); + + // Prevent loops if someone foolishly puts the node inside itself: + if (!empty($rendering[$node->nid])) { + return $node; + } + + $rendering[$node->nid] = TRUE; + ctools_include('plugins', 'panels'); + if ($view_mode == 'teaser') { + // Because our teasier is never the same as our content, *always* provide + // the read more flag. + $node->readmore = TRUE; + } + else { + ctools_include('node', 'panelizer'); + ctools_include('plugins', 'panels'); + ctools_include('context'); + + $panelizer = panelizer_load_node_panelizer($node); + + if (!empty($panelizer)) { + if ($panelizer->no_blocks) { + ctools_set_no_blocks(FALSE); + } + $display = panelizer_load_display($panelizer); + $display->css_id = $panelizer->css_id; + $display->context = panelizer_get_contexts($panelizer, $node); + $renderer = panels_get_renderer($panelizer->pipeline, $display); + $node->content['body'] = array( + '#markup' => panels_render_display($display, $renderer), + '#weight' => 0, + ); + } + } + + unset($rendering[$node->nid]); + return $node; + +} // --------------------------------------------------------------------------- // Panelizer object access routines @@ -342,7 +384,7 @@ function panelizer_load_default_by_name( * to them. This fetches the display, if there is one. */ function panelizer_load_default($type, $key, $name, $default_anyway = FALSE) { - $load_name = $type . ':' . $key. ':' . $name; + $load_name = $type . ':' . $key . ':' . $name; return _panelizer_load_default($type, $key, $name, $load_name, $default_anyway); } @@ -460,7 +502,11 @@ function panelizer_export_delete_callbac panels_delete_display($object->did); } - db_query("DELETE FROM {panelizer_defaults} WHERE name = '%s'", $object->name); + // TODO Please review the conversion of this statement to the D7 database API syntax. + /* db_query("DELETE FROM {panelizer_defaults} WHERE name = '%s'", $object->name) */ + db_delete('panelizer_defaults') + ->condition('name', $object->name) + ->execute(); } // --------------------------------------------------------------------------- @@ -541,7 +587,7 @@ function panelizer_context_cache_clear($ function panelizer_panels_cache_get($argument) { ctools_include('object-cache'); list($type, $key) = explode(':', $argument, 2); - $cache = ctools_object_cache_get('panelizer_display_cache', $type . ':' .$key); + $cache = ctools_object_cache_get('panelizer_display_cache', $type . ':' . $key); if (!empty($cache)) { $cache->cached = TRUE; switch ($type) { @@ -594,7 +640,7 @@ function panelizer_panels_cache_get($arg function panelizer_panels_cache_set($argument, $cache) { list($type, $key) = explode(':', $argument, 2); ctools_include('object-cache'); - ctools_object_cache_set('panelizer_display_cache', $type . ':' .$key, $cache); + ctools_object_cache_set('panelizer_display_cache', $type . ':' . $key, $cache); } /** @@ -603,7 +649,7 @@ function panelizer_panels_cache_set($arg function panelizer_panels_cache_clear($argument, $cache) { list($type, $key) = explode(':', $argument, 2); ctools_include('object-cache'); - ctools_object_cache_clear('panelizer_display_cache', $type . ':' .$key); + ctools_object_cache_clear('panelizer_display_cache', $type . ':' . $key); } /** @@ -663,7 +709,7 @@ function panelizer_get_contexts($paneliz // Contrib module hooks to provide needed functionality. /** - * Implementation of hook_ctools_plugin_directory() to let the system know + * Implements hook_ctools_plugin_directory() to let the system know(). * where our task_handler plugins are. */ function panelizer_ctools_plugin_directory($owner, $plugin_type) { @@ -673,7 +719,7 @@ function panelizer_ctools_plugin_directo } /** - * Implementation of hook_ctools_plugin_api(). + * Implements hook_ctools_plugin_api(). */ function panelizer_ctools_plugin_api($module, $api) { if ($module == 'page_manager' && $api == 'pages_default') { @@ -685,7 +731,7 @@ function panelizer_ctools_plugin_api($mo } /** - * Implementation of hook_export_node_alter() + * Implements hook_export_node_alter(). * * Integrate with export.module for saving panel_nodes into code. */ @@ -694,7 +740,7 @@ function panelizer_export_node_alter(&$n } /** - * Implementation of hook_panelizer_defaults_alter + * Implements hook_panelizer_defaults_alter(). * * Remove the panels node because there is no point to panelizing it. */ Common subdirectories: /root/panelizer-6.x/plugins and panelizer/plugins diff -up /root/panelizer-6.x/README.txt panelizer/README.txt --- /root/panelizer-6.x/README.txt 2011-02-26 02:40:37.000000000 -0500 +++ panelizer/README.txt 2011-05-17 13:39:18.000000000 -0400 @@ -1,26 +1,32 @@ -About +ABOUT -Panelizer allows you to treat any node type as a panel node. You can provide default panels, per node type, and control both the available content and available layouts, also per node type. +Panelizer allows you to treat any node type as a panel node. You can provide +default panels, per node type, and control both the available content and +available layouts, also per node type. -Installing +INSTALLING -Install this through the normal Drupal method of putting the module in sites/all/modules and going to admin/build/modules to activate it. +Install this through the normal Drupal method of putting the module in +sites/all/modules and going to admin/build/modules to activate it. It requires Panels and Page Manager. -Initial configuration +INITIAL CONFIGURATION -Visit administer >> settings >> panelizer to enable the module for the node types you need. +Visit administer >> settings >> panelizer to enable the module for the node +types you need. Ensure that the node template system page is enabled. API @todo - drupal_alter('panelizer_default_types', $types, 'node'); + drupal_alter('panelizer_default_types', $types, $context1); Future functionality - Allow panels for different build modes -- this is tricky - - Fully implement the ability to choose from different defaults and restrict custom panel per node + - Fully implement the ability to choose from different defaults and restrict + custom panel per node - Implement user panelizer - - Implement panel subtabs. i.e, allow node/27/arbitrarylink to be a subtab of a node, using panelizer. + - Implement panel subtabs. i.e, allow node/27/arbitrarylink to be a subtab + of a node, using panelizer.