Return-Path: Delivered-To: apmail-lucene-java-commits-archive@www.apache.org Received: (qmail 61744 invoked from network); 24 Jun 2009 16:20:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Jun 2009 16:20:31 -0000 Received: (qmail 36665 invoked by uid 500); 24 Jun 2009 16:20:41 -0000 Delivered-To: apmail-lucene-java-commits-archive@lucene.apache.org Received: (qmail 36617 invoked by uid 500); 24 Jun 2009 16:20:41 -0000 Mailing-List: contact java-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-commits@lucene.apache.org Received: (qmail 36608 invoked by uid 99); 24 Jun 2009 16:20:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jun 2009 16:20:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jun 2009 16:20:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6C1012388872; Wed, 24 Jun 2009 16:20:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r788070 [1/5] - in /lucene/java/trunk: docs/ docs/lucene-sandbox/ docs/skin/ docs/skin/images/ src/site/ src/site/src/documentation/ src/site/src/documentation/skins/ src/site/src/documentation/skins/common/ src/site/src/documentation/skins... Date: Wed, 24 Jun 2009 16:20:02 -0000 To: java-commits@lucene.apache.org From: gsingers@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090624162005.6C1012388872@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gsingers Date: Wed Jun 24 16:20:00 2009 New Revision: 788070 URL: http://svn.apache.org/viewvc?rev=788070&view=rev Log: LUCENE-1706: Lucene powered search for the site Added: lucene/java/trunk/src/site/src/documentation/skins/ lucene/java/trunk/src/site/src/documentation/skins/common/ lucene/java/trunk/src/site/src/documentation/skins/common/css/ lucene/java/trunk/src/site/src/documentation/skins/common/css/forrest.css.xslt lucene/java/trunk/src/site/src/documentation/skins/common/images/ lucene/java/trunk/src/site/src/documentation/skins/common/images/README.txt lucene/java/trunk/src/site/src/documentation/skins/common/images/corner-imports.svg.xslt lucene/java/trunk/src/site/src/documentation/skins/common/images/dc.svg.xslt lucene/java/trunk/src/site/src/documentation/skins/common/images/poddoc.svg.xslt lucene/java/trunk/src/site/src/documentation/skins/common/images/rc.svg.xslt lucene/java/trunk/src/site/src/documentation/skins/common/images/txtdoc.svg.xslt lucene/java/trunk/src/site/src/documentation/skins/common/scripts/ lucene/java/trunk/src/site/src/documentation/skins/common/scripts/breadcrumbs-optimized.js lucene/java/trunk/src/site/src/documentation/skins/common/scripts/breadcrumbs.js lucene/java/trunk/src/site/src/documentation/skins/common/scripts/fontsize.js lucene/java/trunk/src/site/src/documentation/skins/common/scripts/getBlank.js lucene/java/trunk/src/site/src/documentation/skins/common/scripts/getMenu.js lucene/java/trunk/src/site/src/documentation/skins/common/scripts/menu.js lucene/java/trunk/src/site/src/documentation/skins/common/scripts/prototype.js lucene/java/trunk/src/site/src/documentation/skins/common/skinconf.xsl lucene/java/trunk/src/site/src/documentation/skins/common/translations/ lucene/java/trunk/src/site/src/documentation/skins/common/translations/CommonMessages_de.xml lucene/java/trunk/src/site/src/documentation/skins/common/translations/CommonMessages_en_US.xml lucene/java/trunk/src/site/src/documentation/skins/common/translations/CommonMessages_es.xml lucene/java/trunk/src/site/src/documentation/skins/common/translations/CommonMessages_fr.xml lucene/java/trunk/src/site/src/documentation/skins/common/xslt/ lucene/java/trunk/src/site/src/documentation/skins/common/xslt/fo/ lucene/java/trunk/src/site/src/documentation/skins/common/xslt/fo/document-to-fo.xsl lucene/java/trunk/src/site/src/documentation/skins/common/xslt/fo/footerinfo.xsl lucene/java/trunk/src/site/src/documentation/skins/common/xslt/fo/pdfoutline.xsl lucene/java/trunk/src/site/src/documentation/skins/common/xslt/html/ lucene/java/trunk/src/site/src/documentation/skins/common/xslt/html/book-to-menu.xsl lucene/java/trunk/src/site/src/documentation/skins/common/xslt/html/document-to-html.xsl lucene/java/trunk/src/site/src/documentation/skins/common/xslt/html/dotdots.xsl lucene/java/trunk/src/site/src/documentation/skins/common/xslt/html/pathutils.xsl lucene/java/trunk/src/site/src/documentation/skins/common/xslt/html/renderlogo.xsl lucene/java/trunk/src/site/src/documentation/skins/common/xslt/html/site-to-xhtml.xsl lucene/java/trunk/src/site/src/documentation/skins/common/xslt/html/split.xsl lucene/java/trunk/src/site/src/documentation/skins/common/xslt/html/strip_namespaces.xsl lucene/java/trunk/src/site/src/documentation/skins/common/xslt/html/tab-to-menu.xsl lucene/java/trunk/src/site/src/documentation/skins/common/xslt/html/tabutils.xsl lucene/java/trunk/src/site/src/documentation/skins/common/xslt/svg/ lucene/java/trunk/src/site/src/documentation/skins/common/xslt/svg/document-to-svg.xsl lucene/java/trunk/src/site/src/documentation/skins/lucene/ lucene/java/trunk/src/site/src/documentation/skins/lucene/css/ lucene/java/trunk/src/site/src/documentation/skins/lucene/css/basic.css lucene/java/trunk/src/site/src/documentation/skins/lucene/css/print.css lucene/java/trunk/src/site/src/documentation/skins/lucene/css/profile.css.xslt lucene/java/trunk/src/site/src/documentation/skins/lucene/css/screen.css lucene/java/trunk/src/site/src/documentation/skins/lucene/note.txt lucene/java/trunk/src/site/src/documentation/skins/lucene/skinconf.xsl lucene/java/trunk/src/site/src/documentation/skins/lucene/xslt/ lucene/java/trunk/src/site/src/documentation/skins/lucene/xslt/fo/ lucene/java/trunk/src/site/src/documentation/skins/lucene/xslt/fo/document-to-fo.xsl lucene/java/trunk/src/site/src/documentation/skins/lucene/xslt/html/ lucene/java/trunk/src/site/src/documentation/skins/lucene/xslt/html/book-to-menu.xsl lucene/java/trunk/src/site/src/documentation/skins/lucene/xslt/html/document-to-html.xsl lucene/java/trunk/src/site/src/documentation/skins/lucene/xslt/html/site-to-xhtml.xsl lucene/java/trunk/src/site/src/documentation/skins/lucene/xslt/html/tab-to-menu.xsl Modified: lucene/java/trunk/docs/benchmarks.html lucene/java/trunk/docs/broken-links.xml lucene/java/trunk/docs/contributions.html lucene/java/trunk/docs/demo.html lucene/java/trunk/docs/demo2.html lucene/java/trunk/docs/demo3.html lucene/java/trunk/docs/demo4.html lucene/java/trunk/docs/fileformats.html lucene/java/trunk/docs/gettingstarted.html lucene/java/trunk/docs/index.html lucene/java/trunk/docs/linkmap.html lucene/java/trunk/docs/lucene-sandbox/index.html lucene/java/trunk/docs/queryparsersyntax.html lucene/java/trunk/docs/scoring.html lucene/java/trunk/docs/skin/images/corner-imports.svg.xslt lucene/java/trunk/docs/skin/images/dc.svg.xslt lucene/java/trunk/docs/skin/images/pdfdoc.gif lucene/java/trunk/docs/skin/images/poddoc.svg.xslt lucene/java/trunk/docs/skin/images/printer.gif lucene/java/trunk/docs/skin/images/rc.svg.xslt lucene/java/trunk/docs/skin/images/txtdoc.svg.xslt lucene/java/trunk/docs/skin/images/xmldoc.gif lucene/java/trunk/docs/skin/skinconf.xsl lucene/java/trunk/src/site/forrest.properties lucene/java/trunk/src/site/src/documentation/skinconf.xml Modified: lucene/java/trunk/docs/benchmarks.html URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/benchmarks.html?rev=788070&r1=788069&r2=788070&view=diff ============================================================================== --- lucene/java/trunk/docs/benchmarks.html (original) +++ lucene/java/trunk/docs/benchmarks.html Wed Jun 24 16:20:00 2009 @@ -4,7 +4,7 @@ - + Apache Lucene - Resources - Performance Benchmarks @@ -49,10 +49,12 @@ |start Search +--> - - - - - - - - - - - - 0 - - - - fill:; - fill:; - stroke:; - - - - - - - - + + + + + + + + + + + + + 0 + + + + + + fill:; + + + fill:; + + + stroke:; + + + + + - - - - 1 - -1 - - - - - - 1 - -1 - - - - - - 0 - - - - - - - - 0 - - - - - - - - - - - - - + + + 1 + -1 + + + + + 1 + -1 + + + + + 0 + - + + + + + + 0 + - + + + + + + + + + - - - + + - - + + - - - Modified: lucene/java/trunk/docs/skin/images/dc.svg.xslt URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/skin/images/dc.svg.xslt?rev=788070&r1=788069&r2=788070&view=diff ============================================================================== --- lucene/java/trunk/docs/skin/images/dc.svg.xslt (original) +++ lucene/java/trunk/docs/skin/images/dc.svg.xslt Wed Jun 24 16:20:00 2009 @@ -1,11 +1,11 @@ - - + - - - + + - + - - Modified: lucene/java/trunk/docs/skin/images/pdfdoc.gif URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/skin/images/pdfdoc.gif?rev=788070&r1=788069&r2=788070&view=diff ============================================================================== Binary files - no diff available. Modified: lucene/java/trunk/docs/skin/images/poddoc.svg.xslt URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/skin/images/poddoc.svg.xslt?rev=788070&r1=788069&r2=788070&view=diff ============================================================================== --- lucene/java/trunk/docs/skin/images/poddoc.svg.xslt (original) +++ lucene/java/trunk/docs/skin/images/poddoc.svg.xslt Wed Jun 24 16:20:00 2009 @@ -1,11 +1,11 @@ - - + - - + - + - - Modified: lucene/java/trunk/docs/skin/images/txtdoc.svg.xslt URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/skin/images/txtdoc.svg.xslt?rev=788070&r1=788069&r2=788070&view=diff ============================================================================== --- lucene/java/trunk/docs/skin/images/txtdoc.svg.xslt (original) +++ lucene/java/trunk/docs/skin/images/txtdoc.svg.xslt Wed Jun 24 16:20:00 2009 @@ -1,11 +1,11 @@ - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: lucene/java/trunk/src/site/forrest.properties URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/site/forrest.properties?rev=788070&r1=788069&r2=788070&view=diff ============================================================================== --- lucene/java/trunk/src/site/forrest.properties (original) +++ lucene/java/trunk/src/site/forrest.properties Wed Jun 24 16:20:00 2009 @@ -26,7 +26,7 @@ # Specifies name of Forrest skin to use # See list at http://forrest.apache.org/docs/skins.html -#project.skin=pelt +project.skin=lucene # Descriptors for plugins and skins # comma separated list, file:// is supported Modified: lucene/java/trunk/src/site/src/documentation/skinconf.xml URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/site/src/documentation/skinconf.xml?rev=788070&r1=788069&r2=788070&view=diff ============================================================================== --- lucene/java/trunk/src/site/src/documentation/skinconf.xml (original) +++ lucene/java/trunk/src/site/src/documentation/skinconf.xml Wed Jun 24 16:20:00 2009 @@ -30,7 +30,7 @@ no search box. @domain will enable sitesearch for the specific domain with google. In other words google will search the @domain for the query string. --> - + true Added: lucene/java/trunk/src/site/src/documentation/skins/common/css/forrest.css.xslt URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/site/src/documentation/skins/common/css/forrest.css.xslt?rev=788070&view=auto ============================================================================== --- lucene/java/trunk/src/site/src/documentation/skins/common/css/forrest.css.xslt (added) +++ lucene/java/trunk/src/site/src/documentation/skins/common/css/forrest.css.xslt Wed Jun 24 16:20:00 2009 @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + +/* ==================== aural ============================ */ + +@media aural { + h1, h2, h3, h4, h5, h6 { voice-family: paul, male; stress: 20; richness: 90 } + h1 { pitch: x-low; pitch-range: 90 } + h2 { pitch: x-low; pitch-range: 80 } + h3 { pitch: low; pitch-range: 70 } + h4 { pitch: medium; pitch-range: 60 } + h5 { pitch: medium; pitch-range: 50 } + h6 { pitch: medium; pitch-range: 40 } + li, dt, dd { pitch: medium; richness: 60 } + dt { stress: 80 } + pre, code, tt { pitch: medium; pitch-range: 0; stress: 0; richness: 80 } + em { pitch: medium; pitch-range: 60; stress: 60; richness: 50 } + strong { pitch: medium; pitch-range: 60; stress: 90; richness: 90 } + dfn { pitch: high; pitch-range: 60; stress: 60 } + s, strike { richness: 0 } + i { pitch: medium; pitch-range: 60; stress: 60; richness: 50 } + b { pitch: medium; pitch-range: 60; stress: 90; richness: 90 } + u { richness: 0 } + + :link { voice-family: harry, male } + :visited { voice-family: betty, female } + :active { voice-family: betty, female; pitch-range: 80; pitch: x-high } +} + + +a.external { + padding: 0 20px 0px 0px; + display:inline; + background-repeat: no-repeat; + background-position: center right; + background-image: url(images/external-link.gif); +} + + +/* extra-css */ + + + + + Added: lucene/java/trunk/src/site/src/documentation/skins/common/images/README.txt URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/site/src/documentation/skins/common/images/README.txt?rev=788070&view=auto ============================================================================== --- lucene/java/trunk/src/site/src/documentation/skins/common/images/README.txt (added) +++ lucene/java/trunk/src/site/src/documentation/skins/common/images/README.txt Wed Jun 24 16:20:00 2009 @@ -0,0 +1 @@ +The images in this directory are used if the current skin lacks them. Added: lucene/java/trunk/src/site/src/documentation/skins/common/images/corner-imports.svg.xslt URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/site/src/documentation/skins/common/images/corner-imports.svg.xslt?rev=788070&view=auto ============================================================================== --- lucene/java/trunk/src/site/src/documentation/skins/common/images/corner-imports.svg.xslt (added) +++ lucene/java/trunk/src/site/src/documentation/skins/common/images/corner-imports.svg.xslt Wed Jun 24 16:20:00 2009 @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + 0 + + + + + + fill:; + + + fill:; + + + stroke:; + + + + + + + + + 1 + -1 + + + + + 1 + -1 + + + + + 0 + - + + + + + + 0 + - + + + + + + + + + + + + + + + + + + + Added: lucene/java/trunk/src/site/src/documentation/skins/common/images/dc.svg.xslt URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/site/src/documentation/skins/common/images/dc.svg.xslt?rev=788070&view=auto ============================================================================== --- lucene/java/trunk/src/site/src/documentation/skins/common/images/dc.svg.xslt (added) +++ lucene/java/trunk/src/site/src/documentation/skins/common/images/dc.svg.xslt Wed Jun 24 16:20:00 2009 @@ -0,0 +1,28 @@ + + + + + + + + + + + + Added: lucene/java/trunk/src/site/src/documentation/skins/common/images/poddoc.svg.xslt URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/site/src/documentation/skins/common/images/poddoc.svg.xslt?rev=788070&view=auto ============================================================================== --- lucene/java/trunk/src/site/src/documentation/skins/common/images/poddoc.svg.xslt (added) +++ lucene/java/trunk/src/site/src/documentation/skins/common/images/poddoc.svg.xslt Wed Jun 24 16:20:00 2009 @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + POD + + + Added: lucene/java/trunk/src/site/src/documentation/skins/common/images/rc.svg.xslt URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/site/src/documentation/skins/common/images/rc.svg.xslt?rev=788070&view=auto ============================================================================== --- lucene/java/trunk/src/site/src/documentation/skins/common/images/rc.svg.xslt (added) +++ lucene/java/trunk/src/site/src/documentation/skins/common/images/rc.svg.xslt Wed Jun 24 16:20:00 2009 @@ -0,0 +1,27 @@ + + + + + + + + + + + Added: lucene/java/trunk/src/site/src/documentation/skins/common/images/txtdoc.svg.xslt URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/site/src/documentation/skins/common/images/txtdoc.svg.xslt?rev=788070&view=auto ============================================================================== --- lucene/java/trunk/src/site/src/documentation/skins/common/images/txtdoc.svg.xslt (added) +++ lucene/java/trunk/src/site/src/documentation/skins/common/images/txtdoc.svg.xslt Wed Jun 24 16:20:00 2009 @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + TXT + + + Added: lucene/java/trunk/src/site/src/documentation/skins/common/scripts/breadcrumbs-optimized.js URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/site/src/documentation/skins/common/scripts/breadcrumbs-optimized.js?rev=788070&view=auto ============================================================================== --- lucene/java/trunk/src/site/src/documentation/skins/common/scripts/breadcrumbs-optimized.js (added) +++ lucene/java/trunk/src/site/src/documentation/skins/common/scripts/breadcrumbs-optimized.js Wed Jun 24 16:20:00 2009 @@ -0,0 +1,90 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +var PREPREND_CRUMBS=new Array(); +var link1="@skinconfig.trail.link1.name@"; +var link2="@skinconfig.trail.link2.name@"; +var link3="@skinconfig.trail.link3.name@"; +if(!(link1=="")&&!link1.indexOf( "@" ) == 0){ + PREPREND_CRUMBS.push( new Array( link1, @skinconfig.trail.link1.href@ ) ); } +if(!(link2=="")&&!link2.indexOf( "@" ) == 0){ + PREPREND_CRUMBS.push( new Array( link2, @skinconfig.trail.link2.href@ ) ); } +if(!(link3=="")&&!link3.indexOf( "@" ) == 0){ + PREPREND_CRUMBS.push( new Array( link3, @skinconfig.trail.link3.href@ ) ); } +var DISPLAY_SEPARATOR=" > "; +var DISPLAY_PREPREND=" > "; +var DISPLAY_POSTPREND=":"; +var CSS_CLASS_CRUMB="breadcrumb"; +var CSS_CLASS_TRAIL="breadcrumbTrail"; +var CSS_CLASS_SEPARATOR="crumbSeparator"; +var FILE_EXTENSIONS=new Array( ".html", ".htm", ".jsp", ".php", ".php3", ".php4" ); +var PATH_SEPARATOR="/"; + +function sc(s) { + var l=s.toLowerCase(); + return l.substr(0,1).toUpperCase()+l.substr(1); +} +function getdirs() { + var t=document.location.pathname.split(PATH_SEPARATOR); + var lc=t[t.length-1]; + for(var i=0;i < FILE_EXTENSIONS.length;i++) + { + if(lc.indexOf(FILE_EXTENSIONS[i])) + return t.slice(1,t.length-1); } + return t.slice(1,t.length); +} +function getcrumbs( d ) +{ + var pre = "/"; + var post = "/"; + var c = new Array(); + if( d != null ) + { + for(var i=0;i < d.length;i++) { + pre+=d[i]+postfix; + c.push(new Array(d[i],pre)); } + } + if(PREPREND_CRUMBS.length > 0 ) + return PREPREND_CRUMBS.concat( c ); + return c; +} +function gettrail( c ) +{ + var h=DISPLAY_PREPREND; + for(var i=0;i < c.length;i++) + { + h+=''+sc(c[i][0])+''; + if(i!=(c.length-1)) + h+=DISPLAY_SEPARATOR; } + return h+DISPLAY_POSTPREND; +} + +function gettrailXHTML( c ) +{ + var h=''+DISPLAY_PREPREND; + for(var i=0;i < c.length;i++) + { + h+=''+sc(c[i][0])+''; + if(i!=(c.length-1)) + h+=''+DISPLAY_SEPARATOR+''; } + return h+DISPLAY_POSTPREND+''; +} + +if(document.location.href.toLowerCase().indexOf("http://")==-1) + document.write(gettrail(getcrumbs())); +else + document.write(gettrail(getcrumbs(getdirs()))); + Added: lucene/java/trunk/src/site/src/documentation/skins/common/scripts/breadcrumbs.js URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/site/src/documentation/skins/common/scripts/breadcrumbs.js?rev=788070&view=auto ============================================================================== --- lucene/java/trunk/src/site/src/documentation/skins/common/scripts/breadcrumbs.js (added) +++ lucene/java/trunk/src/site/src/documentation/skins/common/scripts/breadcrumbs.js Wed Jun 24 16:20:00 2009 @@ -0,0 +1,237 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * This script, when included in a html file, builds a neat breadcrumb trail + * based on its url. That is, if it doesn't contains bugs (I'm relatively + * sure it does). + * + * Typical usage: + * + */ + +/** + * IE 5 on Mac doesn't know Array.push. + * + * Implement it - courtesy to fritz. + */ +var abc = new Array(); +if (!abc.push) { + Array.prototype.push = function(what){this[this.length]=what} +} + +/* ======================================================================== + CONSTANTS + ======================================================================== */ + +/** + * Two-dimensional array containing extra crumbs to place at the front of + * the trail. Specify first the name of the crumb, then the URI that belongs + * to it. You'll need to modify this for every domain or subdomain where + * you use this script (you can leave it as an empty array if you wish) + */ +var PREPREND_CRUMBS = new Array(); + +var link1 = "@skinconfig.trail.link1.name@"; +var link2 = "@skinconfig.trail.link2.name@"; +var link3 = "@skinconfig.trail.link3.name@"; + +var href1 = "@skinconfig.trail.link1.href@"; +var href2 = "@skinconfig.trail.link2.href@"; +var href3 = "@skinconfig.trail.link3.href@"; + + if(!(link1=="")&&!link1.indexOf( "@" ) == 0){ + PREPREND_CRUMBS.push( new Array( link1, href1 ) ); + } + if(!(link2=="")&&!link2.indexOf( "@" ) == 0){ + PREPREND_CRUMBS.push( new Array( link2, href2 ) ); + } + if(!(link3=="")&&!link3.indexOf( "@" ) == 0){ + PREPREND_CRUMBS.push( new Array( link3, href3 ) ); + } + +/** + * String to include between crumbs: + */ +var DISPLAY_SEPARATOR = " > "; +/** + * String to include at the beginning of the trail + */ +var DISPLAY_PREPREND = " > "; +/** + * String to include at the end of the trail + */ +var DISPLAY_POSTPREND = ""; + +/** + * CSS Class to use for a single crumb: + */ +var CSS_CLASS_CRUMB = "breadcrumb"; + +/** + * CSS Class to use for the complete trail: + */ +var CSS_CLASS_TRAIL = "breadcrumbTrail"; + +/** + * CSS Class to use for crumb separator: + */ +var CSS_CLASS_SEPARATOR = "crumbSeparator"; + +/** + * Array of strings containing common file extensions. We use this to + * determine what part of the url to ignore (if it contains one of the + * string specified here, we ignore it). + */ +var FILE_EXTENSIONS = new Array( ".html", ".htm", ".jsp", ".php", ".php3", ".php4" ); + +/** + * String that separates parts of the breadcrumb trail from each other. + * When this is no longer a slash, I'm sure I'll be old and grey. + */ +var PATH_SEPARATOR = "/"; + +/* ======================================================================== + UTILITY FUNCTIONS + ======================================================================== */ +/** + * Capitalize first letter of the provided string and return the modified + * string. + */ +function sentenceCase( string ) +{ return string; + //var lower = string.toLowerCase(); + //return lower.substr(0,1).toUpperCase() + lower.substr(1); +} + +/** + * Returns an array containing the names of all the directories in the + * current document URL + */ +function getDirectoriesInURL() +{ + var trail = document.location.pathname.split( PATH_SEPARATOR ); + + // check whether last section is a file or a directory + var lastcrumb = trail[trail.length-1]; + for( var i = 0; i < FILE_EXTENSIONS.length; i++ ) + { + if( lastcrumb.indexOf( FILE_EXTENSIONS[i] ) ) + { + // it is, remove it and send results + return trail.slice( 1, trail.length-1 ); + } + } + + // it's not; send the trail unmodified + return trail.slice( 1, trail.length ); +} + +/* ======================================================================== + BREADCRUMB FUNCTIONALITY + ======================================================================== */ +/** + * Return a two-dimensional array describing the breadcrumbs based on the + * array of directories passed in. + */ +function getBreadcrumbs( dirs ) +{ + var prefix = "/"; + var postfix = "/"; + + // the array we will return + var crumbs = new Array(); + + if( dirs != null ) + { + for( var i = 0; i < dirs.length; i++ ) + { + prefix += dirs[i] + postfix; + crumbs.push( new Array( dirs[i], prefix ) ); + } + } + + // preprend the PREPREND_CRUMBS + if(PREPREND_CRUMBS.length > 0 ) + { + return PREPREND_CRUMBS.concat( crumbs ); + } + + return crumbs; +} + +/** + * Return a string containing a simple text breadcrumb trail based on the + * two-dimensional array passed in. + */ +function getCrumbTrail( crumbs ) +{ + var xhtml = DISPLAY_PREPREND; + + for( var i = 0; i < crumbs.length; i++ ) + { + xhtml += ''; + xhtml += unescape( crumbs[i][0] ) + ''; + if( i != (crumbs.length-1) ) + { + xhtml += DISPLAY_SEPARATOR; + } + } + + xhtml += DISPLAY_POSTPREND; + + return xhtml; +} + +/** + * Return a string containing an XHTML breadcrumb trail based on the + * two-dimensional array passed in. + */ +function getCrumbTrailXHTML( crumbs ) +{ + var xhtml = ''; + xhtml += DISPLAY_PREPREND; + + for( var i = 0; i < crumbs.length; i++ ) + { + xhtml += ''; + xhtml += unescape( crumbs[i][0] ) + ''; + if( i != (crumbs.length-1) ) + { + xhtml += '' + DISPLAY_SEPARATOR + ''; + } + } + + xhtml += DISPLAY_POSTPREND; + xhtml += ''; + + return xhtml; +} + +/* ======================================================================== + PRINT BREADCRUMB TRAIL + ======================================================================== */ + +// check if we're local; if so, only print the PREPREND_CRUMBS +if( document.location.href.toLowerCase().indexOf( "http://" ) == -1 ) +{ + document.write( getCrumbTrail( getBreadcrumbs() ) ); +} +else +{ + document.write( getCrumbTrail( getBreadcrumbs( getDirectoriesInURL() ) ) ); +} +