<commit_before>---
layout: conflike
title: Programme
visible: 1
permalink: /conflike/
---

<script type="text/javascript">
  var userID = '';
  
  function UniqueUserID() {
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
      var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
      return v.toString(16);
    });
  }
  
  function initializeUserID() { //called on page load (see layout file)
    if (localStorage.userID != '' && localStorage.userID != undefined) {
      userID = localStorage.userID;
    } else {
      userID = UniqueUserID();
      localStorage.userID = userID;
    }
    document.getElementById('userid').innerHTML=userID;
  }
</script>

<script type="text/javascript">
  function setVote(value, confID){
    document.getElementById(confID + '/vote').innerHTML=value;
    var labels= {"-2": "Pas Super", "-1": "Moyen", "+1": "Bien", "+2": "Très bien"};
    document.getElementById(confID + '/vote/label').innerHTML='(' + labels[value] + ')';
  }
  function setComment(value, confID){
    document.getElementById(confID + '/comment').value=value;
  }  
  function setCheckStatus(value, confID) {
    document.getElementById(confID + '/check').checked = value;
  }  
  function getVote(confID) {
    var vote = document.getElementById(confID + '/vote').innerHTML;
    return vote;
  }
  function getCheckStatus(confID) {
    var checkStatus = document.getElementById(confID + '/check').checked;
    return checkStatus;
  }  
  function getComment(confID) {
    var comment = document.getElementById(confID + '/comment').value;
    if (comment == "") comment = "-"; //Attribute can not be empty with DynamoDB
    return comment;
  }
 
  function save(confID) {
    var checkStatus = getCheckStatus(confID);
    var vote = getVote(confID);
    var comment = getComment(confID);

    var api_id = '3gwmfohd5g';
    var url = 'https://'+ api_id +'.execute-api.eu-west-1.amazonaws.com/prod/ConfLike?userid=' + userID;
    var data = '{"ConfID": { "S": "' + confID + '" }, "UserID": { "S": "' + userID + '" }, "Vote": { "S":"' + vote + '"}, "Comment": { "S": "' + comment + '" }, "Checked": { "BOOL": "' + checkStatus + '" }}';

    var request = $.ajax({
      url: url,
      method: "POST",
      contentType: "application/json",  
      data: data
    });
 
    request.done(function( msg ) {
    });
     
    request.fail(function( jqXHR, textStatus ) {
      alert( "failed:\n" + JSON.stringify(jqXHR, null, 2));
    });    
  }
  
  function update() { //called on page load (see layout file)
    var api_id = '3gwmfohd5g'; 
    var url = 'https://'+ api_id +'.execute-api.eu-west-1.amazonaws.com/prod/ConfLike?userid=' + userID;

    var request = $.ajax({
      url: url,
      method: "GET"
    });

    request.done(function( response ) {
      var items = response.Items;
      for(var i = 0; i < items.length; i++) {
        var item=items[i];
        var confID=item.ConfID.S;
        setVote(item.Vote.S, confID);
        setComment(item.Comment.S, confID);
        setCheckStatus(item.Checked.BOOL, confID);       
      }
    });
     
    request.fail(function( jqXHR, textStatus ) {
      alert( "failed:\n" + JSON.stringify(jqXHR, null, 2));
    });  
  }
</script>

<script type="text/javascript">
  function toggleDayDisplay(dayID) {
    day_div = document.getElementById(dayID)
    if (day_div.style.display == "block") {
      day_div.style.display = "none"
    } else {
      day_div.style.display = "block"
    }
  }
</script>

<div class="container">
  <div class="row">    
      <div id="demo-12-col" class="col-xs-12">
          <div class="col-xs-12" style="font-size:24px;padding:15px;text-align:center;background-color:lightgrey;text-decoration:none">AGILE TOUR LILLE 2016</div>
      </div>
  </div>
  
  <div><span>UserID= </span><span id="userid">?</span></div>

 
  {% for day in site.data.schedule %}
    <div class="row">
    <div id="" class="col-xs-12" style="margin:1px" onclick="toggleDayDisplay('{{ day.date | replace:' ','_' }}')">
      <a class="col-xs-12" 
         href="/conflike/#{{ day.date | replace:' ','_' }}" 
         style="padding:10px;text-align:center;background-color:orange;text-decoration:none">
         {{ day.date }} 
      </a>
    </div>
    </div>
    <div id="{{ day.date | replace:' ','_' }}" style="display:none">
      <div class="row"> 
        {% for part in day.schedule %}
          {% for slot in part %}
            <div id="{{ day.date | replace:' ','_' }}_{{ slot.hour }}" class="col-xs-12" style="margin:1px">
                <a class="col-xs-12" 
                   href="/conflike/#{{ day.date | replace:' ','_' }}_{{ slot.hour }}" 
                   style="padding:10px;text-align:center;background-color:lightgreen;text-decoration:none">
                  {{ day.date }} - {{ slot.hour  }}
                </a>
            </div>
            {% for talk in slot.content %}
              <div class="col-xs-12" id="{{ day.date | replace:' ','_' }}_{{ slot.hour }}" style="margin:1px">
                <div class="col-xs-2" style="text-align:center;">
                  <label>
                  <input type="checkbox" id="{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}/check" name="" value="" onchange="save('{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}')">                
                  {{ day.date| replace:'13 octobre', 'Jeudi'| replace:'14 octobre', 'Vendredi' }}
                  </br>
                  {{ slot.hour }}
                  </label>
                </div>
                <!--<span>{{ slot.special}}</span>-->
                <div class="col-xs-3">
                  </br>
                  {{ talk.room }}
                </div>
                <a class="col-xs-7" href="/conflike/#{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}"style="text-align:center;background-color:lightgrey;text-decoration:none">
                    </br>
                    {{ talk.label }}
                    {{ talk.subject }}
                    </br>
                    {% if talk.speaker != nil %} 
                      ({{ talk.speaker }})
                      </br>
                    {% endif %}
                    </br>
                </a>
              </div>
            {% endfor %}
          {% endfor %}
        {% endfor %}
      </div>
      <div class="row"> 
        {% for part in day.schedule %}
          {% for slot in part %}
            {% for talk in slot.content %}
              <div style="border-color:blue; border-width:3px; border-style:dotted" id="{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}" >
                <div style="text-align:center">
                  <div class="alert alert-success">{{ day.date }} / {{slot.hour}} / {{ talk.room }}</div>
                </div>    
                <div style="text-align:center">
                  <div class="alert alert-success">{{ talk.label }}{{ talk.subject }}</div>
                </div>
                <div style="text-align:center">
                  <div class="alert alert-success">{{ talk.speaker }}</div>
                </div>    
                <div style="text-align:center">
                  <div class="alert alert-info">Qu'avez vous pensé de cette conférence ?</div>
                </div>
                
                <span>Votre Note: </span>
                <span id="{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}/vote" style="visibility:visible">0</span>
                <span id="{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}/vote/label" style="visibility:visible">(Pas de note pour le moment)</span>
                <div class="btn-group btn-group-justified">
                  <div class="btn-group">
                    <button type="button" class="btn btn-primary" id="not_great" onclick="setVote('-2', '{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}');save('{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}')">
                      Pas Super
                    </button>
                  </div>
                  <div class="btn-group">
                    <button type="button" class="btn btn-primary" id="so_so" onclick="setVote('-1', '{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}');save('{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}')">
                      Moyen
                    </button>
                  </div>
                  <div class="btn-group">
                    <button type="button" class="btn btn-primary" id="good" onclick="setVote('+1', '{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}');save('{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}')">
                      Bien
                    </button>
                  </div>
                  <div class="btn-group">
                    <button type="button" class="btn btn-primary" id="very_good" onclick="setVote('+2', '{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}');save('{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}')">
                      Très bien
                    </button>
                  </div>
                </div>
                </br>
                <div>Votre commentaire :</div>
                <div class="form-group">
                  <textarea class="form-control" rows="5" id="{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}/comment"></textarea>
                  </br>
                  <div style="text-align:right">
                    <button type="submit" class="btn btn-default" onclick="save('{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}')">Envoyez Votre Commentaire</button>          
                  </div>
                </div>
              </div>
            {% endfor %}
          {% endfor %}
        {% endfor %}
      </div>
    </div>
  {% endfor %}

</div><commit_msg>enable using id as url parameter (to reuse it)<commit_after>---
layout: conflike
title: Programme
visible: 1
permalink: /conflike/
---

<script type="text/javascript">
  var userID = '';
  
  function UniqueUserID() {
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
      var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
      return v.toString(16);
    });
  }
  
  function initializeUserID() { //called on page load (see layout file)
    userID = UniqueUserID(); // Global Variable do not touch

    if (localStorage.userID != '' && localStorage.userID != undefined) {
      userID = localStorage.userID;
    }
    
    url_id_paramater=window.location.search.substring(1).replace('&','');
    if (url_id_paramater != '' && url_id_paramater != undefined) {
      userID = url_id_paramater;
    }
    
    localStorage.userID = userID;
    document.getElementById('userid').innerHTML=userID;
  }
</script>

<script type="text/javascript">
  function setVote(value, confID){
    document.getElementById(confID + '/vote').innerHTML=value;
    var labels= {"-2": "Pas Super", "-1": "Moyen", "+1": "Bien", "+2": "Très bien"};
    document.getElementById(confID + '/vote/label').innerHTML='(' + labels[value] + ')';
  }
  function setComment(value, confID){
    document.getElementById(confID + '/comment').value=value;
  }  
  function setCheckStatus(value, confID) {
    document.getElementById(confID + '/check').checked = value;
  }  
  function getVote(confID) {
    var vote = document.getElementById(confID + '/vote').innerHTML;
    return vote;
  }
  function getCheckStatus(confID) {
    var checkStatus = document.getElementById(confID + '/check').checked;
    return checkStatus;
  }  
  function getComment(confID) {
    var comment = document.getElementById(confID + '/comment').value;
    if (comment == "") comment = "-"; //Attribute can not be empty with DynamoDB
    return comment;
  }
 
  function save(confID) {
    var checkStatus = getCheckStatus(confID);
    var vote = getVote(confID);
    var comment = getComment(confID);

    var api_id = '3gwmfohd5g';
    var url = 'https://'+ api_id +'.execute-api.eu-west-1.amazonaws.com/prod/ConfLike?userid=' + userID;
    var data = '{"ConfID": { "S": "' + confID + '" }, "UserID": { "S": "' + userID + '" }, "Vote": { "S":"' + vote + '"}, "Comment": { "S": "' + comment + '" }, "Checked": { "BOOL": "' + checkStatus + '" }}';

    var request = $.ajax({
      url: url,
      method: "POST",
      contentType: "application/json",  
      data: data
    });
 
    request.done(function( msg ) {
    });
     
    request.fail(function( jqXHR, textStatus ) {
      alert( "failed:\n" + JSON.stringify(jqXHR, null, 2));
    });    
  }
  
  function update() { //called on page load (see layout file)
    var api_id = '3gwmfohd5g'; 
    var url = 'https://'+ api_id +'.execute-api.eu-west-1.amazonaws.com/prod/ConfLike?userid=' + userID;

    var request = $.ajax({
      url: url,
      method: "GET"
    });

    request.done(function( response ) {
      var items = response.Items;
      for(var i = 0; i < items.length; i++) {
        var item=items[i];
        var confID=item.ConfID.S;
        setVote(item.Vote.S, confID);
        setComment(item.Comment.S, confID);
        setCheckStatus(item.Checked.BOOL, confID);       
      }
    });
     
    request.fail(function( jqXHR, textStatus ) {
      alert( "failed:\n" + JSON.stringify(jqXHR, null, 2));
    });  
  }
</script>

<script type="text/javascript">
  function toggleDayDisplay(dayID) {
    day_div = document.getElementById(dayID)
    if (day_div.style.display == "block") {
      day_div.style.display = "none"
    } else {
      day_div.style.display = "block"
    }
  }
</script>

<div class="container">
  <div class="row">    
      <div id="demo-12-col" class="col-xs-12">
          <div class="col-xs-12" style="font-size:24px;padding:15px;text-align:center;background-color:lightgrey;text-decoration:none">AGILE TOUR LILLE 2016</div>
      </div>
  </div>
  
  <div><span>UserID= </span><span id="userid">?</span></div>

 
  {% for day in site.data.schedule %}
    <div class="row">
    <div id="" class="col-xs-12" style="margin:1px" onclick="toggleDayDisplay('{{ day.date | replace:' ','_' }}')">
      <a class="col-xs-12" 
         href="/conflike/#{{ day.date | replace:' ','_' }}" 
         style="padding:10px;text-align:center;background-color:orange;text-decoration:none">
         {{ day.date }} 
      </a>
    </div>
    </div>
    <div id="{{ day.date | replace:' ','_' }}" style="display:none">
      <div class="row"> 
        {% for part in day.schedule %}
          {% for slot in part %}
            <div id="{{ day.date | replace:' ','_' }}_{{ slot.hour }}" class="col-xs-12" style="margin:1px">
                <a class="col-xs-12" 
                   href="/conflike/#{{ day.date | replace:' ','_' }}_{{ slot.hour }}" 
                   style="padding:10px;text-align:center;background-color:lightgreen;text-decoration:none">
                  {{ day.date }} - {{ slot.hour  }}
                </a>
            </div>
            {% for talk in slot.content %}
              <div class="col-xs-12" id="{{ day.date | replace:' ','_' }}_{{ slot.hour }}" style="margin:1px">
                <div class="col-xs-2" style="text-align:center;">
                  <label>
                  <input type="checkbox" id="{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}/check" name="" value="" onchange="save('{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}')">                
                  {{ day.date| replace:'13 octobre', 'Jeudi'| replace:'14 octobre', 'Vendredi' }}
                  </br>
                  {{ slot.hour }}
                  </label>
                </div>
                <!--<span>{{ slot.special}}</span>-->
                <div class="col-xs-3">
                  </br>
                  {{ talk.room }}
                </div>
                <a class="col-xs-7" href="/conflike/#{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}"style="text-align:center;background-color:lightgrey;text-decoration:none">
                    </br>
                    {{ talk.label }}
                    {{ talk.subject }}
                    </br>
                    {% if talk.speaker != nil %} 
                      ({{ talk.speaker }})
                      </br>
                    {% endif %}
                    </br>
                </a>
              </div>
            {% endfor %}
          {% endfor %}
        {% endfor %}
      </div>
      <div class="row"> 
        {% for part in day.schedule %}
          {% for slot in part %}
            {% for talk in slot.content %}
              <div style="border-color:blue; border-width:3px; border-style:dotted" id="{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}" >
                <div style="text-align:center">
                  <div class="alert alert-success">{{ day.date }} / {{slot.hour}} / {{ talk.room }}</div>
                </div>    
                <div style="text-align:center">
                  <div class="alert alert-success">{{ talk.label }}{{ talk.subject }}</div>
                </div>
                <div style="text-align:center">
                  <div class="alert alert-success">{{ talk.speaker }}</div>
                </div>    
                <div style="text-align:center">
                  <div class="alert alert-info">Qu'avez vous pensé de cette conférence ?</div>
                </div>
                
                <span>Votre Note: </span>
                <span id="{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}/vote" style="visibility:visible">0</span>
                <span id="{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}/vote/label" style="visibility:visible">(Pas de note pour le moment)</span>
                <div class="btn-group btn-group-justified">
                  <div class="btn-group">
                    <button type="button" class="btn btn-primary" id="not_great" onclick="setVote('-2', '{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}');save('{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}')">
                      Pas Super
                    </button>
                  </div>
                  <div class="btn-group">
                    <button type="button" class="btn btn-primary" id="so_so" onclick="setVote('-1', '{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}');save('{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}')">
                      Moyen
                    </button>
                  </div>
                  <div class="btn-group">
                    <button type="button" class="btn btn-primary" id="good" onclick="setVote('+1', '{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}');save('{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}')">
                      Bien
                    </button>
                  </div>
                  <div class="btn-group">
                    <button type="button" class="btn btn-primary" id="very_good" onclick="setVote('+2', '{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}');save('{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}')">
                      Très bien
                    </button>
                  </div>
                </div>
                </br>
                <div>Votre commentaire :</div>
                <div class="form-group">
                  <textarea class="form-control" rows="5" id="{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}/comment"></textarea>
                  </br>
                  <div style="text-align:right">
                    <button type="submit" class="btn btn-default" onclick="save('{{ day.date | replace:' ','_' }}_{{slot.hour}}-{{ talk.room }}')">Envoyez Votre Commentaire</button>          
                  </div>
                </div>
              </div>
            {% endfor %}
          {% endfor %}
        {% endfor %}
      </div>
    </div>
  {% endfor %}

</div>
{'fraction_non_alphanumeric': 0.19507585177816464, 'fraction_numerical': 0.006913703058940562, 'mean_word_length': 1.9703058058797458, 'pattern_counts': {'":': 28, '<': 225, '<?xml version=': 0, '>': 223, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2306627', 'n_tokens_mistral': 6538, 'n_tokens_neox': 6135, 'n_words': 1226}