~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/admin/subject-media/project.js

  • Committer: David Coles
  • Date: 2010-07-28 10:52:48 UTC
  • mfrom: (1791.2.10 mediahandlers)
  • Revision ID: coles.david@gmail.com-20100728105248-zvbn9g72v1nsskvd
A series of HTML5 based media handlers using the <audio> and <video> tags.  
This replaces the previous page that just showed a download link (which is 
already available on the menu).

Also solves issue where media files were downloaded by the client twice (once 
in an AJAX request intended only for text).

Known issues:
    * Bug #588285: External BHO will not be able to play media due to not
      having IVLE cookie.
    * Bug #610745: Does not correctly preview revisions
    * Bug #610780: Ogg media does not work in Chromium

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
$(document).ready(function(){
2
 
    $("#new_projectset_form").submit(add_projectset);
3
 
    $(".new_project").submit(add_project);
4
 
    $('li').show();
5
 
    $('.add-project-link').click(show_add);
6
 
});
7
 
 
8
 
function serializeForm(form){
9
 
 
10
 
    mylist = form.serializeArray();
11
 
    var data = {};
12
 
    for (var i = 0; i < mylist.length; i++){
13
 
        data[mylist[i].name] = mylist[i].value;
14
 
    }
15
 
    return data;
16
 
 
17
 
};
18
 
 
19
 
function add_project(){
20
 
 
21
 
    $(this).slideToggle('fast');
22
 
    
23
 
    function callback(xhr) {
24
 
        var response = JSON.parse(xhr.responseText);
25
 
        var projectlist = $('#projectslist_' + response.projectset_id);
26
 
        var new_element = response.html.split('\n').slice(1).join('\n');
27
 
        projectlist.children(".list_empty_indicator").remove()
28
 
        add_section = projectlist.children(".add-project");
29
 
        $(add_section).before(new_element).hide().slideDown();
30
 
    };
31
 
 
32
 
    var data = serializeForm($(this));
33
 
 
34
 
    ajax_call(callback, $(this).attr("action"), "", data, 'POST');
35
 
 
36
 
    return false;
37
 
};
38
 
 
39
 
function add_projectset(){
40
 
 
41
 
    $("#add_projectset").attr('disabled', 'disabled');
42
 
 
43
 
    function callback(xhr) {
44
 
        var response = JSON.parse(xhr.responseText);
45
 
        $('#projectset_list').append(response.html);
46
 
        $('#projectset_' + response.projectset_id).hide();
47
 
        $('#projectset_' + response.projectset_id).slideDown();
48
 
        $("#add_projectset").removeAttr('disabled');
49
 
        $(".add-project-link").click(show_add);
50
 
    };
51
 
 
52
 
    var data = serializeForm($("#new_projectset_form"));
53
 
 
54
 
    data['ivle.op'] = 'add_projectset';
55
 
 
56
 
    ajax_call(callback, $("#new_projectset_form").attr("action"), "", data, 
57
 
            'POST');
58
 
 
59
 
    return false;
60
 
};
61
 
 
62
 
function show_add(){
63
 
    $(this).next().slideToggle();
64
 
    return false;
65
 
}