A bunch of clustered fixes, mostly notice fixes but also fixes for contexts and ...
authorEarl Miles
Wed, 8 Oct 2008 20:39:30 +0000 (20:39 +0000)
committerEarl Miles
Wed, 8 Oct 2008 20:39:30 +0000 (20:39 +0000)
content_types/node_content.inc
includes/display-render.inc
panels_page/panels_page.admin.inc
panels_page/panels_page.read.inc
panels_page/panels_page.render.inc

index cfb1696..248293a 100644 (file)
@@ -61,7 +61,7 @@ function panels_content_node_content($subtype, $conf, $panel_args, $context) {
 
     $block->subject = $node->title;
 
-    unset($node->title);
+//    unset($node->title);
     $block->content = panels_admin_node_content($node, $conf);
   }
 
@@ -135,6 +135,11 @@ function panels_admin_edit_node_content($id, $parents, $conf = array()) {
       'links' => TRUE,
       'page' => TRUE,
       'no_extras' => TRUE,
+      'override_title' => FALSE,
+      'override_title_text' => '',
+      'teaser' => TRUE,
+      'identifier' => '',
+      'link' => TRUE,
     );
   }
 
@@ -198,7 +203,7 @@ function panels_admin_edit_node_content($id, $parents, $conf = array()) {
   return $form;
 }
 
-function panels_admin_title_node_content($conf, $context) {
+function panels_admin_title_node_content($subtype, $conf, $context) {
   return t('"@s" content', array('@s' => $context->identifier));
 }
 
index df9cae6..a8dbe51 100644 (file)
@@ -154,6 +154,15 @@ function panels_render_panes($display) {
     $content[$panel_name] = panels_render_panel($display, $panel_name, $panel);
   }
 
+  // Prevent notices by making sure that all panels at least have an entry:
+  $layout = panels_get_layout($display->layout);
+  $panels = panels_get_panels($layout, $display);
+  foreach ($panels as $id => $panel) {
+    if (!isset($content[$id])) {
+      $content[$id] = NULL;
+    }
+  }
+
   return $content;
 }
 
@@ -207,13 +216,8 @@ function panels_render_pane_content(&$display, &$pane) {
         $url = $content->title_link;
       }
       // set defaults so we don't bring up notices
-      $url += array('href' => '', 'attributes' => NULL, 'query' => NULL, 'fragment' => NULL, 'absolute' => NULL);
-      $content->title = l($content->title,
-        $url['href'],
-        $url['attributes'],
-        $url['query'],
-        $url['fragment'],
-        $url['absolute'], TRUE);
+      $url += array('href' => '', 'attributes' => NULL, 'query' => NULL, 'fragment' => NULL, 'absolute' => NULL, 'html' => TRUE);
+      $content->title = l($content->title, $url['href'], $url);
     }
   }
   return $content;
@@ -233,7 +237,7 @@ function panels_render_pane($content, $pane, $display) {
   if (!empty($pane->configuration['style'])) {
     $style = panels_get_style($pane->configuration['style']);
 
-    if (isset($style)) {
+    if (isset($style) && isset($style['render pane'])) {
       $output = theme($style['render pane'], $content, $pane, $display);
 
       // This could be null if no theme function existed.
index 539097e..5a4fb67 100644 (file)
@@ -66,7 +66,10 @@ function panels_page_list_page() {
     // this is safe as it's always programmatic
     $item[] = $panel_page->type;
 
-    if (empty($panel_page->display)) {
+    if ($panel_page->type == t('Default')) {
+      $panel_page->display = &$panel_page->primary;
+    }
+    else {
       $panel_page->display = $displays[$panel_page->did];
     }
     $item[] = check_plain($layouts[$panel_page->display->layout]['title']);
@@ -153,10 +156,11 @@ function panels_page_disable_page($name = NULL) {
  */
 function panels_page_delete_confirm(&$form_state, $panel_page) {
   $form_state['panel_page'] = $panel_page;
+  $form = array();
   if ($panel_page->type != t('Overridden')) {
     return confirm_form($form,
       t('Are you sure you want to delete "@title"?', array('@title' => panels_page_get_title($panel_page))),
-      $_GET['destination'] ? $_GET['destination'] : 'admin/panels/panel-page',
+      isset($_GET['destination']) ? $_GET['destination'] : 'admin/panels/panel-page',
       t('This action cannot be undone.'),
       t('Delete'), t('Cancel')
     );
@@ -164,7 +168,7 @@ function panels_page_delete_confirm(&$form_state, $panel_page) {
   else {
     return confirm_form($form,
       t('Are you sure you want to revert "@title" to its default configuration?', array('@title' => panels_page_get_title($panel_page))),
-      $_GET['destination'] ? $_GET['destination'] : 'admin/panels/panel-page',
+      isset($_GET['destination']) ? $_GET['destination'] : 'admin/panels/panel-page',
       t('This action cannot be undone.'),
       t('Revert'), t('Cancel')
     );
@@ -641,7 +645,6 @@ function panels_page_context_form(&$form_state, $panel_page, $next) {
   $form_state['next'] = $next;
 
   drupal_add_css(panels_get_path('css/panels_admin.css'));
-  $layout = panels_get_layout($panel_page->display->layout);
 
   $form['right'] = array(
     '#prefix' => '<div class="right-container">',
index 97821eb..73002ad 100644 (file)
@@ -54,6 +54,9 @@ function panels_page_load_all($names = array(), $page_size = 0) {
     }
     else {
       $page->type = t('Default');
+      // move the 'display' to the new 'primary' location.
+      $page->primary = $page->display;
+      unset($page->display);
       $pages[$page->name] = $page;
     }
   }
@@ -77,17 +80,24 @@ function panels_page_load($id, $load_display = FALSE) {
   $where = is_numeric($id) ? 'pid = %d' : "name = '%s'";
   $page = db_fetch_object(db_query("SELECT * FROM {panels_page} WHERE $where", $id));
 
+  $defaults = panels_page_default_panels();
   if (!$page) {
-    $defaults = panels_page_default_panels();
     if (isset($defaults[$id])) {
       // Default panel pages will always only be identified by name, so no need
       // for the both-ids-point-to-same-object trick.
       $page = $defaults[$id];
+      $page->type = t('Default');
+      // move the 'display' to the new 'primary' location.
+      $page->primary = $page->display;
+      unset($page->display);
       panels_page_loaded_cache($id, $page);
       return $page;
     }
     return;
   }
+  else {
+    $page->type = isset($defaults[$id]) ? t('Overridden') : t('Local');
+  }
 
   $page->access           = ($page->access ? explode(', ', $page->access) : array());
   $page->arguments        = (!empty($page->arguments)) ? unserialize($page->arguments) : array();
@@ -192,7 +202,9 @@ function panels_page_fetch_primary_display(&$panel_page) {
   // Commented out is a more precise way of telling, but it's probably moot.
   // if (empty($panel_page->primary) || !is_a($panel_page->primary, 'panels_display')) {
   if (empty($panel_page->primary) || !is_object($panel_page->primary)) {
-    $panel_page->primary = panels_load_display($panel_page->did);
+    if ($panel_page->type != t('Default')) {
+      $panel_page->primary = panels_load_display($panel_page->did);
+    }
   }
   $panel_page->display = &$panel_page->primary;
   $panel_page->current = 'primary';
index a2ce2e3..b9986e2 100644 (file)
@@ -32,8 +32,10 @@ function panels_page_prepare_panels_render(&$load, &$panel_page, $args) {
 
 function _panels_page_prepare_panels_render(&$panel_page) {
   _panels_page_check_switchers($panel_page);
-  // $panel_page->context = panels_context_load_contexts($panel_page, FALSE, $panel_page->contexts);
-  // $panel_page->context = panels_context_load_contexts($panel_page);
+  $panel_page->context = panels_context_load_contexts($panel_page, FALSE, $panel_page->context);
+
+  // The below does not make sense.
+//  $panel_page->context = panels_context_load_contexts($panel_page);
   // If we're wrapping FAPI with with panel, this function gets the data.
   $panel_page->form = panels_context_get_form($panel_page->context);
   // Get any keywords (for title substitution in panes)