Git Repositories

First step to using Bootstrap.
[simple-git-host.git] / src / nav.inc.php
1 <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
2   <div class="container">
3     <div class="navbar-header">
4       <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
5         <span class="sr-only">Toggle navigation</span>
6         <span class="icon-bar"></span>
7         <span class="icon-bar"></span>
8         <span class="icon-bar"></span>
9       </button>
10       <a class="navbar-brand" href="/<?php echo $gitwebroot;?>"><?php echo $pageTitle; ?></a>
11     </div>
12     <div id="navbar" class="collapse navbar-collapse">
13       <ul class="nav navbar-nav">
14         <?php
15 $files = scandir($gitdir);
16 $nb = 0;
17 foreach ($files as $file) {
18   if ($file[0] == '.') continue;
19   if (is_dir("$gitdir/$file") && preg_match('/\.git$/', $file)) {
20     $nb++;
21   }
22   if ($nb == 0) {
23     $nb = '';
24   }
25 }
26         ?>
27           <li class="active"><a href="/<?php echo $gitwebroot;?>list"><span class="glyphicon glyphicon-home" aria-hidden="true"></span>&nbsp;Repositories <span class="badge"><?php echo $nb; ?></span></a></li>
28         <li><a href="#about">About</a></li>
29       </ul>
30 <?php if ($logged) { $login = $_SESSION['username']; ?>
31       <ul class="nav navbar-nav navbar-right">
32         <li class="dropdown">
33           <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><span class="glyphicon glyphicon-user" aria-hidden="true"></span>&nbsp;<?php echo $login; ?>¬†<span class="caret"></span></a>
34           <ul class="dropdown-menu inverse-dropdown" role="menu">
35             <li><a href="/<?php echo $gitwebroot;?>account"><span class="glyphicon glyphicon-wrench" aria-hidden="true"></span>&nbsp;Mon compte</a></li>
36             <li class="divider"></li>
37             <li><a href="/<?php echo $gitwebroot;?>disconnect"><span class="glyphicon glyphicon-off" aria-hidden="true"></span>&nbsp;Se d√©connecter</a></li>
38           </ul>
39         </li>
40       </ul>
41 <?php } else {
42   $haserror = $errorMsg ? 'has-error' : '';
43 ?>
44       <form class="navbar-form navbar-right" role="form" action="" method="POST">
45         <div class="form-group <?php echo $haserror; ?>">
46           <label class="sr-only" for="username">Login</label>
47           <input type="text" placeholder="Login" class="form-control" name="username" <?php if ($haserror) { echo 'aria-invalid="true"'; } ?>>
48         </div>
49         <div class="form-group <?php echo $haserror; ?>">
50           <label class="sr-only" for="password">Password</label>
51           <input type="password" placeholder="Password" class="form-control" name="password" <?php if ($haserror) { echo 'aria-invalid="true"'; } ?>>
52         </div>
53         <button type="submit" name="submit_auth" class="btn btn-success" value="1">Sign in</button>
54       </form> 
55 <?php } ?>
56     </div>
57     <?php if ($errorMsg) { ?><div class="alert alert-danger alert-dismissible pull-right" role="alert"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>&nbsp;<?php echo $errorMsg; ?><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button></div><?php } ?>
58   </div>
59 </nav>
60 <div class="container">