📄 layout.class
字号:
<?php/** * Base layout class. * * Extends the basic Error class to add HTML functions * for displaying all site dependent HTML, while allowing * extendibility/overriding by themes via the Theme class. * * Make sure browser.php is included _before_ you create an instance of this object. * * Geoffrey Herteg, August 29, 2000 * * @version $Id: Layout.class,v 1.46 2001/06/26 23:05:38 tperdue Exp $ */class Layout extends Error { /** * The default main page content */ var $rootindex = "index_std.php"; /** * The root location for images * * @var string $imgroot */ var $imgroot = '/themes/gforge/images/'; var $COLOR_CONTENT_BACK= 'ffffff'; var $COLOR_LTBACK1= '#eeeeef'; var $COLOR_LTBACK2= '#fafafa'; var $COLOR_HTMLBOX_TITLE = '#d5d5d7'; var $COLOR_HTMLBOX_BACK = '#eaecef'; var $FONT_CONTENT = 'helvetica'; var $FONT_HTMLBOX_TITLE = 'helvetica'; var $FONTCOLOR_HTMLBOX_TITLE = '#333333'; var $FONTCOLOR_CONTENT = '#333333'; var $FONTSIZE = 'small'; var $FONTSIZE_SMALLER='x-small'; var $FONTSIZE_SMALLEST='xx-small'; var $FONTSIZE_HTMLBOX_TITLE = 'small'; var $bgpri = array(); /** * Layout() - Constructor */ function Layout() { GLOBAL $bgpri; // Constructor for parent class... $this->Error(); /* Set up the priority color array one time only */ $bgpri[1] = '#dadada'; $bgpri[2] = '#dad0d0'; $bgpri[3] = '#dacaca'; $bgpri[4] = '#dac0c0'; $bgpri[5] = '#dababa'; $bgpri[6] = '#dab0b0'; $bgpri[7] = '#daaaaa'; $bgpri[8] = '#da9090'; $bgpri[9] = '#da8a8a'; //determine font for this platform if (browser_is_windows() && browser_is_ie()) { //ie needs smaller fonts $this->FONTSIZE='x-small'; $this->FONTSIZE_SMALLER='xx-small'; $this->FONTSIZE_SMALLEST='7pt'; } else if (browser_is_windows()) { //netscape on wintel $this->FONTSIZE='small'; $this->FONTSIZE_SMALLER='x-small'; $this->FONTSIZE_SMALLEST='x-small'; } else if (browser_is_mac()){ //mac users need bigger fonts $this->FONTSIZE='medium'; $this->FONTSIZE_SMALLER='small'; $this->FONTSIZE_SMALLEST='x-small'; } else { //linux and other users $this->FONTSIZE='small'; $this->FONTSIZE_SMALLER='x-small'; $this->FONTSIZE_SMALLEST='xx-small'; } $this->FONTSIZE_HTMLBOX_TITLE = $this->FONTSIZE; } /** * header() - "steel theme" top of page * * @param array Header parameters array */ function header($params) { global $Language; if (!$params['title']) { $params['title'] = $GLOBALS['sys_name']; } else { $params['title'] = $GLOBALS['sys_name'] . ":" . $params['title']; } print '<?xml version="1.0" encoding="' . $Language->getEncoding(). '"?>'; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="<?php echo $Language->getLanguageCode(); ?>"> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $Language->getEncoding(); ?>" /> <title><?php echo $params['title']; ?></title> <script language="JavaScript" type="text/javascript"> <!-- function help_window(helpurl) { HelpWin = window.open( helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400'); } // --> </script><?php/* WARNING - changing this font call can affect INTERNATIONALIZATION*/ //gets font from Language Object $site_fonts=$GLOBALS['Language']->getFont(); ?><style type="text/css"> <!-- BODY { margin-top: 3; margin-left: 3; margin-right: 3; margin-bottom: 3; background: #01004e; } ol,ul,p,body,td,tr,th,form { font-family: <?php echo $site_fonts; ?>; font-size:<?php echo $this->FONTSIZE; ?>; color: <?php echo $this->FONTCOLOR_CONTENT ?>; } h1 { font-size: x-large; font-family: <?php echo $site_fonts; ?>; } h2 { font-size: large; font-family: <?php echo $site_fonts; ?>; } h3 { font-size: medium; font-family: <?php echo $site_fonts; ?>; } h4 { font-size: small; font-family: <?php echo $site_fonts; ?>; } h5 { font-size: x-small; font-family: <?php echo $site_fonts; ?>; } h6 { font-size: xx-small; font-family: <?php echo $site_fonts; ?>; } pre,tt { font-family: courier,sans-serif } a:link { text-decoration:none } a:visited { text-decoration:none } a:active { text-decoration:none } a:hover { text-decoration:underline; color:red } .titlebar { color: black; text-decoration: none; font-weight: bold; } a.tablink { color: black; text-decoration: none; font-weight: bold; font-size: <?php echo $this->FONTSIZE_SMALLER; ?>; } a.tablink:visited { color: black; text-decoration: none; font-weight: bold; font-size: <?php echo $this->FONTSIZE_SMALLER; ?>; } a.tablink:hover { text-decoration: none; color: black; font-weight: bold; font-size: <?php echo $this->FONTSIZE_SMALLER; ?>; } a.tabsellink { color: black; text-decoration: none; font-weight: bold; font-size: <?php echo $this->FONTSIZE_SMALLER; ?>; } a.tabsellink:visited { color: black; text-decoration: none; font-weight: bold; font-size: <?php echo $this->FONTSIZE_SMALLER; ?>; } a.tabsellink:hover { text-decoration: none; color: black; font-weight: bold; font-size: <?php echo $this->FONTSIZE_SMALLER; ?>; } --></style></head><body><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><a href="/"><?php echo html_image('logo.png',198,52,array('border'=>'0')); ?></a></td> <td><?php echo $this->searchBox(); ?></td> <td align="right"><?php if (session_loggedin()) { ?> <a href="/account/logout.php"><?php echo html_image($Language->getText('image','logout'),74,14,array('border'=>'0')); ?></a><br /> <a href="/account/"><?php echo html_image($Language->getText('image','myaccount'),74,14,array('border'=>'0')); ?></a> <?php } else { ?> <a href="/account/login.php"><?php echo html_image($Language->getText('image','login'),74,14,array('border'=>'0')); ?></a><br /> <a href="/account/register.php"><?php echo html_image($Language->getText('image','newaccount'),74,14,array('border'=>'0')); ?></a> <?php } ?></td> <td> </td> </tr></table><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td colspan="3"><?php echo $this->outerTabs($params); ?> </td> <td> </td> </tr> <tr> <td align="left" bgcolor="#E0E0E0" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topleft.png" height="9" width="9" alt="" /></td> <td bgcolor="#E0E0E0" width="30"><img src="<?php echo $this->imgroot; ?>clear.png" width="30" height="1" alt="" /></td> <td bgcolor="#E0E0E0"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td> <td bgcolor="#E0E0E0" width="30"><img src="<?php echo $this->imgroot; ?>clear.png" width="30" height="1" alt="" /></td> <td align="right" bgcolor="#E0E0E0" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topright.png" height="9" width="9" alt="" /></td> </tr> <tr> <!-- Outer body row --> <td bgcolor="#E0E0E0"><img src="<?php echo $this->imgroot; ?>clear.png" width="10" height="1" alt="" /></td> <td valign="top" width="99%" bgcolor="#E0E0E0" colspan="3"> <!-- Inner Tabs / Shell --> <table border="0" width="100%" cellspacing="0" cellpadding="0"><?phpif ($params['group']) { ?> <tr> <td> </td> <td> <?php echo $this->projectTabs($params['toptab'],$params['group']); ?> </td> <td> </td> </tr> <?php}?> <tr> <td align="left" bgcolor="#ffffff" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topleft-inner.png" height="9" width="9" alt="" /></td> <td bgcolor="#ffffff"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td> <td align="right" bgcolor="#ffffff" width="9"><img src="<?php echo $this->imgroot; ?>tabs/topright-inner.png" height="9" width="9" alt="" /></td> </tr> <tr> <td bgcolor="#ffffff"><img src="<?php echo $this->imgroot; ?>clear.png" width="10" height="1" alt="" /></td> <td valign="top" width="99%" bgcolor="white"> <?php/* if ($params['titlevals']) { $title = $Language->getText($params['pagename'],'title',$params['titlevals']); } else { $title = $Language->getText($params['pagename'],'title'); } if ($params['sectionvals']) { $section = $Language->getText($params['pagename'],'section',$params['sectionvals']); } else { $section = $Language->getText($params['pagename'],'section'); } if ($section) { print "<strong>$section</strong>\n"; } if ($title) { print "<h2>$title</h2>\n"; }*/ } function footer($params) { ?> <!-- end main body row --> </td> <td width="10" bgcolor="#ffffff"><img src="<?php echo $this->imgroot; ?>clear.png" width="2" height="1" alt="" /></td> </tr> <tr> <td align="left" bgcolor="#E0E0E0" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomleft-inner.png" height="11" width="11" alt="" /></td> <td bgcolor="#ffffff"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td> <td align="right" bgcolor="#E0E0E0" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomright-inner.png" height="11" width="11" alt="" /></td> </tr> </table> <!-- end inner body row --> </td> <td width="10" bgcolor="#E0E0E0"><img src="<?php echo $this->imgroot; ?>clear.png" width="2" height="1" alt="" /></td> </tr> <tr> <td align="left" bgcolor="#E0E0E0" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomleft.png" height="9" width="9" alt="" /></td> <td bgcolor="#E0E0E0" colspan="3"><img src="<?php echo $this->imgroot; ?>clear.png" width="1" height="1" alt="" /></td> <td align="right" bgcolor="#E0E0E0" width="9"><img src="<?php echo $this->imgroot; ?>tabs/bottomright.png" height="9" width="9" alt="" /></td> </tr></table><?php global $sys_show_source; global $Language; if ($sys_show_source) { global $SCRIPT_NAME; print '<a class="showsource" href="/source.php?file=' . $SCRIPT_NAME . '"> '.$Language->getText('source','show_source').' </a>'; }?></body></html><?php } function getRootIndex() { return $this->rootindex; } /** * boxTop() - Top HTML box * * @param string Box title * @param bool Whether to echo or return the results * @param string The box background color */ function boxTop($title) { return ' <table cellspacing="0" cellpadding="1" width="100%" border="0" bgcolor="' .$this->COLOR_HTMLBOX_TITLE.'"> <tr><td> <table cellspacing="0" cellpadding="2" width="100%" border="0" bgcolor="'. $this->COLOR_HTMLBOX_BACK.'"> <tr style="background-color:'.$this->COLOR_HTMLBOX_TITLE.'" align="center"> <td colspan="2"><span class="titlebar">'.$title.'</span></td> </tr> <tr align="left"> <td colspan="2">'; } /** * boxMiddle() - Middle HTML box * * @param string Box title * @param string The box background color */ function boxMiddle($title) { return ' </td> </tr> <tr style="background-color:'.$this->COLOR_HTMLBOX_TITLE.'" align="center"> <td colspan="2"><span class="titlebar">'.$title.'</span></td> </tr> <tr align="left" style="background-color:'. $this->COLOR_HTMLBOX_BACK .'"> <td colspan="2">'; } /** * boxGetAltRowStyle() - Get an alternating row style for tables * * @param int Row number */ function boxGetAltRowStyle($i) { if ($i % 2 == 0) { return 'style="background-color:white"'; } else { return 'style="background-color:' . $this->COLOR_LTBACK1 . '"'; } } /** * boxBottom() - Bottom HTML box * * @param bool Whether to echo or return the results */ function boxBottom() { return ' </td> </tr> </table> </td></tr> </table><p> </p>'; } /** * listTableTop() - Takes an array of titles and builds the first row of a new table. * * @param array The array of titles
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -