From: Mike Cardwell Date: Wed, 7 Sep 2011 11:55:07 +0000 (+0100) Subject: Display a warning to the user if they're viewing old versions of the X-Git-Tag: exim-4_89_1~56 X-Git-Url: https://git.exim.org/exim-website.git/commitdiff_plain/7e380e72021a4fcc57295367a71f14176343ad23?ds=sidebyside Display a warning to the user if they're viewing old versions of the documentation --- diff --git a/script/gen.pl b/script/gen.pl index edbaa93..3cf3acd 100755 --- a/script/gen.pl +++ b/script/gen.pl @@ -111,6 +111,13 @@ sub do_doc { ->appendTextChild( 'canonical_url', "${canonical_url}exim-html-current/doc/html/spec_html/" . ( $type eq 'spec' ? 'index' : 'filter' ) . ".html" ); + ## Add a url for the latest version of this document + if( $version ne $opt{latest} ){ + $xml->documentElement() + ->appendTextChild( 'current_url', + "../../../../exim-html-current/doc/html/spec_html/" . ( $type eq 'spec' ? 'index' : 'filter' ) . ".html" ); + } + ## Fixup the XML xref_fixup( $xml, $prepend_chapter ); @@ -153,6 +160,15 @@ sub do_doc { $prepend_chapter, $counter ) ); + if( $version ne $opt{latest} ){ + $chapter->appendTextChild( + 'current_url', + sprintf( + '../../../../exim-html-current/doc/html/spec_html/%sch%02d.html', + $prepend_chapter, $counter + ) + ); + } } ## Create an XML document from the chapter diff --git a/templates/doc/chapter.xsl b/templates/doc/chapter.xsl index 6fd6d8c..06d9eb9 100644 --- a/templates/doc/chapter.xsl +++ b/templates/doc/chapter.xsl @@ -48,6 +48,16 @@
+ +

+ X + WARNING: + This documentation is for an old version of Exim ( + latest + ) +

+
+

@@ -97,6 +107,6 @@ - + diff --git a/templates/doc/index.xsl b/templates/doc/index.xsl index d76fa1d..8e08d4a 100644 --- a/templates/doc/index.xsl +++ b/templates/doc/index.xsl @@ -30,13 +30,21 @@ + +

+ WARNING: + This documentation is for an old version of Exim ( + latest + ) +

+
    diff --git a/templates/web/doc/chapter.css b/templates/web/doc/chapter.css index 1565158..3eab804 100644 --- a/templates/web/doc/chapter.css +++ b/templates/web/doc/chapter.css @@ -1,3 +1,38 @@ +#old_version_warning { + text-align: center; + padding: 0.1em; + margin: 0; + font-size: 1.4em; +} + +body.with-js #old_version_warning { + display: none; + text-align: left; + position: fixed; + top: 20%; + left: 30%; + width: 40%; + background-color: #fff; + border: 1px solid #000; + padding: 1em; + z-index: 10000; +} + +#old_version_warning span.closebar { + float: right; + position: relative; + right: -0.5em; + top: -0.5em; +} + +#old_version_warning span.closebar a { + text-decoration: none; +} + +body.no-js #old_version_warning span.closebar { + display: none; +} + .previous_page, .next_page { font-size: 1.2em; } diff --git a/templates/web/doc/chapter.js b/templates/web/doc/chapter.js index 988bf6a..add4bd3 100644 --- a/templates/web/doc/chapter.js +++ b/templates/web/doc/chapter.js @@ -1,3 +1,17 @@ +// Warnings about reading old version of documentation +(function ($) { + if( $.grep( document.cookie.split(/\s*;\s*/), function(a){return a === 'old_version_warning_removed=true' ? true : false }).length === 0 ){ + $('#old_version_warning') + .show() + .find('span.closebar a') + .click(function(e){ + $('#old_version_warning').remove(); + document.cookie="old_version_warning_removed=true"; + e.preventDefault(); + }); + } +})(jQuery); + // Sidebar table of contents (function ($) { diff --git a/templates/web/doc/index.css b/templates/web/doc/index.css index eff4aa3..63ea01f 100644 --- a/templates/web/doc/index.css +++ b/templates/web/doc/index.css @@ -1,3 +1,10 @@ +#old_version_warning { + text-align: center; + padding: 0.1em; + margin: 0; + font-size: 1.4em; +} + #options { padding: 1em 0 0 2em; } diff --git a/templates/wrapper.xsl b/templates/wrapper.xsl index a1cfa68..ecd810e 100644 --- a/templates/wrapper.xsl +++ b/templates/wrapper.xsl @@ -40,7 +40,10 @@ - + + + +