<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

    <head>
	{% block head %}
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />

        <title>SlapOS Buildout web runner</title>

        <meta name="keywords" content="" />

        <meta name="description" content="" />

        <link href="{{ url_for('static', filename='css/styles.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
        <script src="{{ url_for('static', filename='js/jquery/jquery-1.8.0.js') }}" type="text/javascript" charset="utf-8"></script>
        <script src="{{ url_for('static', filename='js/jquery/jquery.form.js') }}" type="text/javascript" charset="utf-8"></script>
      	<script src="{{ url_for('static', filename='js/jquery/popup.js') }}" type="text/javascript" charset="utf-8"></script>
      	<script src="{{ url_for('static', filename='js/jquery/jqueryToolTip.js') }}" type="text/javascript" charset="utf-8"></script>
        <script type=text/javascript>
          $SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
        </script>
	<script src="{{ url_for('static', filename='js/scripts/cookies.js') }}" type="text/javascript" charset="utf-8"></script>
	<script src="{{ url_for('static', filename='js/scripts/common.js') }}" type="text/javascript" charset="utf-8"></script>
  <script type="text/javascript">
  	$(document).ready(function() {
      setInput();
      bindRemove();
  	});
  </script>
  {% if request.path != '/login' %}
  <script src="{{ url_for('static', filename='js/scripts/process.js') }}" type="text/javascript" charset="utf-8"></script>
  <script type="text/javascript">
		$(document).ready(function() {
  		if($("input#fmsg").val() != ""){
  		   $("#error").Popup($("input#fmsg").val(), {type:'info', duration:5000, load:true});
  		}
  		bindRun();
  		if(!checkSavedCmd()){
  		    getRunningState();
  		}
		});
	</script>
  {%endif%}
	{% endblock %}
    </head>
    <body>
	<div id="error"></div>

        <div {% if request.path != '/login' %}id="page"{%else%}id="login-page"{%endif%}>
	    <input type="hidden" name="fmsg" value="{{ get_flashed_messages()[0] }}" id="fmsg" />
      {% if request.path != '/login' %}
            <div id="header">
                <div class="block_header">
                    <a href="{{ url_for('home') }}" style="float:left;" id="home" {% if request.path != '/' %}rel="tooltip"{% endif %} title="Home"><img alt="" src="{{ url_for('static', filename='images/home.png') }}" /></a>
		    <div class="line"></div>
		    <a href="{{ url_for('editCurrentProject') }}" style="float:left" title="Edit your current project"><img alt="" src="{{ url_for('static', filename='images/project.png') }}" /></a>
        <div class="line"></div>
		    <a href="{{ url_for('manageProject') }}" style="float:left" title="Manage Your repositories"><img alt="" src="{{ url_for('static', filename='images/manage_repo-little.png') }}" /></a>
        <div class="line"></div>
  	    <a href="{{ url_for('dologout') }}" style="float:left" title="Close your session"><img alt="" src="{{ url_for('static', filename='images/logout.png') }}" /></a>
		    <div class="line"></div>
                    <h2 class="info">{% block title %}{% endblock %} - {{session.title}}</h2>
		    <div class="run"><span id="running" style="display:none"><img alt="" src="{{ url_for('static', filename='images/ajax_roller.gif') }}"
			height='26' title="slapgrid is currently running"/></span></div>
                </div>
                <div class="wmenu">
                    <ul>
                        <li><a href="{{ url_for('editSoftwareProfile') }}">Profiles</a></li>
                        <li><a href="{{ url_for('browseWorkspace') }}">Workspace</a></li>
                        <li class='sep'></li>
                        <li><a href="{{ url_for('runSoftwareProfile') }}" id="softrun">Run software</a></li>
                        <li><a href="{{ url_for('viewSoftwareLog') }}">Software log</a></li>
                        <li><a href="{{ url_for('inspectSoftware') }}">SR result</a></li>
                        <li class='sep'></li>
                        <li><a href="{{ url_for('runInstanceProfile') }}" id="instrun">Run instance</a></li>
                        <li><a href="{{ url_for('viewInstanceLog') }}">Instance log</a></li>
                        <li><a href="{{ url_for('inspectInstance') }}">Inspect instance</a></li>
                        <li><a id="removeIst" href="#">Destroy instance</a></li>
                    </ul>
                </div>
                <div class="clear"></div>
            </div>
            {% endif %}
            <div {% if request.path != '/login' %}id="main"{% endif %}>
                <div {% if request.path == '/' %} class="home_content" {%elif request.path == '/login'%} {%else%} id="content" {% endif %}>
                    {% if request.path != '/' and request.path != '/login'%}
                        <div class="main_head">
                        </div>
                        <div class="content">
                    {% endif %}
                    {% block body %}{% endblock %}
                    {% if request.path != '/' and request.path != '/login'%}
                        </div>
                        <div class="main_foot">
                        </div>
                    {% endif %}
                </div>
            </div>
            {% if request.path != '/login' %}
            <div id="footer">
                SlapOS web runner &copy; Vifib SARL 2011, 2012, 2013 - All right reserved - Creative Commons Shared Alike
            </div>
            {%endif%}
        </div>
        <div class="popup">
        <table id="dpop" cellpadding="0" border="0">
        <tbody><tr>
          <td id="topleft" class="corner"></td>
          <td class="top"><img width="30" height="29" alt="" src="{{ url_for('static', filename='images/bubble-tail2.png') }}"/></td>
          <td id="topright" class="corner"></td>
        </tr><tr>
          <td class="left"></td>
          <td><div class="popup-contents" id="jqtooltip"></div></td>
          <td class="right"></td>
        </tr><tr>
          <td class="corner" id="bottomleft"></td>
          <td class="bottom" valign="left"></td>
          <td id="bottomright" class="corner"></td>
        </tr>
        </tbody></table>
      </div>
      <div id="tooltip-home" style="display:none">
        <span style="font-weight:bold">QUICK ACCESS TO MENU</span><br/><br/>
          <div style="margin-top:3px;border-bottom: 1px dashed #666666; heigth:1px"></div>
          <ul class="menu">
            <li><a href="{{ url_for('manageProject')}}">Manage Repositories</a></li>
            <li><a href="{{ url_for('configRepo')}}" >Clone your repository</a></li>
            <li><a href="{{ url_for('openProject', method='open')}}">Open Software Release</a></li>
            <li><a href="{{ url_for('openProject', method='new')}}">Create Software Release</a></li>
            <li style="heigth:1px"></li>
          </ul>
      </div>
    </body>
</html>
