{% extends "layout.html" %}
{% block title %}Git repository management{% endblock %}
{% block head %}
  {{ super() }}
  <link href="{{ url_for('static', filename='css/gsFileManager.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
  <link href="{{ url_for('static', filename='css/jqueryTabs.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
  <link href="{{ url_for('static', filename='css/colorbox.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
  <script src="{{ url_for('static', filename='js/jquery/gsFileManager.js') }}" type="application/javascript" charset="utf-8"></script>
  <script src="{{ url_for('static', filename='js/scripts/cloneRepo.js') }}" type="application/javascript" charset="utf-8"></script>
  <script src="{{ url_for('static', filename='js/scripts/repo.js') }}" type="application/javascript" charset="utf-8"></script>
  <script src="{{ url_for('static', filename='js/jquery/jqueryTabs.js') }}" type="application/javascript" charset="utf-8"></script>
  <script src="{{ url_for('static', filename='js/jquery/jquery.colorbox-min.js') }}" type="application/javascript" charset="utf-8"></script>
{% endblock %}
{% block body %}
<div id="tabContainer">
  <ul>
    <li><a href="#tab1" class="active" id="cloneTab">Clone repository</a></li>
    <li><a href="#tab2" id="gitTab">Manage (GIT)</a></li>
    <li><a href="#tab3">Browse</a></li>
  </ul><!-- //Tab buttons -->
  <div class="tabDetails">
    <div id="tab1" class="tabContents">
      <h2>Repository Informations</h2>
      <br/>
      <div id="repository" style="margin-left:40px;">
        <div class='form-elt'><label for='name'>Project name: </label></div>
        <div class='form-elt'><input type="text" name="name" id="name" size='20' value="slapos" /></div>
        <div class='form-elt'><label for='repo'>&nbsp;Project URL: &nbsp;&nbsp;</label></div>
        <div class='form-elt'><input type="text" name="repo" id="repo" size='25' value="http://git.erp5.org/repos/slapos.git" /></div>
        <div class='clear'></div>
        <div class='form-elt'><label for='user'>Your name: &nbsp;&nbsp;&nbsp;</label></div>
        <div class='form-elt'><input type="text" name="user" id="user" size='20' value="{{name}}" /></div>
        <div class='form-elt'><label for='email'>Your Email: </label></div>
        <div class='form-elt'><input type="text" name="email" id="email" size='25' value="{% if not email %}Enter your email address...{% else %}{{email}}{%endif%}" /></div>
        <button class="button" id="clone">clone</button>
        <img class="waitting" id="imgwaitting" src="{{ url_for('static', filename='images/waiting.gif') }}" alt="" />
        <div class='clear'></div><br/>
        <input type="hidden" name="workdir" id="workdir" value="{{workDir}}" />
      </div>
      <br/>
      <h2>Security Mode [Optional]</h2>
      <div class="menu-box-right">
        <div style="background:#fff; padding:10px; min-height:100px; font-size:14px;">
        <div id="box0">
          <h2>Clone Repository without using HTTPS and SSH</h2><br/>
          <p>Choose this mode if you don't have login and password for the repository and you if you don't have the possibility to
          use SSH authentication. Otherwise use your public key or your login and password to clone your project by choosing https or ssh mode. Note
          that, with readonly mode you can not be able to push your changes.</p>
          <br/>
          </div>
          <div id="box1" style="display:none">
              <h2>You can use this public key to setup your repository</h2><br/>
              <textarea class="mb_style public_key" readonly>
              {{public_key}}
              </textarea>
          </div>
          <div id="box2" style="display:none;">
          <h2>Enter your username and password for https authentication access</h2><br/>
          <div style="margin-left:140px; margin-bottom:20px;">
          <label for='username'>Your username:&nbsp;&nbsp;</label>
          <input type="text" name="username" id="username" size='20' value="Enter your username..." /><br/><br/>
          <label for='password'>Your password: &nbsp;&nbsp;</label>
          <input type="password" name="password" id="password" size='20' value="" class="idleField" />
          </div>
          <p></p>
          </div>
          </div>
      </div>
      <div class="menu-box-left">
          <ul id="modelist">
              <li class="checked"><input type="radio" name="security" id="nothing" value="nothing" /><label for="nothing">ReadOnly</label></li>
              <li><input type="radio" name="security" id="ssh" value="SSH" checked /><label for="ssh">SSH Mode</label></li>
              <li style="border-bottom:none"><input type="radio" name="security" id="https" value="HTTPS" /><label for="https">Https Mode</label></li>
          </ul>
      </div>
      <div class="clear"></div><br/>
<!--Fin tab1-->
    </div>
    <div id="tab2" class="tabContents">
      <form action="" method=post>
      <input type="hidden" name="subfolder" id="subfolder" value="" />
      <h2 style="{% if project %}display:none{% endif %}" id="repoEmpty">
        Your repository folder is empty. <a id="switchtoclone">Click here</a> to create a new one!
      </h2>
      <div id="repoContent" style="{% if not project %}display:none{% endif %}">
      <label for='project'>Current Repository: </label>
      <select id="project" name="project">
        {% for folder in project%}
      	<option value="{{folder}}">{{folder}}</option>
      	{% endfor %}
      </select>
      <a id="switchtoclone" class="lshare">&nbsp;New repository&nbsp;</a>
      <br/><br/>
      <div id="contentInfo">
      	<div id="status" style="margin-bottom:20px;">
      		<h2>Please select one project...</h2>
      	</div>
      	<div id="branchlist" style="margin-bottom:20px;">
      	<h2>Your Repository Branches</h2>
      	<div style="margin-left:15px;">
      	<label for='activebranch'>Select your active Branch: </label>
      	<select name="activebranch" id="activebranch">
      	</select>
      	&nbsp;&nbsp;<label for='branchname'>Branch Name: </label>
      	<input type="text" name="branchname" id="branchname" size='22' value="Enter the branch name..." />
      	<input type="submit" name="addbranch" id ="addbranch" value="Add" class="button" title='add new branch: git checkout -b branch'/>
      	<input type="submit" name="docheckout" id ="docheckout" value="Checkout" class="button" title='add existing branch: git checkout branch'/>
      	<br/>
      	<!--<label for='pullbranch'>Update your local repository: </label>-->
      	<!--<input type="submit" name="pullbranch" id ="pullbranch" value="Pull" class="button"/>-->
      	<!--<img class="waitting" id="pullimgwaitting" src="{{ url_for('static', filename='images/waiting.gif') }}" alt="" />-->
      	</div>
      	</div>
      	<div id="commit" style="margin-bottom:20px;">
      	<h2>Commit All your changes (On active branch)</h2>
      	<div style="margin-left:15px;">
      	<label for='commitmsg'>Commit message: </label>
      	<input type="text" name="commitmsg" id="commitmsg" size='40' value="Enter message..." />
      	<input type="submit" name="commit" id ="commitbutton" value="Commit" class="button"/>
      	<img class="waitting" id="imgwaitting" src="{{ url_for('static', filename='images/waiting.gif') }}" alt="" />
      	</div>
      	</div>
      	<br/>
      </div>
      </div>
      </form>
    </div>
    <div id="tab3" class="tabContents">
      <div id="fileNavigator"></div>
    </div>
</div>
</div>

<!-- This contains the hidden content for inline calls -->
<a id='inlineViewer' style='display:none' href="#inline_content">Inline HTML</a>
<div style='display:none'>
  <div id='inline_content' style='padding:10px; background:#fff;'>

  </div>
</div>
{% endblock %}
