<?php
/* remotefilename=/shared/inc/PageFrame.php
*
* Copyright 2013 by MIT Sloan School of Management. All rights reserved.
*
* $Id: /shared/inc/PageFrame.php,v $
*/
/**
* Functions and default data for writing standardized HTML page frames
*
* N.B.: DO NOT require_once() or require() this script from within a function:
* Incorrect usage will cause the default initialization to break.
*
* In this file:
* define('ON_PRODUCTION'), TRUE on production server, FALSE on staging
* default value initialization for all variables used in this module
* DefaultPageFrameFooter(), routine for writing a default page footer
* DefaultPageFrameMenuCSS(), default routine to set up page menu's CSS
* DefaultPageFrameMenuDraw(), default routine to add the menu to the page
* DefaultPageFrameMenuJS(), default routine to set up menu's Javascript
* globalPageHeader(), writes HTML to open a proper XHTML document
* globalPageTrailer(), writes HTML to close a proper XHTML document
*
* Author: Fred Koschara
* Creation Date: April third, 2013
* Last Modified: November 12, 2014 at 12:06 pm
*
* Revision History:
* Date by Description
2014/11/12 genea added Open Graph meta tags for URL, type, title,
site_name, and description
* 2014/10/31 genea added Open Graph image meta tag
* 2014/10/28 genea added NewsroomPageFrameFooter() function
* 2014/10/24 genea modified DefaultPageFrameFooter() to directly include
* /shared/content/footer.php
* 2014/02/05 genea load updates.css file for $level0 = "newsroom"
* 2014/02/05 genea add $bodyClass2 as part of Newsroom facelift
* 2013/06/11 wfredk default footer's CSS in /shared/css/PageFrame-footer.css
* 2013/06/11 wfredk "Copyright" is required in copyright declarations
* 2013/05/30 wfredk use a top margin above the default page footer
* 2013/05/20 wfredk don't indent <script> tag in page footer
* 2013/05/17 wfredk page footer <a> styles weren't qualified by #page_footer
* 2013/05/15 wfredk add $HeadCSS support
* 2013/04/15 wfredk original development
* | |
* 2013/04/03 wfredk original development
*/
$DOCUMENT_ROOT=$_SERVER['DOCUMENT_ROOT'];
// this evaluates to TRUE on the production server, FALSE on staging servers
define('ON_PRODUCTION',(strpos($_SERVER['SERVER_NAME'],'mitsloan')!==FALSE));
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* begin default value initialization for all variables used in this module
*/
if (!defined('CopyrightYears')) define('CopyrightYears',date('Y'));
if (!isset($GoogleSiteCode)) // for <meta name="google-site-verification">
$GoogleSiteCode='*******************************************';
// set up the header and navigation
if (!isset($head_color)) $head_color='#970033';
if (!isset($section)) $section='MIT Sloan School of Management';
if (!isset($level0)) $level0='';
if (!isset($level1)) $level1='';
if (!isset($level2)) $level2='';
if (!isset($pagetitle)) $pagetitle=__FILE__.' needs to have a title defined!!';
if (!isset($pageID)) // HTML id attribute for <body> tag
$pageID='';
if (!isset($bodyClass)) // CSS ruleset names for <body> tag class attribute
$bodyClass='';
if (!isset($bodyClass2)) // CSS ruleset names for additional <body> tag class attribute
$bodyClass2='';
// <title> tag contents for the <head> of the page
if (!isset($MetaTitle)) $MetaTitle=$pagetitle.' - '.$section;
// <meta> tag data
if (!isset($PageAuthor)) $PageAuthor='';
if (!isset($PageCreated)) $PageCreated='';
if (!isset($PageDescrip)) $PageDescrip='';
if (!isset($PageKeywords)) $PageKeywords='';
if (!isset($PageReplyTo)) $PageReplyTo='webmaster@sloan.mit.edu';
if (!isset($PageNoCache)) // TRUE to insert caching prohibition <meta> tags
$PageNoCache=FALSE;
/**
* list of CSS files for the page, inserted in the order listed in the array
*
* If a CSS file is media-specific, append a pipe character and the media name
* after the filespec, e.g., '/shared/css/print.css|print'
*/
if (!isset($FilesCSS))
{ $FilesCSS=array ( '/shared/css/print.css|print',
'/shared/css/sitestyle.css|screen',
);
if (file_exists($DOCUMENT_ROOT.'/'.$level0.'/css/sitecolor.css'))
$FilesCSS[]='/'.$level0.'/css/sitecolor.css|screen';
if (file_exists($DOCUMENT_ROOT.'/'.$level0.'/css/site.css'))
$FilesCSS[]='/'.$level0.'/css/site.css|screen';
$FilesCSS[]='/shared/css/style-inner.css|screen';
}
if (!isset($HeadCSS)) // inline CSS to insert in page <head> after files
$HeadCSS=''; // don't do it! - put it in a .css file! (at least for production)
/**
* Javascript initialization inserted before adding Javascript files
*
* If $JavascriptInit is an array, each array entry is inserted as a separate
* line in the emitted page. Otherwise, $JavascriptInit is inserted as a string.
*/
if (!isset($JavascriptInit)) $JavascriptInit='';
// list of Javascript files to add to the page <head>
if (!isset($HeadFilesJS))
$HeadFilesJS=array ( '/shared/scripts/jquery-1.7.1.min.js',
'/shared/scripts/scripts.js',
'/shared/scripts/swfobject.js',
'/shared/scripts/jquery.main.js',
);
if (!isset($HeadJS)) // inline Javascript to insert in page <head> after files
$HeadJS=''; // don't do it! - put it in a .js file!
// list of Javascript files to add after the page contents before closing <body>
if (!isset($TrailerFilesJS))
$TrailerFilesJS=array();
if (!isset($TrailerJS)) // inline Javascript to insert after trailing files
$TrailerJS=''; // don't do it! - put it in a .js file! (at least for production)
if (!isset($FnMenuCSS)) // function to insert menu-related CSS into <head>
$FnMenuCSS='DefaultPageFrameMenuCSS';
if (!isset($FnMenuJS)) // function to insert menu-related Javascript into <head>
$FnMenuJS='DefaultPageFrameMenuJS';
if (!isset($FnMenuDraw)) // function to insert menu at top of <body>
$FnMenuDraw='DefaultPageFrameMenuDraw';
if (!isset($ShowSectionH1)) // TRUE==insert $section as <h1> below menu
$ShowSectionH1=TRUE;
if (!isset($FnPageFooter)) // function to insert footer after page contents
$FnPageFooter='';
if (!isset($bShowPageFootIcons)) // TRUE==add social media icons to footer
$bShowPageFootIcons=FALSE;
//if (!isset($x)) $x='';
/* end default value initialization for all variables used in this module
* -----------------------------------------------------------------------------
*/
/**
* routine for writing a default page footer
*
* @global boolean $bShowIcons, TRUE==add social media icons, default=FALSE
*/
function DefaultPageFrameFooter()
{ include $_SERVER['DOCUMENT_ROOT'].'/shared/content/footer.php';
}