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

Ad Schellevis's avatar
Ad Schellevis committed
3
/*
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
    Copyright (C) 2014-2015 Deciso B.V.
    Copyright (C) 2012 Jim Pingle
    Copyright (C) 2007-2008 Scott Ullrich <sullrich@gmail.com>
    Copyright (C) 2005-2006 Colin Smith <ethethlay@gmail.com>
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice,
       this list of conditions and the following disclaimer.

    2. Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.

    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.
Ad Schellevis's avatar
Ad Schellevis committed
30 31 32 33 34 35 36 37 38 39
*/

/* Determine automated help URL. Should output the page name and
   parameters separately */
$uri_split = "";
preg_match("/\/(.*)\?(.*)/", $_SERVER["REQUEST_URI"], $uri_split);

/* If there was no match, there were no parameters, just grab the filename
   Otherwise, use the matched filename from above. */
if (empty($uri_split[0])) {
40
    $pagename = ltrim($_SERVER["REQUEST_URI"], '/');
Ad Schellevis's avatar
Ad Schellevis committed
41
} else {
42
    $pagename = $uri_split[1];
Ad Schellevis's avatar
Ad Schellevis committed
43 44 45
}
/* If the page name is still empty, the user must have requested / (index.php) */
if (empty($pagename)) {
46
    $pagename = "index.php";
Ad Schellevis's avatar
Ad Schellevis committed
47 48
}

49 50
/* If the filename is wizard.php, reparse looking for the .xml filename */
if ($pagename == 'wizard.php') {
51 52 53 54 55 56 57
    $param_split = explode('&', $uri_split[2]);
    foreach ($param_split as $param) {
        if (substr($param, 0, 4) == "xml=") {
            $xmlfile = explode('=', $param);
            $pagename = $xmlfile[1];
        }
    }
Ad Schellevis's avatar
Ad Schellevis committed
58 59
}

60
$aclObj = new \OPNsense\Core\ACL();
Ad Schellevis's avatar
Ad Schellevis committed
61

62 63 64 65
/* display a top alert bar if need be */
$need_alert_display = false;
$found_notices = are_notices_pending();
if($found_notices == true) {
66 67 68 69 70
    $notices = get_notices();
    if(!$notices) {
        $need_alert_display = true;
        $display_text = print_notices($notices) . "<br />";
    }
Ad Schellevis's avatar
Ad Schellevis committed
71
}
72
if($need_alert_display == true) {
Ad Schellevis's avatar
Ad Schellevis committed
73
    echo "<div class=\"col-xs-12\"><div class=\"alert alert-info\"><p>".$display_text."</p></div></div>";
Ad Schellevis's avatar
Ad Schellevis committed
74 75 76
}

?>
77 78

<header class="page-head">
79 80 81 82
  <nav class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
      <div class="navbar-header">
        <a class="navbar-brand" href="/index.php">
Ad Schellevis's avatar
Ad Schellevis committed
83 84
        <img class="brand-logo" src="/ui/themes/<?= $themename ?>/build/images/default-logo.png" height="30" alt="logo" />
        <img class="brand-icon" src="/ui/themes/<?= $themename ?>/build/images/icon-logo.png" height="30" alt="icon" />
85 86 87 88 89 90 91 92 93 94
        </a>
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navigation">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
      </div>
      <div class="collapse navbar-collapse">
        <ul class="nav navbar-nav navbar-right">
95
          <li id="menu_messages"><?= get_menu_messages() ?></li>
96 97 98
          <li>
            <form class="navbar-form" role="search">
              <div class="input-group">
99 100
                <div class="input-group-addon"><i class="fa fa-search"></i></div>
                <input type="text" style="width: 250px;" class="form-control" tabindex="1" data-provide="typeahead" id="menu_search_box">
101 102 103
              </div>
            </form>
          </li>
104 105 106 107
        </ul>
      </div>
    </div>
  </nav>
108 109
</header>

110 111 112 113 114 115
<main class="page-content col-sm-10 col-sm-push-2">
    <aside id="navigation" class="page-side col-xs-12 col-sm-2 hidden-xs">
        <div class="row">
            <nav class="page-side-nav" role="navigation">
                <div id="mainmenu" class="panel" style="border:0px" >
                    <div class="panel list-group" style="border:0px">
116 117
<?php
                          foreach($menuSystem as $topMenuItem): ?>
118
                            <a href="#<?=$topMenuItem->Id;?>" class="list-group-item <?= $topMenuItem->Selected ? 'active-menu-title' : ""; ?>" data-toggle="collapse" data-parent="#mainmenu"><span class="<?=$topMenuItem->CssClass;?> __iconspacer"></span><?=gettext($topMenuItem->VisibleName);?>  </a>
119 120 121 122
                            <div class="collapse <?=$topMenuItem->Selected ? 'active-menu in' :"";?>" id="<?=$topMenuItem->Id;?>">
<?php
                            foreach($topMenuItem->Children as $subMenuItem): ?>
<?php
123
                              if ($subMenuItem->Url == '' ):?>
124
                               <a href="#<?=$topMenuItem->Id;?>_<?=$subMenuItem->Id;?>" class="list-group-item <?=$subMenuItem->Selected ? "active-menu-title" : "";?>" data-toggle="collapse" data-parent="#<?=$topMenuItem->Id;?>" aria-expanded="<?=$subMenuItem->Selected ? "true" : "false";?>">
125 126
                                  <div style="display: table;width: 100%;">
                                    <div style="display: table-row">
127
                                      <div style="display: table-cell"><?=gettext($subMenuItem->VisibleName);?></div>
128
                                        <div style="display: table-cell; text-align:right; vertical-align:middle;"><span class="<?=$subMenuItem->CssClass;?>"></span></div>
129 130 131
                                      </div>
                                  </div>
                               </a>
132 133 134 135 136
                               <div class="collapse <?=$subMenuItem->Selected ? "active-menu in" :"";?>" id="<?=$topMenuItem->Id;?>_<?=$subMenuItem->Id;?>">
<?php
                                  foreach ($subMenuItem->Children as $subsubMenuItem):?>
<?php
                                    if ($subsubMenuItem->IsExternal == "Y"):?>
Ad Schellevis's avatar
Ad Schellevis committed
137
                                            <a href="<?=$subsubMenuItem->Url;?>" target="_blank" class="list-group-item menu-level-3-item <?=$subsubMenuItem->Selected ? "active" :"";?>"><?=gettext($subsubMenuItem->VisibleName);?></a>
138 139
<?php
                                    elseif ($aclObj->isPageAccessible($_SESSION['Username'],$subsubMenuItem->Url)):?>
140
                                            <a href="<?=$subsubMenuItem->Url;?>" class="list-group-item menu-level-3-item <?=$subsubMenuItem->Selected ? "active" :"";?>"><?=gettext($subsubMenuItem->VisibleName);?></a>
141 142 143 144 145 146
<?php
                                    endif;
                                  endforeach;?>
                                </div>
<?php
                              elseif ($subMenuItem->IsExternal == "Y" ):?>
Ad Schellevis's avatar
Ad Schellevis committed
147
                                <a href="<?=$subMenuItem->Url;?>" target="_blank" class="list-group-item <?=$subMenuItem->Selected ? "active" : "";?>" aria-expanded="<?=$subMenuItem->Selected ? "true" : "false";?>">
148 149
                                  <div style="display: table;width: 100%;">
                                    <div style="display: table-row">
150
                                      <div style="display: table-cell"><?=gettext($subMenuItem->VisibleName);?></div>
151
                                        <div style="display: table-cell; text-align:right; vertical-align:middle;"><span class="<?=$subMenuItem->CssClass;?>"></span></div>
152 153 154
                                      </div>
                                  </div>
                                </a>
155 156
<?php
                              elseif ($aclObj->isPageAccessible($_SESSION['Username'],$subMenuItem->Url)):?>
157 158 159
                                <a href="<?=$subMenuItem->Url;?>" class="list-group-item <?=$subMenuItem->Selected ? "active" :"";?>">
                                  <div style="display: table;width: 100%;">
                                    <div style="display: table-row">
160
                                      <div style="display: table-cell"><?=gettext($subMenuItem->VisibleName);?></div>
161
                                        <div style="display: table-cell; text-align:right; vertical-align:middle;"><span class="<?=$subMenuItem->CssClass;?>"></span></div>
162
                                    </div>
163
                                  </div>
164
                                </a>
165 166 167 168 169 170 171
<?php
                              endif;?>
<?php
                            endforeach; ?>
                            </div>
<?php
                        endforeach; ?>
172 173 174 175 176
                    </div>
                </div>
            </nav>
        </div>
    </aside>
177 178 179 180 181 182 183 184 185
  <div class="row">
    <header class="page-content-head">
      <div class="container-fluid">
          <form action="<?=$_SERVER['REQUEST_URI'];?>" method="post">
        <ul class="list-inline">
          <li class="__mb"><h1><?= gentitle($menuBreadcrumbs) ?></h1></li>
          <li class="btn-group-container">
            <?php
            if (isset($service_hook)) {
186
              $ssvc = find_service_by_name($service_hook);
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
              if (!empty($ssvc)) {
                echo get_service_status_icon($ssvc, false);
                echo get_service_control_links($ssvc, false);
              }
            }
            ?>
            <?php if (!empty($main_buttons)): foreach ($main_buttons as $button): ?>
              <a href="<?=$button['href'];?>" class="btn btn-primary"><span class="glyphicon glyphicon-plus-sign __iconspacer"></span><?=$button['label'];?></a>
            <?php endforeach; endif; ?>

            <?php if (isset($widgetfiles)): ?>
              <a href="#" id="updatepref" style="display:none" onclick="return updatePref();" class="btn btn-primary"><?=gettext("Save Settings");?></a>
              <button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal_widgets"><span class="glyphicon glyphicon-plus-sign __iconspacer"></span><?= gettext('Add widget') ?></button>
            <?php endif; ?>
          </li>
        </ul>
          </form>
      </div>
    </header>