View source with formatted comments or as raw
    1:- module(
    2  footer,
    3  [
    4    footer//1, % +Options
    5    server_information//0
    6  ]
    7).    8
    9/** <module> Footer
   10
   11Footer for SWI-Prolog Web pages.
   12
   13@author Wouter Beek
   14@version 2014/01
   15*/
   16
   17:- use_module(library(http/html_head)).   18:- use_module(library(http/html_write)).   19:- use_module(library(http/js_write)).   20:- use_module(openid).   21:- use_module(tagit).   22:- use_module(annotation).   23
   24:- html_resource(css('footer.css'), []).   25
   26
   27'community-content'(Options) -->
   28	{ option(object(Object), Options) }, !,
   29	html(div(id='community-content',
   30		 [ \tagit_footer(Object, []),
   31		   \annotation(Object)
   32		 ])).
   33'community-content'(_) -->
   34	[].
   35
   36%%	footer(+Options)// is det.
   37%
   38%	Emit the footer, which contains   the  community content, server
   39%	address and user information. Options:
   40%
   41%	  * object(Object)
   42%	  Display community content area for Object.
   43%	  * show_user(+Boolean)
   44%	  If =false=, omit the user
   45
   46footer(Options) -->
   47	html_requires(css('footer.css')),
   48	html(div(class=footer,
   49		 [ \'community-content'(Options),
   50		   \'footer-footer'(Options)
   51		 ])),
   52	balance_columns_script.
   53
   54'footer-footer'(Options) -->
   55	html(div(id=footer,
   56		 [ \show_user(Options),
   57		   \server_information
   58		 ])).
   59
   60show_user(Options) -->
   61	{ option(show_user(false), Options) }, !.
   62show_user(_) -->
   63	current_user.
   64
   65balance_columns_script -->
   66	js_script({|javascript||
   67		   $().ready(function()
   68	           { var $navtree = $(".navwindow");
   69		     var $navcontent = $(".navcontent");
   70		     if ( $navtree.length > 0 && $navcontent.length > 0 )
   71		     { var $window = $(window).on("resize", function()
   72		       { var ch = $navcontent.height();
   73			 var nh = $navtree.height();
   74			 if ( nh > 400 && nh > ch + 200 )
   75			 { if ( ch < 300 ) ch = 300;
   76			   $navtree.height(ch);
   77			   $navtree.css('overflow-y', 'scroll');
   78
   79			   var current = $navtree.find("li.nav.current");
   80			   if ( current.position().top > ch-40 )
   81			   { $navtree.scrollTop(current.position().top - (ch-40));
   82			   }
   83			 }
   84		       }).trigger("resize")
   85		     }
   86		   });
   87		  |}).
   88
   89
   90prolog_version(Version) :-
   91  current_prolog_flag(version_git, Version), !.
   92prolog_version(Version) :-
   93  current_prolog_flag(version_data, swi(Ma,Mi,Pa,_)),
   94  format(atom(Version), '~w.~w.~w', [Ma,Mi,Pa]).
   95
   96%! server_information// is det.
   97% Emit server information.
   98
   99server_information -->
  100  {prolog_version(Version)},
  101  html(
  102    a([id=powered,href='http://www.swi-prolog.org'], [
  103      'Powered by SWI-Prolog ',
  104      Version
  105    ])
  106  )