Create separate php files for header and footer, extra css for dev guide
diff --git a/_footer.php b/_footer.php
new file mode 100644
index 0000000..749e1c0
--- /dev/null
+++ b/_footer.php
@@ -0,0 +1,19 @@
+ <div class="antifloat"></div>
+ <div id="footer">
+ <ul id="footernav">
+ <li><a href="http://www.eclipse.org/">Eclipse</a></li>
+ <li><a href="http://www.eclipse.org/legal/privacy.php">Privacy Policy</a></li>
+ <li><a href="http://www.eclipse.org/legal/termsofuse.php">Terms of Use</a></li>
+ <li><a href="http://www.eclipse.org/legal/copyright.php">Copyright Agent</a></li>
+ <li><a href="http://www.eclipse.org/legal/">Legal</a></li>
+ <li><a href="http://www.eclipse.org/org/foundation/contact.php">Contact Us</a></li>
+ </ul>
+ <a href="http://www.eclipse.org/">
+ <img src="/rap/images/logos/eclipse.png" alt="Eclipse logo" />
+ </a>
+ <span id="copyright">Copyright © <?= $CURRENT_YEAR ?> The Eclipse Foundation. All Rights Reserved.</span>
+ </div>
+
+</div>
+</body>
+</html>
diff --git a/_header.php b/_header.php
new file mode 100644
index 0000000..fb7a469
--- /dev/null
+++ b/_header.php
@@ -0,0 +1,40 @@
+<!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">
+<head>
+ <title><?=$PAGE_TITLE?></title>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+ <meta name="keywords" content="rap, rwt, osgi, eclipse, equinox, eclipse rap, ajax" />
+ <meta name="google-site-verification" content="kMX1SI1MRFpyzEPh4yv_TXRUpKLmBVvENEfQtjdZuwI" />
+ <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,400italic,700' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" type="text/css" href="/rap/_theme/reset.css" media="screen"/>
+ <link rel="stylesheet" type="text/css" href="/rap/_theme/layout.css" media="screen" />
+<? if( isset( $PAGE_ADD_CSS ) ) { ?>
+ <link rel="stylesheet" type="text/css" href="<?= $PAGE_ADD_CSS ?>" media="screen" />
+<? } ?>
+ <link rel="stylesheet" type="text/css" href="/rap/_theme/print.css" media="print" />
+ <!--[if lt IE 8]><link rel="stylesheet" type="text/css" href="/rap/rap-layout-fixes-ie.css"/><![endif]-->
+ <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
+ <script type="text/javascript" src="http://w3.eclipsesource.com/www/js/rap/jquery.zrssfeed.min.js"></script>
+ <script type="text/javascript" src="/rap/script.js"></script>
+</head>
+<body>
+
+ <div id="info-box">
+ <div>
+ <img src="/rap/images/twitter.png" alt="Twitter Logo" />
+ <a href="http://twitter.com/#!/EclipseRAP/">Follow us on Twitter</a>
+ </div>
+ <div>
+ <img src="/rap/images/project-stats.png" alt="Project Information" />
+ <a href="http://eclipse.org/projects/project.php?id=rt.rap">About this project</a>
+ </div>
+ </div>
+
+ <div id="header-bar">
+<?
+ include( $_SERVER['DOCUMENT_ROOT'] . '/rap/_navigation.php' );
+?>
+ </div>
+ <div id="novaWrapper">
+ <div id="novaContent">
diff --git a/_navigation.php b/_navigation.php
index dc9eae2..3223e55 100644
--- a/_navigation.php
+++ b/_navigation.php
@@ -1,20 +1,34 @@
<?php
-$navigationStructure = array(
+$NAV_ENTRIES = array(
+
+ "home" => array(
+ "sub-entries" => array(
+
+ "about-project" => array(
+ "label" => "About this project",
+ "url" => "http://eclipse.org/projects/project.php?id=rt.rap"
+ ),
+ "incubator" => array(
+ "label" => "Incubator",
+ "url" => "/rap/incubator/"
+ )
+ )
+ ),
"demos" => array(
"label" => "Demos",
- "url" => "/rap/demos/",
- "sub-entries" => array(
- "demos" => array(
- "label" => "Demos",
- "url" => "/rap/demos/"
- ),
- "built-on-rap" => array(
- "label" => "Built on RAP",
- "url" => "/rap/users/"
- )
- )
+ "url" => "/rap/demos/",
+ "sub-entries" => array(
+ "demos" => array(
+ "label" => "Demos",
+ "url" => "/rap/demos/"
+ ),
+ "built-on-rap" => array(
+ "label" => "Built on RAP",
+ "url" => "/rap/users/"
+ )
+ )
),
"download" => array(
@@ -76,60 +90,52 @@
);
-function createHeaderAndNavigation( $navPosition ) {
- $result = '<div id="header">'
- . createLogo( $navPosition[ 0 ], $navPosition[ 1 ] )
- . createMainNavigation( $navPosition[ 0 ], $navPosition[ 1 ] )
- . '</div>'
- . createHeaderBar( $navPosition[ 0 ], $navPosition[ 1 ] );
- return $result;
-}
+ $nav_logo_deco_class = $PAGE_NAV_POSITION[ 0 ] === 'home' ? 'class="active"' : '';
+ $nav_home_link_style = $PAGE_NAV_POSITION[ 0 ] === 'home' ? 'style="display:none;"' : '';
+?>
-function createLogo( $topLevelId, $secondLevelId ) {
- $active = $topLevelId === 'home'? 'class="active"' : '';
- $result = "<div $active id=\"rap-logo-deco\"></div>";
- $result .= '<a href="/rap/"><div id="rap-logo"></div></a>';
- return $result;
-}
+<div id="header">
-function createMainNavigation( $topLevelPos ) {
- $result = '<div id="navigation"><ul>';
- $navEntries = $GLOBALS[ 'navigationStructure' ];
- foreach( $navEntries as $navId => $navData ) {
- $active = $navId === $topLevelPos ? 'class="active"' : '';
- $result .= "<li $active><a href=\"{$navData[ 'url' ]}\">{$navData[ 'label' ]}</a></li>";
- }
- $result .= '</ul><div class="stop"></div></div>';
- return $result;
-}
+ <div <?= $nav_logo_deco_class ?> id="rap-logo-deco"></div>
+ <a href="/rap/"><div id="rap-logo"></div></a>
-function createHeaderBar( $topLevelId, $secondLevelId ) {
- $headerBar = '<div id="nav-bar">'
- . '<div id="nav-container">'
- . createHeaderBarNavigation( $topLevelId, $secondLevelId )
- . '<div class="antifloat"></div>'
- . '</div>'
- . '</div>';
- return $headerBar;
-}
+ <div id="navigation">
+ <ul>
-function createHeaderBarNavigation( $topLevelId, $secondLevelId ) {
- if( $topLevelId === 'home' ) {
- $result = '<ul id="nav">';
- $active = $secondLevelId === "incubator" ? 'class="active"' : '';
- $result .= '<li><a href="http://eclipse.org/projects/project.php?id=rt.rap">About this project</a></li>';
- $result .= "<li><a $active href=\"/rap/incubator\">Incubator</a></li>";
- } else {
- $result = "<ul id=\"nav-home\"><li><a href=\"/rap/\">< Home</a></li></ul>";
- $result .= '<ul id="nav">';
- $secondLevelEntries = $GLOBALS[ 'navigationStructure' ][ $topLevelId ][ 'sub-entries' ];
- foreach( $secondLevelEntries as $navId => $navData ) {
- $active = $navId === $secondLevelId ? 'class="active"' : '';
- $result .= "<li><a $active href=\"{$navData[ 'url' ]}\">{$navData[ 'label' ]}</a></li>";
+<?
+ // top level
+ foreach( $NAV_ENTRIES as $navId => $navData ) {
+ if( $navData[ 'label' ] ) {
+ $active = $navId === $PAGE_NAV_POSITION[ 0 ] ? 'class="active"' : '';
+ echo "<li $active><a href=\"{$navData[ 'url' ]}\">{$navData[ 'label' ]}</a></li>";
}
}
- $result .= '</ul>';
- return $result;
-}
+?>
-?>
\ No newline at end of file
+ </ul>
+ <div class="stop"></div>
+ </div>
+</div>
+
+<div id="nav-bar">
+ <div id="nav-container">
+ <ul <?= $nav_home_link_style ?> id="nav-home">
+ <li>
+ <a href="/rap/">< Home</a>
+ </li>
+ </ul>
+ <ul id="nav">
+
+<?
+ // second level
+ $nav_secondLevelEntries = $NAV_ENTRIES[ $PAGE_NAV_POSITION[ 0 ] ][ 'sub-entries' ];
+ foreach( $nav_secondLevelEntries as $navId => $navData ) {
+ $active = $navId === $PAGE_NAV_POSITION[ 1 ] ? ' class="active"' : '';
+ echo "<li><a {$active} href=\"{$navData[ 'url' ]}\">{$navData[ 'label' ]}</a></li>";
+ }
+?>
+
+ </ul>
+ <div class="antifloat"></div>
+ </div>
+</div>
diff --git a/_projectCommon.php b/_projectCommon.php
index 2d78542..8c877e5 100644
--- a/_projectCommon.php
+++ b/_projectCommon.php
@@ -1,6 +1,5 @@
<?php
- require_once( "_navigation.php" );
require_once( "_errorHandler.php" );
function replaceVariables( $variables, $html ) {
@@ -17,76 +16,17 @@
}
function printHeader( $title, $navPosition ) {
- echo <<<EOHTML
- <!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">
- <head>
- <title>$title</title>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <meta name="keywords" content="rap, rwt, osgi, eclipse, equinox, eclipse rap, ajax" />
- <meta name="google-site-verification" content="kMX1SI1MRFpyzEPh4yv_TXRUpKLmBVvENEfQtjdZuwI" />
- <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,400italic,700' rel='stylesheet' type='text/css'>
- <link rel="stylesheet" type="text/css" href="/rap/_theme/reset.css" media="screen"/>
- <link rel="stylesheet" type="text/css" href="/rap/_theme/layout.css" media="screen" />
- <link rel="stylesheet" type="text/css" href="/rap/_theme/print.css" media="print" />
- <!--[if lt IE 8]><link rel="stylesheet" type="text/css" href="/rap/rap-layout-fixes-ie.css"/><![endif]-->
- <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
- <script type="text/javascript" src="http://w3.eclipsesource.com/www/js/rap/jquery.zrssfeed.min.js"></script>
- <script type="text/javascript" src="/rap/script.js"></script>
- </head>
- <body>
-EOHTML;
- printInfoBox();
- echo '<div id="header-bar">';
- echo createHeaderAndNavigation( $navPosition );
- echo <<<EOHTML
- </div>
- <div id="novaWrapper">
- <div id="novaContent">
-EOHTML;
- }
-
- function printInfoBox() {
- echo <<<EOHTML
- <div id="info-box">
- <div>
- <img src="/rap/images/twitter.png" alt="Twitter Logo" />
- <a href="http://twitter.com/#!/EclipseRAP/">Follow us on Twitter</a>
- </div>
- <div>
- <img src="/rap/images/project-stats.png" alt="Project Information" />
- <a href="http://eclipse.org/projects/project.php?id=rt.rap">About this project</a>
- </div>
- </div>
-EOHTML;
+ $PAGE_TITLE = $title;
+ $PAGE_NAV_POSITION = $navPosition;
+ global $PAGE_ADD_CSS;
+ include( $_SERVER['DOCUMENT_ROOT'] . '/rap/_header.php' );
}
function printFooter() {
- $year = date( "Y" );
printGoogleAnalyticsJs( 'UA-910670-2' );
printGoogleAnalyticsJs( 'UA-17128428-1' );
- echo <<<EOHTML
- <div class="antifloat"></div>
- <div id="footer">
- <ul id="footernav">
- <li><a href="http://www.eclipse.org/">Eclipse</a></li>
- <li><a href="http://www.eclipse.org/legal/privacy.php">Privacy Policy</a></li>
- <li><a href="http://www.eclipse.org/legal/termsofuse.php">Terms of Use</a></li>
- <li><a href="http://www.eclipse.org/legal/copyright.php">Copyright Agent</a></li>
- <li><a href="http://www.eclipse.org/legal/">Legal</a></li>
- <li><a href="http://www.eclipse.org/org/foundation/contact.php">Contact Us</a></li>
- </ul>
- <a href="http://www.eclipse.org/">
- <img src="/rap/images/logos/eclipse.png" alt="Eclipse logo" />
- </a>
- <span id="copyright">Copyright © $year The Eclipse Foundation. All Rights Reserved.</span>
- </div>
-
-</div>
-</body>
-</html>
-EOHTML;
+ $CURRENT_YEAR = date( "Y" );
+ include( $_SERVER['DOCUMENT_ROOT'] . '/rap/_footer.php' );
}
function printGoogleAnalyticsJs( $trackingId ) {
@@ -132,4 +72,8 @@
include( $_SERVER['DOCUMENT_ROOT'] . "/rap/_sidebar/" . $filename );
}
+ function containsString( $haystack, $needle ) {
+ return strpos( $haystack, $needle ) === false ? false : true;
+ }
+
?>
diff --git a/_theme/devguide.css b/_theme/devguide.css
new file mode 100644
index 0000000..3cdec19
--- /dev/null
+++ b/_theme/devguide.css
@@ -0,0 +1,40 @@
+
+@CHARSET "UTF-8";
+
+table {
+ border: 1px solid #aaa;
+}
+
+td, th {
+ padding: 2px;
+ border-color: #aaa;
+ border-style: solid;
+}
+
+td {
+ font-size: 12px;
+}
+
+/* first row, first cell */
+
+th, td {
+ border-width: 0px;
+}
+
+/* first row, not first cell */
+
+th+th, th+td, td+td {
+ border-width: 0px 0px 0px 1px;
+}
+
+/* not first row, first cell */
+
+tr+tr th, tr+tr td {
+ border-width: 1px 0px 0px 0px;
+}
+
+/* not first row, not first cell */
+
+tr+tr th+th, tr+tr th+td, tr+tr td+td {
+ border-width: 1px 0px 0px 1px;
+}
diff --git a/_theme/layout.css b/_theme/layout.css
index 94e7228..867021b 100644
--- a/_theme/layout.css
+++ b/_theme/layout.css
@@ -954,42 +954,3 @@
ul#dev-guide-nav li.category-group > ul > li {
padding-bottom: 5px;
}
-
-table {
- border: 1px solid #aaa;
-}
-
-td, th {
- padding: 2px;
- border-color: #aaa;
- border-style: solid;
-}
-
-td {
- font-size: 12px;
-}
-
-/* first row, first cell */
-
-th, td {
- border-width: 0px;
-}
-
-/* first row, not first cell */
-
-th+th, th+td, td+td {
- border-width: 0px 0px 0px 1px;
-}
-
-/* not first row, first cell */
-
-tr+tr th, tr+tr td {
- border-width: 1px 0px 0px 0px;
-}
-
-/* not first row, not first cell */
-
-tr+tr th+th, tr+tr th+td, tr+tr td+td {
- border-width: 1px 0px 0px 1px;
-}
-
diff --git a/developers-guide/ContentView.php b/developers-guide/ContentView.php
index 2acb611..c310fd8 100644
--- a/developers-guide/ContentView.php
+++ b/developers-guide/ContentView.php
@@ -32,7 +32,7 @@
foreach( $links as $link ) {
if( $link -> hasAttribute( 'href' ) ) {
$url = $link -> getAttribute( 'href' );
- if( !DevGuideUtils::containsString( $url, 'http://' ) && !self::isBookmark( $url ) ) {
+ if( !containsString( $url, 'http://' ) && !self::isBookmark( $url ) ) {
$link -> setAttribute( 'href', self::rewriteLinkUrl( $url ) );
}
}
@@ -47,7 +47,7 @@
$result = '';
if( substr( $url, 0, 5 ) === '/help' ) {
$result = str_replace( '/help', 'http://help.eclipse.org', $url );
- } else if( DevGuideUtils::containsString( $url, '.html' ) ) {
+ } else if( containsString( $url, '.html' ) ) {
$normalizedUrl = self::normalizeUrl( self::$htmlFile -> getPath() . '/' . $url );
$searchString = DevGuideUtils::ROOT_URL . '/help/html/';
$result = '?topic=' . str_replace( $searchString, '', $normalizedUrl );
@@ -61,7 +61,7 @@
$images = $htmlDocument -> getElementsByTagName( 'img' );
foreach( $images as $image ) {
$url = $image -> getAttribute( 'src' );
- if( !DevGuideUtils::containsString( $url, 'http://' ) ) {
+ if( !containsString( $url, 'http://' ) ) {
$image -> setAttribute( 'src', self::$htmlFile -> getPath() . '/' . $url );
}
}
diff --git a/developers-guide/DevGuideUtils.php b/developers-guide/DevGuideUtils.php
index 75d1b20..9871d68 100644
--- a/developers-guide/DevGuideUtils.php
+++ b/developers-guide/DevGuideUtils.php
@@ -6,10 +6,6 @@
private function __construct() {}
- public static function containsString( $haystack, $needle ) {
- return strpos( $haystack, $needle ) === false ? false : true;
- }
-
}
?>
\ No newline at end of file
diff --git a/developers-guide/devguide.php b/developers-guide/devguide.php
index 37f2346..96db48f 100644
--- a/developers-guide/devguide.php
+++ b/developers-guide/devguide.php
@@ -5,6 +5,8 @@
require_once $_SERVER['DOCUMENT_ROOT'] . '/rap/developers-guide/NavigationView.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/rap/developers-guide/ContentView.php';
+$PAGE_ADD_CSS = '/rap/_theme/devguide.css';
+
$title = "Developer's Guide";
$navPosition = array( 'help', 'developers-guide' );
$forwardingUrl = '/rap/developers-guide/';
@@ -12,41 +14,26 @@
if( !isset( $_GET[ 'topic' ] ) ) {
header( 'Location: ' . $forwardingUrl );
exit;
-} else if( empty( $_GET[ 'topic' ] ) ||
- DevGuideUtils::containsString( $_GET[ 'topic' ], './' ) ||
- DevGuideUtils::containsString( $_GET[ 'topic' ], '../' ) ||
- !DevGuideUtils::containsString( $_GET[ 'topic' ], '.html' ) ) {
- handleError();
}
-try {
- $devguideContent = ContentView::create( $_GET[ 'topic' ] );
-} catch( RuntimeException $exception ) {
- handleError();
-}
+$topic = $_GET[ 'topic' ];
-function startsWith( $haystack, $needle ) {
- $result = false;
- $needleLength = strlen( $needle );
- if( $needleLength <= strlen( $haystack ) ) {
- $result = substr( $haystack, 0, $needleLength ) === $needle;
+if( empty( $topic )
+ || containsString( $topic, './' )
+ || containsString( $topic, '../' )
+ || !containsString( $topic, '.html' ) )
+{
+ send404();
+} else {
+ try {
+ $devguideContent = ContentView::create( $topic );
+ } catch( RuntimeException $exception ) {
+ send404();
}
- return $result;
}
-function handleError() {
+function send404() {
header( "HTTP/1.1 404 Not Found" );
- printHeader( $title, $navPosition );
- printFileNotFoundErrorMessage();
- printFooter();
- exit;
-}
-
-function printFileNotFoundErrorMessage() {
- echo '<div id="midcolumn" class="dev-guide-content">'
- . "<h1>Not found</h1><p>This help topic does not exist in the RAP Developer's Guide</p>"
- . '<p>See <a href="/rap/developers-guide/">table of contents</a> for all available topics.</p>'
- . '</div>';
}
?>
@@ -54,8 +41,26 @@
<?php printHeader( $title, $navPosition ) ?>
<div id="midcolumn" class="dev-guide-content">
+
+<? if( $devguideContent ) { ?>
+
<?= $devguideContent ?>
+
+<? } else { ?>
+
+ <h1>Not found</h1>
+
+ <p>
+ This help topic does not exist in the RAP Developer's Guide
+ </p>
+ <p>
+ See <a href="/rap/developers-guide/">table of contents</a> for all available topics.
+ </p>
+
+<? } ?>
+
</div>
+
<div id="rightcolumn">
<h2 style="padding-bottom: 12px;">Contents</h2>
<?= NavigationView::create( DevGuideUtils::ROOT_URL . '/help/toc.xml' ); ?>
diff --git a/noteworthy/1.5/_news-R.html b/noteworthy/1.5/_news-R.html
index 2ff9725..9e175c2 100644
--- a/noteworthy/1.5/_news-R.html
+++ b/noteworthy/1.5/_news-R.html
@@ -354,8 +354,8 @@
<p>
Tree and Table are now using the same JavaScript implementation on the client. This allowed us
- to fix a lot of <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=332524#c0">bugs</a> and
- gave the Table a small performance boost. It also makes it very easy for us to always enable new
+ to fix a lot of <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=332524#c0">bugs</a> and
+ gave the Table a small performance boost. It also makes it very easy for us to always enable new
features for both widges on the same time, like fixed columns and markup.
</p>