RSS Git Download  Clone
Raw Blame History
<!-- BEGIN site/header.tt -->

[% action_links = [
		{ label => 'Search',	permission => 'search',         ico => 'search' }
		{ label => 'Register',	permission => 'register',       ico => 'person' }
		{ label => 'WorkList',  permission => [
				'modify_results', 
				'view_worklist', 
				'update_worklist',
			], ico => 'note' }
		{ label => 'PrintRun',	permission => 'print_all',      ico => 'print' }		
		{ label => 'Resources',	permission => 'search',         ico => 'scissors' }
		{ label => 'Messages',	permission => 'search',         ico => 'email' }
		{ label => 'Admin',		permission => 'do_admin',       ico => 'wrench' }
	];
	
	IF site_settings.have_hmrn;
		action_links.push({ permission => 'hmrn_admin', label => 'HMRN', ico => 'foo' });
	END;
	IF c.is_lab_staff; # allow all lab-staff to view dashboard (set permission = search)
		action_links.push({ permission => 'search', label => 'Dashboard', ico => 'foo' });
	END;
	# PROCESS dumper.tt dump = active_link;
%]
	
<table id="nav">
	<tbody>
		<tr>
		[% IF c.authen.username; user = c.session.param('UserProfile') %]
			<td>
				<span style="padding: 0 5px">&nbsp;</span>
				
			  [% UNLESS c.is_lab_staff %]
				<div id="home" style="padding: 0 1px; display: inline">
					<a href="[% app_url %]/login/hello" class="ui-corner-top">
						<i class="fa fa-home fa-lg"></i>
					</a>
				</div>
			  [% END %]
			
			  [% FOREACH action_links;
				NEXT UNLESS c.user_can(permission);
				re = '(?i)' _ label; # see VMethods
				matches = active_link.match(re);
				# admin tab on its own:
				NEXT IF active_link.match('admin') AND label != 'Admin';
			  %]
				<div style="padding: 0 1px; display: inline">                    
					<a href="[% app_url %]/[% label | lower %]" class="ui-corner-top"					    
					    [% IF matches %]id="selected"[% END %]
						[% IF label.match('^Admin$') # use 'new' to force same window each time: %]
                            target="_new"[% END %]>
						[% label %] 
					</a>
                    [% IF this_ever_works %]
                    <span class="ui-icon-white ui-icon-[% ico %]"></span>
                    [% END %]
				</div>
			  [% END %]
				<span id="userid" class="ui-corner-top">
					[% user.first_name | ucfirst %] [% user.last_name | ucfirst %]
				</span>
				<span id="logout">
					[% IF active_link.match('admin') %]
						[<a href="javascript: self.close ()">close window</a>]
					[% ELSE %]
						[<a href="[% app_url %]/logout">log out</a>]
					[% END %]
				</span>
			</td>
		[% END %]

			<td id="logo">
				<img src="/images/[% site_settings.logo_image %]" alt="logo" />
			</td>
		</tr>
	</tbody>
</table>
<div id="title">
  <p>
    [% c.cfg('settings').application_name %] &raquo; [% # my.meta_title defined in .tt:
		template.title || my.meta_title || action | ucfirst %]
    <span id="runtime">runtime: %SCRIPTRUNTIMER%</span>
	<span id="datetime">
		[% USE date(format = '%a %d %B %Y @ %R', locale = 'en_GB');
			date.format # time.strftime('%a %d %B %Y @ %R %Z') %]
	</span>
  </p>
</div>
<!-- END site/header.tt -->