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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1830
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     1
{% extends "soc/base.html" %}
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     2
{% comment %}
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     3
Licensed under the Apache License, Version 2.0 (the "License");
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     4
you may not use this file except in compliance with the License.
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     5
You may obtain a copy of the License at
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     6
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     7
  http://www.apache.org/licenses/LICENSE-2.0
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     8
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     9
Unless required by applicable law or agreed to in writing, software
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    10
distributed under the License is distributed on an "AS IS" BASIS,
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    11
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    12
See the License for the specific language governing permissions and
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    13
limitations under the License.
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    14
{% endcomment %}
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    15
{% load forms_helpers %}
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    16
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    17
{% block header_title %}
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    18
{{ page_name }}
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    19
{% endblock %}
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    20
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    21
{% block body %}
2004
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    22
<script language="javascript" type="text/javascript">
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    23
  // variables from python context to get eventual cache
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    24
  // number of orgs, offset and url for querying the apps
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    25
  var infos = {{ info|safe }};
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    26
  var cache = {{ duplicate_cache_content|safe }};
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    27
  var offset_length = {{ offset_length }};
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    28
  var number_of_orgs = infos.nr_of_orgs;
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    29
  var url_to_query = infos.program_key;
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    30
  // this global variable will contain the html to output
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    31
  var html_string = '';
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    32
  $(document).ready(function(){
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    33
    // Initialize the progress bar
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    34
    $("#duplicates_progress_bar").progressBar({showText: false});
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    35
    // if there's data in the cache
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    36
    if (cache.data!=undefined) {
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    37
      // then the button will show "recalculate" instead of "calculate"
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    38
      $("#id_button_duplicate_slots").val("Recalculate");
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    39
      // and then we will show the html based on the cache
2034
59de158c936d Fixed the duplicate slots view.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2004
diff changeset
    40
      html_string = '';
2004
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    41
      for (var student_key in cache.data.students) {
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    42
        duplicateSlots.showDuplicatesHtml(cache.data.orgs,cache.data.students[student_key],student_key,cache.data.students[student_key].proposals);
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    43
      }
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    44
      // if there's no data in the cache, tell the user
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    45
      if (html_string=="") {
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    46
        $("#div_duplicate_slots").html("<strong>No duplicate slot assignments found</strong>");
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    47
      }
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    48
    }
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    49
    // else if there's no data in the cache
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    50
    else {
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    51
      // then the button will show "calculate"
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    52
      $("#id_button_duplicate_slots").val("Calculate");
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    53
    }
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    54
  });
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    55
</script>
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    56
<input type="button" id="id_button_duplicate_slots" onclick="javascript:duplicateSlots.showDuplicatesInit();" class="button" />
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    57
<span class="progressBar" style="display:none;" id="duplicates_progress_bar"></span>
2055
b4375ec63de5 Enable storing of the duplicate calculation results.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2034
diff changeset
    58
<span id="description_progressbar">
b4375ec63de5 Enable storing of the duplicate calculation results.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2034
diff changeset
    59
  {% if date_of_calculation %}
b4375ec63de5 Enable storing of the duplicate calculation results.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2034
diff changeset
    60
    Duplicates as calculated on: {{ date_of_calculation|date:"jS F Y H:i" }}
b4375ec63de5 Enable storing of the duplicate calculation results.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2034
diff changeset
    61
  {% endif %}
b4375ec63de5 Enable storing of the duplicate calculation results.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2034
diff changeset
    62
</span>
b4375ec63de5 Enable storing of the duplicate calculation results.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2034
diff changeset
    63
b4375ec63de5 Enable storing of the duplicate calculation results.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2034
diff changeset
    64
<span id="description_done"></span>
2004
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    65
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    66
<br /><br />
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    67
<div id="div_duplicate_slots"></div>
1830
b2b638076e90 Started with the view for showing students who have been assigned to multiple slots.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    68
{% endblock %}