<%--
    R Service Bus
    
    Copyright (c) Copyright of Open Analytics NV, 2010-2015
 
    ===========================================================================
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.
 
    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>
        
    @author rsb.development@openanalytics.eu
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<html xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:sec="http://www.springframework.org/security/tags">
  <head>
    <script type="text/javascript" src="js/date.js"></script> 
  	<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script> 
    <script type="text/javascript" src="js/jquery.validate-1.7.min.js"></script>
    <script type="text/javascript" src="js/jquery.form-2.96.js"></script>
    <script type="text/javascript" src="js/jquery.ba-dotimeout.min.js"></script>
    <script type="text/javascript" src="js/jquery.MultiFile-1.47.pack.js"></script>
    
    <script type="text/javascript" src="js/jquery-ui-1.8.custom.min.js"></script>
    <link type="text/css" href="css/jquery-ui-1.8.custom.css" rel="stylesheet" />

    <script type="text/javascript" src="js/ui.panel.min.js"></script>
    <link type="text/css" href="css/ui.panel.css" rel="stylesheet" />
    
    <script type="text/javascript" src="js/jquery.jstree.js"></script>
    <script type="text/javascript" src="js/jstree.model_data.js"></script>
    
    <script type="text/javascript" src="js/blackbird.js"></script>
    <link type="text/css" href="css/blackbird.css"  rel="stylesheet" />
    
  	<script type="text/javascript" src="js/rsb.js"></script>
    <link type="text/css" href="css/rsb.css" rel="stylesheet" />
  </head>
  <body>
    <sec:authentication var="user" property="principal" />
    <div class="box">
      <sec:authorize access="isAuthenticated()">
        <!-- Authorities: ${user.authorities} -->
        <div class="alignRight">${user.username} - <a href="logout">Logout</a></div>
      </sec:authorize>
      <h1><img src="css/images/open_analytics_logo.jpg" style="vertical-align:middle;" title="OpenAnalytics" />&nbsp;<span id="formTitle"></span></h1>

      <div class="container">
        <form id="jobUploadForm" name="jobUploadForm" action="api/rest/jobs" method="POST" enctype="multipart/form-data">
          <c:set var="uploadFormFragment">
            <c:out value="${param.form}" default="default-upload-form"/>
          </c:set>
          <jsp:include page="fragments/${uploadFormFragment}.html" /> 
        </form>

        <br/>

        <div id="runningJobsPanel" class="centralPanel">
          <h4>Running Jobs</h4>
          <div>
            <table id="runningJobsTable" cellspacing="1" >
              <thead>
                <tr>
                  <th>Application</th>
                  <th>Date Time</th>
                  <th>Job Id</th>
                </tr>
              </thead>
              <tbody id="runningJobsTableBody">
              </tbody>
            </table>
          </div>
        </div>

        <div id="resultsPanel" class="centralPanel">
          <h4>Results</h4>
          <div>
            <table id="resultsTable" cellspacing="1" >
              <thead>
                <tr>
                  <th>Application</th>
                  <th>Date Time</th>
                  <th>Job Id</th>
                  <th>Result Type</th>
                  <th>Actions</th>
                </tr>
              </thead>
              <tbody id="resultsTableBody">
              </tbody>
            </table>
          </div>
        </div>

      </div>
    </div>

    <div id="errorDialog" title="Error">
        <p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
           <strong id="errorDialogText"></strong></p>
    </div>

    <div id="remoteDataSelector" title="Remote Data Selector">
      <div>Please select a <strong id="remoteDataSelectorType"></strong>:</div>
      <div id="remoteDataTree"></div>
    </div>

    <div><p class="footer">Powered by <a class="footer" href="http://openanalytics.eu">Open Analytics NV</a></p></div>
  </body>
</html>
