/** * Display gadgets and their status for the current layout * */ function ShowGadgets() { global $langmessage, $config; $gadget_info = gpOutput::WhichGadgets($this->curr_layout); echo '<h2>' . $langmessage['gadgets'] . '</h2>'; echo '<table class="bordered full_width">'; echo '<tr><th colspan="2"> </th></tr>'; if (!isset($config['gadgets']) || count($config['gadgets']) == 0) { echo '<tr><td colspan="2">'; echo $langmessage['Empty']; echo '</td></tr>'; } else { foreach ($config['gadgets'] as $gadget => $temp) { echo '<tr><td>'; echo str_replace('_', ' ', $gadget); echo '</td><td>'; if (isset($gadget_info[$gadget])) { echo $this->LayoutLink($this->curr_layout, $langmessage['remove'], 'cmd=rmgadget&gadget=' . urlencode($gadget), array('data-cmd' => 'cnreq')); } else { echo $langmessage['disabled']; } echo '</td></tr>'; } } echo '</table>'; }
/** * Show details about the selected layout * */ function ShowDetails($layout, $layout_info, $handlers_count) { global $langmessage, $config; echo '<h3>' . $langmessage['details'] . '</h3>'; //layout options echo '<table class="bordered full_width">'; echo '<tr><th colspan="2">'; echo $langmessage['layout']; echo '</th></tr>'; echo '<tr><td style="width:40%">'; echo $langmessage['label']; echo '</td><td>'; echo '<a name="layout_id" title="' . $layout_info['color'] . '" rel="' . $layout_info['color'] . '">'; echo '<input type="hidden" name="layout" value="' . htmlspecialchars($layout) . '" /> '; echo '<input type="hidden" name="layout_label" value="' . $layout_info['label'] . '" /> '; echo '<span class="layout_color_id" style="background-color:' . $layout_info['color'] . ';"></span>'; echo ' '; echo $layout_info['label']; echo '</a>'; echo '</td></tr>'; echo '<tr><td>'; echo $langmessage['theme']; echo '</td><td>'; echo $layout_info['theme_name']; echo '</td></tr>'; echo '<tr><td>'; echo $langmessage['usage']; echo '</td><td>'; if ($config['gpLayout'] == $layout) { echo $langmessage['default']; } elseif (!isset($_GET['show'])) { echo common::Link('Admin_Theme_Content/' . rawurlencode($layout), str_replace(' ', ' ', $langmessage['make_default']), 'cmd=makedefault', ' name="gpabox" title="' . htmlspecialchars($langmessage['make_default']) . '" '); } else { echo common::Link('Admin_Theme_Content', str_replace(' ', ' ', $langmessage['default']), 'cmd=makedefault&layout_id=' . rawurlencode($layout), ' name="creq" title="' . htmlspecialchars($langmessage['make_default']) . '" '); } echo ' '; $titles_count = $this->TitlesCount($layout); echo sprintf($langmessage['%s Pages'], $titles_count); echo '</td></tr>'; $theme_colors = $this->GetThemeColors($layout_info['dir']); echo '<tr><td>'; echo $langmessage['style']; echo '</td><td>'; if (!isset($_GET['show'])) { echo '<form action="' . common::GetUrl('Admin_Theme_Content/' . rawurlencode($layout)) . '" method="post">'; } else { echo '<form action="' . common::GetUrl('Admin_Theme_Content') . '" method="post">'; echo '<input type="hidden" name="layout" value="' . $layout . '" />'; } echo '<select name="color" class="gpselect">'; foreach ($theme_colors as $color) { if ($color == $layout_info['theme_color']) { echo '<option value="' . htmlspecialchars($color) . '" selected="selected">'; } else { echo '<option value="' . htmlspecialchars($color) . '">'; } echo $color; echo '</option>'; } echo '</select>'; echo ' <input type="hidden" name="cmd" value="change_layout_color" />'; echo ' <input type="submit" name="" value="' . htmlspecialchars($langmessage['save']) . '" class="gpbutton" />'; echo '</form>'; echo '</td></tr>'; echo '<tr><td>'; echo $langmessage['content_arrangement']; echo '</td><td>'; if ($handlers_count > 0) { if (!isset($_GET['show'])) { echo common::Link('Admin_Theme_Content/' . rawurlencode($layout), $langmessage['restore_defaults'], 'cmd=restore', ' name="creq" '); } else { echo common::Link('Admin_Theme_Content', $langmessage['restore_defaults'], 'cmd=restore&layout=' . rawurlencode($layout), ' name="creq" '); } } else { echo $langmessage['default']; } echo '</td></tr>'; echo '</table>'; // gadgets echo '<br/>'; echo '<table class="bordered full_width">'; $gadget_info = gpOutput::WhichGadgets($this->curr_layout); echo '<tr><th style="width:40%">'; echo $langmessage['gadgets']; echo '</th><th> </th></tr>'; if (!isset($config['gadgets']) || count($config['gadgets']) == 0) { echo '<tr><td colspan="2">'; echo $langmessage['Empty']; echo '</td></tr>'; } else { foreach ($config['gadgets'] as $gadget => $temp) { echo '<tr><td>'; echo str_replace('_', ' ', $gadget); echo '</td><td>'; if (isset($gadget_info[$gadget])) { if (!isset($_GET['show'])) { echo common::Link('Admin_Theme_Content/' . rawurlencode($layout), $langmessage['remove'], 'cmd=rmgadget&gadget=' . urlencode($gadget), ' name="creq" '); } else { echo common::Link('Admin_Theme_Content', $langmessage['remove'], 'cmd=rmgadget&gadget=' . urlencode($gadget) . '&layout=' . rawurlencode($layout), ' name="creq" '); } } else { echo $langmessage['disabled']; } echo '</td></tr>'; } } echo '</table>'; //CSS options echo '<br/>'; if (!isset($_GET['show'])) { echo '<form action="' . common::GetUrl('Admin_Theme_Content/' . rawurlencode($layout)) . '" method="post">'; } else { echo '<form action="' . common::GetUrl('Admin_Theme_Content') . '" method="post">'; echo '<input type="hidden" name="layout" value="' . $layout . '" />'; } echo '<input type="hidden" name="cmd" value="css_preferences" />'; echo '<table class="bordered full_width">'; echo '<tr><th style="width:40%">CSS</th><th> </th></tr>'; echo '<tr><td>'; echo 'Name Based Menu Classes'; echo '</td><td>'; $checked = ''; if (!isset($layout_info['menu_css_ordered'])) { $checked = 'checked="checked"'; } echo '<input type="checkbox" name="menu_css_ordered" value="on" ' . $checked . ' />'; echo '</td></tr>'; echo '<tr><td>'; echo 'Ordered Menu Classes'; echo '</td><td>'; $checked = ''; if (!isset($layout_info['menu_css_indexed'])) { $checked = 'checked="checked"'; } echo '<input type="checkbox" name="menu_css_indexed" value="on" ' . $checked . ' />'; echo '</td></tr>'; echo '<tr><td>'; echo ' '; echo '</td><td>'; echo ' <input type="submit" name="" value="' . htmlspecialchars($langmessage['save']) . '" class="gpbutton" />'; echo '</td></tr>'; echo '</table>'; echo '</form>'; //affected titles $titles_count = $this->TitlesCount($layout); echo '<br/>'; echo '<table class="bordered full_width">'; echo '<tr><th colspan="2">'; echo $langmessage['titles_using_layout']; echo ': ' . $titles_count; echo '</th></tr>'; echo '<tr><td colspan="2">'; if ($titles_count > 0) { echo '<ul class="titles_using">'; foreach ($this->LayoutArray as $index => $layout_comparison) { if ($layout == $layout_comparison) { $title = common::IndexToTitle($index); if (empty($title)) { continue; //may be external link } echo "\n<li>"; $label = common::GetLabel($title); $label = common::LabelSpecialChars($label); echo common::Link($title, $label); echo '</li>'; } } echo '</ul>'; echo '<div class="clear"></div>'; } echo '</td></tr>'; echo '</table>'; }
/** * Prepare the gadget content before getting template.php so that gadget functions can add css and js to the head * @return null */ static function PrepGadgetContent() { global $page; //not needed for admin pages if ($page->pagetype == 'admin_display') { return; } $gadget_info = gpOutput::WhichGadgets($page->gpLayout); foreach ($gadget_info as $gpOutCmd => $info) { if (!isset(self::$gadget_cache[$gpOutCmd])) { ob_start(); gpOutput::ExecArea($info); self::$gadget_cache[$gpOutCmd] = ob_get_clean(); } } }
/** * Prepare the gadget content before getting template.php so that gadget functions can add css and js to the head * @return null */ function PrepGadgetContent() { global $page, $GP_GADGET_CACHE; $gadget_info = gpOutput::WhichGadgets($page->gpLayout); foreach ($gadget_info as $gpOutCmd => $info) { if (!isset($GP_GADGET_CACHE[$gpOutCmd])) { ob_start(); gpOutput::ExecArea($info); $GP_GADGET_CACHE[$gpOutCmd] = ob_get_clean(); } } }