app/soc/templates/soc/program/show_duplicates.html
author Lennard de Rijk <ljvderijk@gmail.com>
Tue, 24 Mar 2009 19:49:35 +0000
changeset 2004 4d9e41c947fd
parent 1830 b2b638076e90
child 2034 59de158c936d
permissions -rw-r--r--
Added JS to the duplicate proposals page. TODO's: Caching Fix the recalculate to properly clear the previous iteration. Patch by: Mario Ferraro Reviewed by: Lennard de Rijk
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
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    40
      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
    41
        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
    42
      }
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    43
      // 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
    44
      if (html_string=="") {
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    45
        $("#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
    46
      }
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
    // 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
    49
    else {
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    50
      // then the button will show "calculate"
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    51
      $("#id_button_duplicate_slots").val("Calculate");
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    52
    }
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
</script>
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    55
<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
    56
<span class="progressBar" style="display:none;" id="duplicates_progress_bar"></span>
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    57
<span id="description_progressbar"></span><span id="description_done"></span>
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    58
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    59
<br /><br />
4d9e41c947fd Added JS to the duplicate proposals page.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1830
diff changeset
    60
<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
    61
{% endblock %}