/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to codeigniter/js/script.js

  • Committer: Gustav Hatvigsson
  • Date: 2013-05-30 12:02:31 UTC
  • mfrom: (85.1.28 lenasys)
  • Revision ID: gustav.hartvigsson@gmail.com-20130530120231-ttqgqjqw2w8enn7g
Merged Ohlsons changes:
added function to get ssn and name for the registrationspages in the user model.
added the registrationpage for students.
edited the registration page for instructors
edited the css for both the registrationpages
minor fix to registration css

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
$(function(){
 
2
 
 
3
        var dropbox = $('#dropbox'),
 
4
                message = $('.message', dropbox);
 
5
        
 
6
        dropbox.filedrop({
 
7
                // The name of the $_FILES entry:
 
8
                paramname:'files',
 
9
                
 
10
                url: '../../../uploadfile/'+$('input[name="cid"]').val()+'/'+$('input[name="example"]').val()+'/'+$('input[name="page"]').val(),
 
11
                
 
12
                uploadFinished:function(i,file,response){
 
13
                        $('.progress').addClass('done');
 
14
                        html = "";
 
15
                        html += '<div class="file">';
 
16
                        html += "<strong>"+file.name+"</strong>";
 
17
                        html += '<input type="hidden" value="'+file.name+'">';
 
18
                        html += '<label>Language</label><input type="text" name="'+file.name.replace(/\s/g,"")+'_lang" onChange="fileupdated()">';
 
19
                        html += '<label>Type</label><input type="text"  name="'+file.name.replace(/\s/g,"")+'_type" onChange="fileupdated()">';
 
20
                        html += "</div>";
 
21
                        $('#filelist').append(html);
 
22
 
 
23
                },
 
24
                
 
25
        error: function(err, file) {
 
26
                        switch(err) {
 
27
                                case 'BrowserNotSupported':
 
28
                                        showMessage('Your browser does not support HTML5 file uploads!');
 
29
                                        break;
 
30
                                default:
 
31
                                        break;
 
32
                        }
 
33
                },
 
34
                
 
35
                // Called before each upload is started
 
36
                beforeEach: function(file){
 
37
                        
 
38
                },
 
39
                
 
40
                uploadStarted:function(i, file, len){
 
41
                        
 
42
                },
 
43
                
 
44
                progressUpdated: function(i, file, progress) {
 
45
                        $('.progress').width(progress);
 
46
                }
 
47
         
 
48
        });
 
49
        
 
50
 
 
51
        function showMessage(msg){
 
52
                message.html(msg);
 
53
        }
 
54
 
 
55
});
 
56
 
 
57
function fileupdated(){
 
58
        var fileinfo = [];
 
59
        $('.file').each(function() {
 
60
                inputs = $(this).find("input");
 
61
                fileinfo.push({"filename":inputs.get(0).value, "lang": inputs.get(1).value, "type": inputs.get(2).value});
 
62
        });
 
63
        $("input[name='files']").val(JSON.stringify(fileinfo));
 
64
}
 
 
b'\\ No newline at end of file'