app/soc/templates/soc/program/show_duplicates.html
author Lennard de Rijk <ljvderijk@gmail.com>
Thu, 02 Apr 2009 19:40:28 +0000
changeset 2055 b4375ec63de5
parent 2034 59de158c936d
permissions -rw-r--r--
Enable storing of the duplicate calculation results. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed

{% extends "soc/base.html" %}
{% comment %}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}
{% load forms_helpers %}

{% block header_title %}
{{ page_name }}
{% endblock %}

{% block body %}
<script language="javascript" type="text/javascript">
  // variables from python context to get eventual cache
  // number of orgs, offset and url for querying the apps
  var infos = {{ info|safe }};
  var cache = {{ duplicate_cache_content|safe }};
  var offset_length = {{ offset_length }};
  var number_of_orgs = infos.nr_of_orgs;
  var url_to_query = infos.program_key;
  // this global variable will contain the html to output
  var html_string = '';
  $(document).ready(function(){
    // Initialize the progress bar
    $("#duplicates_progress_bar").progressBar({showText: false});
    // if there's data in the cache
    if (cache.data!=undefined) {
      // then the button will show "recalculate" instead of "calculate"
      $("#id_button_duplicate_slots").val("Recalculate");
      // and then we will show the html based on the cache
      html_string = '';
      for (var student_key in cache.data.students) {
        duplicateSlots.showDuplicatesHtml(cache.data.orgs,cache.data.students[student_key],student_key,cache.data.students[student_key].proposals);
      }
      // if there's no data in the cache, tell the user
      if (html_string=="") {
        $("#div_duplicate_slots").html("<strong>No duplicate slot assignments found</strong>");
      }
    }
    // else if there's no data in the cache
    else {
      // then the button will show "calculate"
      $("#id_button_duplicate_slots").val("Calculate");
    }
  });
</script>
<input type="button" id="id_button_duplicate_slots" onclick="javascript:duplicateSlots.showDuplicatesInit();" class="button" />
<span class="progressBar" style="display:none;" id="duplicates_progress_bar"></span>
<span id="description_progressbar">
  {% if date_of_calculation %}
    Duplicates as calculated on: {{ date_of_calculation|date:"jS F Y H:i" }}
  {% endif %}
</span>

<span id="description_done"></span>

<br /><br />
<div id="div_duplicate_slots"></div>
{% endblock %}