<%    
    if @string_to_replace && @replacement_string
      # validation screen for bulk update
      reset_cycle 'modules_tree'
%>

  <script type="text/javascript">
    function update_launched() {
      $j('input.action').each(function(index,input) {
        input.disabled=true;
      });
    }
  </script>  
  
  <h1><%= @can_update ? message('update_key.bulk_update_confirmation_page') : message('update_key.bulk_update_impossible') -%></h1>
  <br/>
  <p>
    <% if @can_update %>
      <%= message('update_key.keys_will_be_updated_as_follows') -%>
    <% else %>
      <% if @duplicate_key_found %>
        <%= message('update_key.cant_update_because_duplicate_keys', :params => [@string_to_replace, @replacement_string]) -%>
      <% else %>
        <%= message('update_key.no_key_to_update', :params => @string_to_replace) -%>
      <% end %>
    <% end %>
  </p>
  
  <table class="data" style="width:1%; margin-top: 10px">
    <thead>
      <tr>
        <th><%= message('update_key.old_key') -%></th>
        <th><%= message('update_key.new_key') -%></th>
      </tr>
    </thead>
    <tbody>
      <%= render :partial => 'prepare_keys', :locals => {:current_module => @project, :module_depth => 0, :key_check_results => @key_check_results} -%>
    </tbody>
  </table>
  
  <% if @can_update %>
    <% form_tag( {:action => 'perform_key_bulk_update', :id => @project.id }, :onsubmit => "update_launched();$j('#loading_bulk_update').show();") do -%>
      <input type="hidden" value="<%= @project.id -%>" name="id" id="project_id">
      <input type="hidden" value="<%= @string_to_replace -%>" name="string_to_replace" id="string_to_replace">
      <input type="hidden" value="<%= @replacement_string -%>" name="replacement_string" id="replacement_string">
      <br/>
      <%= submit_tag message('update_key.rename'), :id => 'bulk_update_button', :class => 'action' -%>
      &nbsp;<a href="<%= url_for :action => 'key', :id => @project.key -%>"><%= message('cancel') -%></a>
      <span class="loading" id="loading_bulk_update" style="display: none; padding: 3px 10px;"></span>
    <% end %>
  <% else %>
    <br/>
    <a href="<%= url_for :action => 'key', :id => @project.key -%>"><%= message('back') -%></a>
  <% end %>
    
<% end %>