$files) { foreach ($files as $file => $preprocess) { $url = base_path() . $file; if (file_exists($file)) { // Refresh Facebook's cache anytime file changes. $url .= '?v=' . filemtime($file); } // preprocess ignored if ($type == 'module') { $module_css .= '\n"; } else if ($type == 'theme') { $theme_css .= '\n"; } } } $vars['styles'] = $module_css . $theme_css; // Include only Facebook aware javascript. $vars['fbjs'] = drupal_get_js('fbml'); // Enforce that only admins see admin block. This can be done (more // cleanly?) elsewhere. But we're doing it here to make sure. if (!user_access('access administration pages')) $vars['admin'] =''; else if ($vars['admin']) { $vars['admin'] = "
\n".$vars['admin']. "\n
"; } // Change 'Home' in breadcrumbs $crumbs = drupal_get_breadcrumb(); if (count($crumbs) && strpos($crumbs[0], t('Home'))) { $crumbs[0] = l(t($fb_app->title), ''); $vars['breadcrumb'] = theme('breadcrumb', $crumbs); } // Style page differently depending on which sidebars are present. // Approach copied from Zen theme. // allows advanced theming based on context (home page, node of certain type, etc.) $body_classes = array(); $body_classes[] = ($vars['is_front']) ? 'front' : 'not-front'; $body_classes[] = ($user->uid > 0) ? 'logged-in' : 'not-logged-in'; if ($vars['sidebar_left'] && $vars['sidebar_right']) { $body_classes[] = 'with-both-sidebars'; } else if ($vars['sidebar_right']) { $body_classes[] = 'with-sidebar-right'; } else if ($vars['sidebar_left']) { $body_classes[] = 'with-sidebar-left'; } // new facebook pages are wider if ($_REQUEST['fb_sig_in_new_facebook']) $body_classes[] = 'in-new-facebook'; $vars['body_classes'] = implode(' ', $body_classes); } } else if ($hook == 'node') { if ($vars['teaser']) { $vars['template_file'] = 'node-teaser'; } // TODO: could move this to phptemplate engine. if (count($vars['about'])) $vars['about'] = drupal_render($vars['about']); if (count($vars['children'])) $vars['children'] = drupal_render($vars['children']); if ($vars['extra_style']) $vars['extra_style'] = drupal_render($vars['extra_style']); if ($vars['teaser']) $size = 'thumb'; else $size = 'thumb'; // small is too big for now, change this when node header has been made larger to fit image. if ($fbu = fb_get_fbu($vars['uid'])) $vars['picture'] = '
'; //drupal_set_message("node vars: " . dprint_r($vars, 1)); } return $vars; } function fb_fbml_regions() { $regions = array('admin' => t('Admin sidebar'), 'header' => t('Canvas Header'), 'right' => t('Canvas Right'), 'content_footer' => t('Content Footer'), 'canvas_footer' => t('Canvas Footer'), 'iframe_header' => t('Iframe Header'), 'iframe_footer' => t('Iframe Footer'), ); return $regions; } //// tabs function phptemplate_menu_local_tasks() { global $fb; if ($fb && $fb->in_fb_canvas()) { $local_tasks = menu_get_local_tasks(); $pid = menu_get_active_nontask_item(); $output = ''; if (count($local_tasks[$pid]['children'])) { $output .= "\n"; foreach ($local_tasks[$pid]['children'] as $mid) { $item = menu_get_item($mid); $selected = menu_in_active_trail($mid) ? "true" : "false"; $output .= "".$item['title']."\n"; } $output .= "\n"; } // TODO secondary local tasks if ($secondary = menu_secondary_local_tasks()) { $output .= "\n"; } } else $output = theme_menu_local_tasks(); return $output; } // collapsing fieldsets function phptemplate_fieldset($element) { global $fb; if (($fb && $fb->in_fb_canvas()) || (function_exists('fb_canvas_is_fbml') && fb_canvas_is_fbml())) { static $count = 0; if ($element['#collapsible']) { $id = 'fbml_fieldset_' . $count++; $linkattrs = array('clicktotoggle' => $id, 'href' => '#'); $contentattrs = array('id' => $id); if (!isset($element['#attributes']['class'])) { $element['#attributes']['class'] = ''; } $element['#attributes']['class'] .= ' collapsible'; if ($element['#collapsed']) { $element['#attributes']['class'] .= ' collapsed'; $contentattrs['style'] = 'display:none'; } $element['#title'] = '' . $element['#title'] . ''; } $output = '
'; if ($element['#title']) { $output .= ''. $element['#title'] .''; } $output .= '
'; if ($element['#description']) $output .= '
'. $element['#description'] .'
'; $output .= $element['#children'] . $element['#value']; $output .= "
\n"; } else $output = theme_fieldset($element); return $output; } ?>