Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 242069 Details for
Bug 216820
[navigation] Please add breadcrumb like navigation on eclipse.org
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch to implement breadcrumbs
eclipse.org-common.patch (text/plain), 4.26 KB, created by
Denis Roy
on 2014-04-16 15:06:41 EDT
(
hide
)
Description:
Patch to implement breadcrumbs
Filename:
MIME Type:
Creator:
Denis Roy
Created:
2014-04-16 15:06:41 EDT
Size:
4.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P eclipse.org-common >diff --git system/breadcrumb.class.php system/breadcrumb.class.php >new file mode 100644 >index 0000000..cb6037f >--- /dev/null >+++ system/breadcrumb.class.php >@@ -0,0 +1,139 @@ >+<?php >+/******************************************************************************* >+ * Copyright (c) 2014 Eclipse Foundation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Denis Roy (Eclipse Foundation)- initial API and implementation >+ *******************************************************************************/ >+require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menuitem.class.php"); >+ >+class Breadcrumb extends Menu { >+ >+ private $CrumbList = array(); >+ >+ # static list of first-level URIs with corresponding display-friendly names >+ # everything outside of this is considered to be in project space >+ private $FirstLevel = array( >+ "committers" => "Committers", >+ "downloads" => "Downloads", >+ "membership" => "Membership", >+ "newsgroups" => "Forums", >+ "org" => "About Us", >+ "projects" => "Projects", >+ "users" => "Users" >+ ); >+ >+ function getCrumbList() { >+ return $this->CrumbList; >+ } >+ >+ function setCrumbList($_List) { >+ $this->CrumbList = $_List; >+ } >+ >+ # Main constructor >+ function Breadcrumb() { >+ >+ $www_prefix = ""; >+ >+ global $App; >+ >+ if(!isset($App)) { >+ $App = new App(); >+ } >+ $www_prefix = $App->getWWWPrefix(); >+ >+ >+ # Default: Home >+ $this->addCrumb("Home", $www_prefix . "/", "_self"); >+ >+ if(isset($_SERVER['REQUEST_URI'])) { >+ http://www.eclipse.org/newsgroups/test.php >+ # Array ( [0] => [1] => newsgroups [2] => test.php ) >+ $items = explode("/", $_SERVER['REQUEST_URI']); >+ >+ >+ # Examine Item 1 (first level URL) >+ if(isset($this->FirstLevel[$items[1]])) { >+ $this->addCrumb($this->FirstLevel[$items[1]], $www_prefix . "/" . $items[1], "_self"); >+ } >+ else { >+ # Not pre-defined Foundation page, must be a project page >+ # /xtext/file.php => Home > Projects > xtext > $pageTitle >+ $this->addCrumb("Project", $www_prefix . "/projects/", "_self"); >+ $this->addCrumb($items[1], $www_prefix . "/" . $items[1], "_self"); >+ } >+ >+ # Add current page >+ # AT this point, $pageTitle should be set as we are running in header() >+ global $pageTitle; >+ if(isset($pageTitle)) { >+ $title = $pageTitle; >+ >+ # consider truncating $pageTitle if it's too long >+ if(strlen($title) > 35) { >+ $title = substr($title, 0, 35) . "..."; >+ } >+ >+ $this->addCrumb($pageTitle, NULL, NULL); >+ } >+ else { >+ # Add final generic crumb >+ $this->addCrumb("Document", NULL, NULL); >+ } >+ } >+ } >+ >+ function addCrumb($_Text, $_URL, $_Target) { >+ # Menu Items must be added at position 1 >+ $Crumb = new Link($_Text, $_URL, $_Target, 0); >+ >+ # Add incoming menuitem >+ $this->CrumbList[count($this->CrumbList)] = $Crumb; >+ } >+ >+ function getCrumbCount() { >+ return count($this->CrumbList); >+ } >+ >+ function getCrumbAt($_Pos) { >+ if($_Pos < $this->getCrumbCount()) { >+ return $this->CrumbList[$_Pos]; >+ } >+ } >+ >+ /** >+ * Insert breadcrumb at a specific position >+ * @param unknown $_Pos Position to insert at >+ * @param unknown $_Text Link text >+ * @param unknown $_URL Link URL >+ * @param unknown $_Target Link target >+ * >+ */ >+ function insertCrumbAt($_Pos, $_Text, $_URL, $_Target) { >+ if($_Pos < $this->getCrumbCount() && $_Pos > 0) { # Don't allow inserting before Home >+ $Crumb = new Link($_Text, $_URL, $_Target, 0); >+ $tempList = array($Crumb); >+ $result = array_merge(array_slice($this->CrumbList, 0, $_Pos, true), $tempList, array_slice($this->CrumbList, $_Pos, $this->getCrumbCount(), true)); >+ $this->CrumbList = $result; >+ } >+ else { >+ $this->addCrumb($_Text, $_URL, $_Target); >+ } >+ } >+ >+ function showBreadcrumbs() { >+ # for debugging purposes only >+ echo "Breadcrumbs: "; >+ foreach ($this->CrumbList as $Crumb) { >+ # $Crumb is a Link object >+ echo "<a href='" . $Crumb->getURL() . "'>" . $Crumb->getText() . "</a>"; >+ echo " | " ; >+ } >+ } >+} >+?> >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 216820
: 242069 |
242077