Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

navbar.xjs 5.43 KB
Newer Older
echicken's avatar
echicken committed
1
<?xjs function subMenu(obj, title, path) { ?>
2 3
	<li class="dropdown<?xjs if (path.match(/\//g).length > 1) write('-submenu'); ?>">
		<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
echicken's avatar
echicken committed
4
			<? write(title.replace(/^.*\-/, '')); ?>
5 6 7
			<span class="caret"></span>
		</a>
		<ul class="dropdown-menu">
echicken's avatar
echicken committed
8
			<?xjs menu(obj.list, path); ?>
9 10 11 12 13
		</ul>
	</li>
<?xjs } ?>

<?xjs
14 15 16 17
	function menu(arr, path) {
		arr.forEach(function (e) {
			if (e.type == 'list') {
				subMenu(e, e.title, (path || '') + e.title + '/');
18 19 20
			} else {
?>
                <li>
21 22
                    <?xjs if (e.type == 'link') { ?>
                        <a class="dropdown-item" href="./?page=<?xjs write(e.page); ?>" target="_blank">
echicken's avatar
echicken committed
23
                    <?xjs } else { ?>
24
                        <a class="dropdown-item" href="./?page=<?xjs write((path || '') + e.page); ?>">
echicken's avatar
echicken committed
25
                    <?xjs } ?>
26
                            <? write(e.title); ?>
echicken's avatar
echicken committed
27
                        </a>
28
                </li>
echicken's avatar
echicken committed
29
<?xjs
30 31 32 33 34
            }
        });
    }
?>

35 36 37 38
<nav class="navbar navbar-default navbar-fixed-top">
    <div class="container<?xjs if (settings.layout_full_width) write('-fluid'); ?>">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
echicken's avatar
echicken committed
39
                <span class="sr-only"><? write(locale.strings.main.label_sidebar); ?></span>
40 41 42 43
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
44
            <a class="navbar-brand" href="<? write(settings.brand_link || './'); ?>"><? write(settings.brand || system.name); ?></a>
45 46 47
        </div>
        <div id="navbar" class="collapse navbar-collapse">
            <ul class="nav navbar-nav">
echicken's avatar
echicken committed
48
                <?xjs menu(getPageList(settings.web_pages)); ?>
49
            </ul>
Michael Long's avatar
Michael Long committed
50

51
            <ul class="nav navbar-nav navbar-right">
52
<?xjs if (settings.darkmode_allow) { ?>	            
Michael Long's avatar
Michael Long committed
53 54 55 56
				<li class="nav-item dark-switch">
					<div class="form-group">
						<div class="checkbox checbox-switch darkswitchbox">
							<label>
57
								<input type="checkbox" id="darkSwitch" <? write(settings.darkmode_on ? 'checked' : '') ?> />Dark
Michael Long's avatar
Michael Long committed
58 59 60 61 62
								<span></span>
							</label>
              			</div>
              		</div>
            	</li>
63
<?xjs } ?>            	
Michael Long's avatar
Michael Long committed
64
            	<?xjs if (user.alias === settings.guest || user.number < 1) { ?>
65 66
                    <?xjs if (settings.user_registration) { ?>
                        <li>
echicken's avatar
echicken committed
67
                            <a href="./?page=000-register.xjs"><? write(locale.strings.main.menu_item_register); ?></a>
68 69 70 71
                        </li>
                    <?xjs } ?>
                    <li class="nav-item dropdown">
                        <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
echicken's avatar
echicken committed
72
                            <? write(locale.strings.main.menu_item_login); ?>
73 74 75 76
                            <span class="caret"></span>
                        </a>
                        <div id="login-form" class="dropdown-menu" style="padding:15px; padding-bottom:0px;">
                            <form id="form-login">
echicken's avatar
echicken committed
77 78 79 80 81
                                <label for="input-username" class="sr-only"><? write(locale.strings.main.input_username); ?></label>
                                <input id="input-username" title="<? write(locale.strings.main.input_username); ?>" type="text" class="dropdown form-control" placeholder="<? write(locale.strings.main.input_username); ?>">
                                <label for="input-password" class="sr-only"><? write(locale.strings.main.input_password); ?></label>
                                <input id="input-password" title="<? write(locale.strings.main.input_password); ?>" type="password" class="dropdown form-control" placeholder="<? write(locale.strings.main.input_password); ?>">
                                <input id="button-login" class="dropdown btn btn-primary" type="submit" value="<? write(locale.strings.main.button_login); ?>">
82 83 84 85 86 87
                            </form>
                        </div>
                    </li>
                <?xjs } else { ?>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
echicken's avatar
echicken committed
88
                            <? write(user.alias); ?>
89 90 91 92 93 94
                            <span class="badge scanned" title="Unread mail" id="badge-unread-mail"></span>
                            <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu">
                            <li>
                                <a href="./?page=000-mail.xjs">
echicken's avatar
echicken committed
95
                                    <? write(locale.strings.main.menu_item_mail); ?>
96 97 98 99
                                    <span class="badge scanned" title="<?xjs write(locale.strings.main.label_unread_mail); ?>" id="badge-unread-mail-inner"></span>
                                </a>
                            </li>
                            <li>
echicken's avatar
echicken committed
100
                                <a id="button-logout" href="#"><? write(locale.strings.main.menu_item_logout); ?></a>
101 102 103 104 105 106 107 108
                            </li>
                        </ul>
                    </li>
                <?xjs } ?>
            </ul>
        </div>
    </div>
</nav>