head.inc 4.65 KB
Newer Older
Ad Schellevis's avatar
Ad Schellevis committed
1 2
<?php

3 4
function system_get_language_code() {
	global $config;
5
	$code = "en-US"; // Set default code.
6 7

	// a language code, as per [RFC3066]
8 9 10
	if (isset($config['system']['language'])) {
		$language = $config['system']['language'];
		$code = str_replace("_", "-", $language);
11
	}
12 13 14 15 16

	return $code;
}


Ad Schellevis's avatar
Ad Schellevis committed
17 18 19 20
$g['theme'] = get_current_theme();

$pagetitle = gentitle( $pgtitle );

21
?><!doctype html>
22 23 24 25
<!--[if IE 8 ]><html lang="<?=system_get_language_code();?>" class="ie ie8 lte9 lte8 no-js"><![endif]-->
<!--[if IE 9 ]><html lang="<?=system_get_language_code();?>" class="ie ie9 lte9 no-js"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html lang="<?=system_get_language_code();?>" class="no-js"><!--<![endif]-->
	<head>
Ad Schellevis's avatar
Ad Schellevis committed
26

27 28
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
29

30 31 32 33 34
		<meta name="robots" content="index, follow, noodp, noydir" />
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		<meta name="copyright" content="" />
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
35

36
		<title><?php echo($config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pagetitle); ?></title>
37

38 39 40
		<!-- include (theme) style -->
		<link href="/ui/themes/<?=$g['theme'];?>/build/css/main.css" media="screen, projection" rel="stylesheet">

41 42 43 44 45 46 47 48
		<!-- TODO: move to theme style -->
		<style>
			.menu-level-3-item {
				font-size: 90%;
				padding-left: 54px !important;
			}
		</style>

49
		<!-- Favicon -->
50 51 52 53 54 55 56 57
		<link href="/ui/themes/<?=$g['theme'];?>/build/images/favicon.png" rel="shortcut icon">

		<!-- Stylesheet for fancy select/dropdown -->
		<link rel="stylesheet" type="text/css" href="/ui/themes/<?=$g['theme'];?>/build/css/bootstrap-select.css">

		<!-- bootstrap dialog -->
		<link href="/ui/themes/<?=$g['theme'];?>/build/css/bootstrap-dialog.css" rel="stylesheet" type="text/css" />

58

59 60 61
		<!-- Font awesome -->
		<link rel="stylesheet" href="/ui/css/font-awesome.min.css">

62
		<!--[if lt IE 9]><script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script><![endif]-->
63

64 65
		<!-- nvd3 -->
		<link rel="stylesheet" href="/ui/css/nv.d3.css">
66

Ad Schellevis's avatar
Ad Schellevis committed
67
		<script>var theme = '<?=$g['theme'];?>'; </script>
68

69
		<!-- JQuery -->
70
		<script type="text/javascript" src="/ui/js/jquery-1.11.2.min.js"></script>
71

72
		<!-- Ticker used for notices-->
73
		<script type="text/javascript" src="/javascript/ticker.js"></script>
74

75 76
		<!-- d3 -->
		<script type="text/javascript" src="/ui/js/d3.min.js"></script>
77

78 79
		<!-- nvd3 -->
		<script type="text/javascript" src="/ui/js/nv.d3.min.js"></script>
80

81 82 83 84 85 86
		<?php
		/*
		 *	Find all javascript files that need to be included
		 *	for this page ... from the arrays ... :)
		 *	Coded by: Erik Kristensen
		 */
87

88 89
		$dir  = trim(basename($_SERVER['SCRIPT_FILENAME'], '.php'));
		$path = '/usr/local/www/javascript/' . $dir . '/';
90 91 92
		if (is_dir($path)) {
			if ($dh = opendir($path)) {
				while (($file = readdir($dh)) !== false) {
93
					if (is_dir($file))
94 95 96 97 98 99
						continue;
					echo "\t<script type=\"text/javascript\" src=\"/javascript/{$dir}/{$file}\"></script>\n";
				}
				closedir($dh);
			}
		}
100

101
		?>
102

103
		<?php if (basename($_SERVER["SCRIPT_FILENAME"] != "index.php")): ?>
Ad Schellevis's avatar
Ad Schellevis committed
104 105
		<script type="text/javascript">
		//<![CDATA[
106 107
		$( document ).ready(function() {
			$('[data-toggle="tooltip"]').tooltip();
108
			$("input").attr("autocomplete","off");
109 110
			// hide empty menu items
			$('#mainmenu > div > .collapse').each(function(){
111 112 113 114 115 116 117 118 119
				// cleanup empty second level menu containers
				$(this).find("div.collapse").each(function(){
					if ($(this).children().length == 0 ) {
							$("#mainmenu").find('[href="#'+$(this).attr('id')+'"]').remove();
							$(this).remove();
					}
				});

				// cleanup empty first level menu items
120 121 122 123
				if ($(this).children().length == 0) {
					$("#mainmenu").find('[href="#'+$(this).attr('id')+'"]').remove();
				}
			});
124 125 126

			// link showhelp class behavior
			$("a[class='showhelp']").click(function (event) {
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
				$("*[for='" + $(this).attr('id') + "']").toggleClass("hidden show");
				event.preventDefault();
			});

			// handle all help messages show/hide
			$('[id*="show_all_help"]').click(function(event) {
				$('[id*="show_all_help"]').toggleClass("fa-toggle-on fa-toggle-off");
				$('[id*="show_all_help"]').toggleClass("text-success text-danger");
				if ($('[id*="show_all_help"]').hasClass("fa-toggle-on")) {
					$('[for*="help_for"]').addClass("show");
					$('[for*="help_for"]').removeClass("hidden");
				} else {
					$('[for*="help_for"]').addClass("hidden");
					$('[for*="help_for"]').removeClass("show");
				}
				event.preventDefault();
			});
144

145
		});
Ad Schellevis's avatar
Ad Schellevis committed
146 147 148
		//]]>
		</script>

149
		<? endif; ?>
Ad Schellevis's avatar
Ad Schellevis committed
150

151

152
<?php if (!isset($closehead) || !$closehead):?></head><? endif;?>