<commit_before><table class="groupTable">
<tr>
  <td colspan="2"><div class="groupTitle">${ _("Domain control ")}</div></td>
</tr>
</table>
<div>${ locator }</div>
<div class="domain_control">
  <div id="message"></div>
  <ul>
  % for dom, state in domains:
    <li>
      <input type="checkbox" name="selectedDomain" value="${dom.getId()}" ${'checked="checked"' if state else ''}>
        ${dom.getName()}
      </input>
    </li>
  % endfor
  </ul>
</div>
<script type="text/javascript">
function smooth_slide(el, text) {
    el.slideUp(function() {
        $(this).html(text)
    }).slideDown();
}

function refresh_state() {
    var el = $('.domain_control #message');

    var new_state = $(':checkbox:checked').length > 0;

    if (new_state == el.data('enabled')) {
        return;
    } else if (new_state){
        el.data('enabled', true);
        smooth_slide(el, $T('<span class="protPrivate strong">Access restricted</span><p>Only users in the networks selected below will be able to access this event.</p>'));
    } else{
        el.data('enabled', false);
        smooth_slide(el, $T('<span class="protPublic strong">Accessible from everywhere</span><p>To restrict access to this event only to certain IP addresses, choose at least one of the networks below.</p>'));
    }
}

$(function(){
    refresh_state();
});

$('input:checkbox').live('change', function(){
    $this = $(this);
    indicoRequest('event.protection.toggleDomains',
                  {
                      confId: ${conference.getId()},
                      domainId: $this.val(),
                      add: $this.is(':checked')
                  },
                  function(result, error) {
                      if(error) {
                          IndicoUtil.errorReport(error);
                      } else{
                          // only create indicator if there is not already one
                          if (!$('.savedText', $this.closest('li')).length) {
                              var saved = $('<span class="savedText">saved</span>');
                              $this.closest('li').append(saved);
                              saved.delay(1000).fadeOut('slow', function() {
                                  $(this).remove();
                              });
                          }
                          refresh_state();
                      }
                  });
                 });
</script>
<commit_msg>[FIX] Domain control - iteration<commit_after><table class="groupTable">
<tr>
  <td colspan="2"><div class="groupTitle">${ _("Domain control ")}</div></td>
</tr>
</table>
<div>${ locator }</div>
<div class="domain_control">
  <div id="message"></div>
  <ul>
  % for dom, state in domains.iteritems():
    <li>
      <input type="checkbox" name="selectedDomain" value="${dom.getId()}" ${'checked="checked"' if state else ''}>
        ${dom.getName()}
      </input>
    </li>
  % endfor
  </ul>
</div>
<script type="text/javascript">
function smooth_slide(el, text) {
    el.slideUp(function() {
        $(this).html(text)
    }).slideDown();
}

function refresh_state() {
    var el = $('.domain_control #message');

    var new_state = $(':checkbox:checked').length > 0;

    if (new_state == el.data('enabled')) {
        return;
    } else if (new_state){
        el.data('enabled', true);
        smooth_slide(el, $T('<span class="protPrivate strong">Access restricted</span><p>Only users in the networks selected below will be able to access this event.</p>'));
    } else{
        el.data('enabled', false);
        smooth_slide(el, $T('<span class="protPublic strong">Accessible from everywhere</span><p>To restrict access to this event only to certain IP addresses, choose at least one of the networks below.</p>'));
    }
}

$(function(){
    refresh_state();
});

$('input:checkbox').live('change', function(){
    $this = $(this);
    indicoRequest('event.protection.toggleDomains',
                  {
                      confId: ${conference.getId()},
                      domainId: $this.val(),
                      add: $this.is(':checked')
                  },
                  function(result, error) {
                      if(error) {
                          IndicoUtil.errorReport(error);
                      } else{
                          // only create indicator if there is not already one
                          if (!$('.savedText', $this.closest('li')).length) {
                              var saved = $('<span class="savedText">saved</span>');
                              $this.closest('li').append(saved);
                              saved.delay(1000).fadeOut('slow', function() {
                                  $(this).remove();
                              });
                          }
                          refresh_state();
                      }
                  });
                 });
</script>

{'fraction_non_alphanumeric': 0.16418215233816622, 'fraction_numerical': 0.002450479885644272, 'mean_word_length': 1.800457404230989, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2364053', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1308, 'n_words': 305}