doctype html
html
  head
    title #{title.replace(/( *_-(expression|view)|_(expression|view))_/g, "")}
    script(type='text/javascript', src='jquery-2.0.3.min.js')
    script(type='text/javascript', src='DataTables-1.9.1/media/js/jquery.dataTables.min.js')
    <!--[if IE]><script language="javascript" type="text/javascript" src="flot-0.7/excanvas.min.js"></script><![endif]-->
    script(type='text/javascript', src='flot-0.7/jquery.flot.min.js')
    script(type='text/javascript', src='flot-0.7/jquery.flot.selection.min.js')
    script(type='text/javascript', src='flot-0.7/jquery.flot.resize.min.js')
    script(type='text/javascript', src='flot-0.7/jquery.flot.navigate.min.js')
    script(type='text/javascript', src='jquery.qtip.min.js')
    script(type='text/javascript', src='d3.v3.js')
    script(type='text/javascript', src='common.js')
    block scripts

    link(rel='stylesheet', type='text/css', href='DataTables-1.9.1/media/css/demo_table.css')
    link(rel='stylesheet', type='text/css', href='jquery-ui.css')
    link(rel='stylesheet', type='text/css', href='jquery.qtip.min.css')
    link(rel='stylesheet', type='text/css', href='style.css')
    if (typeof titleLink === "string")
      style(type='text/css').
        ##{titleLink} { color:white}
  body(id="body-#{titleLink}")
    #headers
      #header
        div#logo
          a(href='about')
            img(src='header_logo.png', style="border-style:none")
        div#nav-right
          ul
            - if (isIndex && user.views)
              li#viewsButton
                label
                img#viewsArrow(src="down-arrow.png")
            li#version moloch v#{molochversion}
            - if (user.createEnabled || alwaysShowESStatus)
              li
                a(href="#{elasticBase}/_plugin/head/",target="_blank")
                  div#esstatus.tooltip
        div#nav
          ul.ulist-nav
            li
              a#sessionsLink.expressionsLink(href='#{basePath}') Sessions
            li
              a#spiLink.expressionsLink(href='spiview') SPI&nbsp;View
            li
              a#spigraphLink.expressionsLink(href='spigraph') SPI&nbsp;Graph
            li
              a#connectionsLink.expressionsLink(href='connections') Connections
            if allowUploads
              li
                a#uploadLink(href='upload') Upload
            li
              a#filesLink(href='files') Files
            if user.createEnabled
              li
                a#usersLink(href='users') Users
            li
              a#statsLink(href='stats') Stats
            li.last
              a.config#settingsLinke(href='settings') Settings
        - if (isIndex)
          form#searchForm
            div#searchStuff
              span#searchStuffLeft
                block searchStuffLeft
                select(id='date')
                  option(value=1,selected) Last 1 hr
                  option(value=6) Last 6 hrs
                  option(value=24) Last 24 hrs
                  option(value=48) Last 48 hrs
                  option(value=72) Last 3 days
                  option(value=168) Last Week
                  option(value=720) Last Month
                  option(value=4380) Last 6 Months
                  option(value=-1) All
                  option(value=-2) Custom
              input#expression(type='search', name='expression')
              span#searchStuffRight
                button#searchButton(type="submit") Search
                label#actionsButton Actions 
                  img#actionsButtonArrow(src="down-arrow.png")
      div#customDate
        span Beginning Time:
        input#startDate(size=21)
        span Ending Time:
        input#stopDate(size=21)
        input(type='checkbox', id='strictly', name='strictly', size=21)
        label(for='strictly') Bounded By 
      block customMenu
          
    div.pageBody(id="pageBody-#{titleLink}")
      block content
    div#wrapper(style="display:none")
      form#actionsForm
        div#actions-message
        div#actions-opened-div
          input(type="radio",id="actions-opened",name="actions-type",value="opened")
          label(for="actions-opened")
        div#actions-visible-div
          input(type="radio",id="actions-visible",name="actions-type",value="visible",checked)
          label(for="actions-visible")
        div#actions-all-div
          input(type="radio",id="actions-all",name="actions-type",value="all")
          label(for="actions-all")
        div#actions-linked-div
          label(for='actions-linked') Include 
          select(id='actions-linked',name="actions-linked")
            option(value="false",selected) no
            option(value="time") same time period
            option(value="all") all
          | linked segments (slow)
        div#actions-input-div
          label(for="actions-input")
          input#actions-input(size=45)
        br
        button#actions-button Go
      form#exportForm
        div#export-opened-div
          input(type="radio",id="export-opened",name="export-type",value="opened")
          label(for="export-opened") Export <span id="export-opened-cnt">0</span> opened items
        div#export-visible-div
          input(type="radio",id="export-visible",name="export-type",value="visible",checked)
          label(for="export-visible") Export <span id="export-visible-cnt">0</span> visible items
        div#export-all-div
          input(type="radio",id="export-all",name="export-type",value="all")
          label(for="export-all") Export <span id="export-all-cnt">0</span> query matching items
        div#export-linked-div
          label(for='export-linked') Include 
          select(id='export-linked',name="export-linked")
            option(value="false",selected) no
            option(value="time") same time period
            option(value="all") all
          | linked segments (slow)
        label(for="exportfilename") Filename:
        input#exportfilename(size=45, value="sessions.pcap")
        br
        button Export
      div#actionsMenu
        ul
          li
            label(style='font-weight:bold') Search Result Actions
          li
            a#exportButton Export PCAP
          li
            a#exportCSVButton Export CSV
          li
            a#addTagsButton Add Tags
          - if (user.removeEnabled)
            li
              a#removeTagsButton Remove Tags
            li
              a#scrubButton Scrub PCAP Storage
            li
              a#deleteButton Delete SPI &amp; PCAP
          - if (molochClusters)
            each key in Object.keys(molochClusters)
              li
                a.sendSessionButton(cluster=key) Send Session to #{molochClusters[key].name}
      div#sessionActionsMenu
        ul
          li
            label(style='font-weight:bold') Session Actions
          li
            a#sessionExportButton.exportAction Export PCAP
          li
            a#sessionAddTagsButton.addTagsAction Add Tags
          - if (user.removeEnabled)
            li
              a#sessionRemoveTagsButton.removeTagsAction Remove Tags
            li
              a#sessionScrubButton.scrubAction Scrub PCAP Storage
            li
              a#sessionDeleteButton.deleteAction Delete SPI &amp; PCAP
          - if (molochClusters)
            each key in Object.keys(molochClusters)
              li
                a.sessionSendSessionButton.sendSessionAction(cluster=key) Send Session to #{molochClusters[key].name}
      if (user.views)
        div#viewsMenu
          ul
            li.viewMenuOption
              a.viewMenuOption None
            - var keys = Object.keys(user.views).sort()
            each key in keys
              li
                a.viewMenuOption(exp=user.views[key].expression) #{key}

script(type='text/javascript').
  var molochTitle = "#{title}";
  var molochFields = !{fieldsMap};
  var molochFieldsExp = Object.keys(molochFields);
  var molochSettings  = !{JSON.stringify(user.settings)};
  var molochViews  = !{JSON.stringify(user.views || {})};
  function loadHealth() {
    $.get('#{basePath}eshealth.json', function(data) {
      updateHealth(data);
      setTimeout(loadHealth, 60000);
    });
  }
  loadHealth();
